Skip to content

Commit 5622887

Browse files
authored
chore: get rid of vendor in script and run unit/functionals test in a linux container (#195)
* run test in conateinr * get rid of hidden vendor
1 parent c0881c5 commit 5622887

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,21 @@ publish-dockerhub:
8686

8787
.PHONY: test
8888
test:
89-
go test -timeout=120s -v -cover ./local-container-endpoints/...
89+
# NOTE: unit tests need to run in a linux/windows environment with the current `amazon-ecs-agents` dependency.
90+
# If your dev env is running linux/windows feel free to just:
91+
# go test -timeout=120s -v -cover ./local-container-endpoints/...
92+
docker build -t amazon-ecs-local-container-endpoints-test -f test.Dockerfile .
93+
docker run amazon-ecs-local-container-endpoints-test \
94+
go test -timeout=120s -v -cover ./local-container-endpoints/...
9095

9196
.PHONY: functional-test
9297
functional-test:
93-
go test -timeout=120s -v -tags functional -cover ./local-container-endpoints/handlers/functional_tests/...
98+
# NOTE: functional tests need to run in a linux/windows environment with the current `amazon-ecs-agents` dependency.
99+
# If your dev env running linux/windows feel free to just:
100+
# go test -timeout=120s -v -tags functional -cover ./local-container-endpoints/handlers/functional_tests/...
101+
docker build -t amazon-ecs-local-container-endpoints-test -f test.Dockerfile .
102+
docker run amazon-ecs-local-container-endpoints-test \
103+
go test -timeout=120s -v -tags functional -cover ./local-container-endpoints/handlers/functional_tests/...
94104

95105
.PHONY: integ
96106
integ: build-local-image

scripts/build_binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ go run gen/version-gen.go
2929

3030
cd "${ROOT}"
3131

32-
GOOS=$TARGET_GOOS GOARCH=$GOARCH CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -installsuffix cgo -a -ldflags '-s' -o $1/local-container-endpoints ./
32+
GOOS=$TARGET_GOOS GOARCH=$GOARCH CGO_ENABLED=0 GO111MODULE=on go build -installsuffix cgo -a -ldflags '-s' -o $1/local-container-endpoints ./

test.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.17
2+
3+
WORKDIR /go/src/github.com/awslabs/amazon-ecs-local-container-endpoints
4+
5+
COPY go.mod go.sum ./
6+
ARG GOPROXY=direct
7+
RUN go mod download # The first build will take 2~3 minutes but will be cached for future builds.
8+
9+
COPY . .
10+
11+
CMD ["echo", "run some tests please"]

0 commit comments

Comments
 (0)