Skip to content

Commit

Permalink
chore: get rid of vendor in script and run unit/functionals test in a…
Browse files Browse the repository at this point in the history
… linux container (#195)

* run test in conateinr

* get rid of hidden vendor
  • Loading branch information
Lou1415926 authored Oct 21, 2022
1 parent c0881c5 commit 5622887
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,21 @@ publish-dockerhub:

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

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

.PHONY: integ
integ: build-local-image
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ go run gen/version-gen.go

cd "${ROOT}"

GOOS=$TARGET_GOOS GOARCH=$GOARCH CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -installsuffix cgo -a -ldflags '-s' -o $1/local-container-endpoints ./
GOOS=$TARGET_GOOS GOARCH=$GOARCH CGO_ENABLED=0 GO111MODULE=on go build -installsuffix cgo -a -ldflags '-s' -o $1/local-container-endpoints ./
11 changes: 11 additions & 0 deletions test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.17

WORKDIR /go/src/github.com/awslabs/amazon-ecs-local-container-endpoints

COPY go.mod go.sum ./
ARG GOPROXY=direct
RUN go mod download # The first build will take 2~3 minutes but will be cached for future builds.

COPY . .

CMD ["echo", "run some tests please"]

0 comments on commit 5622887

Please sign in to comment.