|
1 |
| -NGINX_PLUS_VERSION=r30 |
2 |
| -DOCKER_NETWORK?=test |
3 |
| -DOCKER_NETWORK_ALIAS=nginx-plus-test |
4 |
| -DOCKER_NGINX_PLUS?=nginx-plus |
5 |
| -DOCKER_NGINX_PLUS_HELPER?=nginx-plus-helper |
6 |
| - |
7 |
| -GOLANG_CONTAINER=golang:1.19 |
8 |
| - |
9 |
| -export TEST_API_ENDPOINT=http://$(DOCKER_NGINX_PLUS):8080/api |
10 |
| -export TEST_API_ENDPOINT_OF_HELPER=http://$(DOCKER_NGINX_PLUS_HELPER):8080/api |
11 |
| -export TEST_UNAVAILABLE_STREAM_ADDRESS=$(DOCKER_NGINX_PLUS):8081 |
12 |
| - |
13 |
| -test: run-nginx-plus test-run configure-no-stream-block test-run-no-stream-block clean |
| 1 | +test: test-all clean |
14 | 2 |
|
15 | 3 | lint:
|
16 | 4 | docker run --pull always --rm -v $(shell pwd):/nginx-plus-go-client -w /nginx-plus-go-client -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run
|
17 | 5 |
|
18 |
| -docker-build: |
19 |
| - docker build --secret id=nginx-repo.crt,src=docker/nginx-repo.crt --secret id=nginx-repo.key,src=docker/nginx-repo.key --build-arg NGINX_PLUS_VERSION=$(NGINX_PLUS_VERSION) -t nginx-plus:$(NGINX_PLUS_VERSION) docker |
20 |
| - |
21 |
| -run-nginx-plus: |
22 |
| - docker network create --driver bridge $(DOCKER_NETWORK) |
23 |
| - docker run --network=$(DOCKER_NETWORK) -d --name $(DOCKER_NGINX_PLUS) --network-alias=$(DOCKER_NETWORK_ALIAS) --rm -p 8080:8080 -p 8081:8081 nginx-plus:$(NGINX_PLUS_VERSION) |
24 |
| - docker run --network=$(DOCKER_NETWORK) -d --name $(DOCKER_NGINX_PLUS_HELPER) --network-alias=$(DOCKER_NETWORK_ALIAS) --rm -p 8090:8080 -p 8091:8081 nginx-plus:$(NGINX_PLUS_VERSION) |
| 6 | +test-all: |
| 7 | + docker compose up -d --build |
| 8 | + docker compose logs -f test-nginx test-client test-no-stream |
25 | 9 |
|
26 | 10 | test-run:
|
27 |
| - docker run --rm \ |
28 |
| - --network=$(DOCKER_NETWORK) \ |
29 |
| - -e TEST_API_ENDPOINT \ |
30 |
| - -e TEST_API_ENDPOINT_OF_HELPER \ |
31 |
| - -e TEST_UNAVAILABLE_STREAM_ADDRESS \ |
32 |
| - -v $(shell pwd):/go/src/github.com/nginxinc/nginx-plus-go-client \ |
33 |
| - -w /go/src/github.com/nginxinc/nginx-plus-go-client \ |
34 |
| - $(GOLANG_CONTAINER) /bin/sh -c "go test client/*; go clean -testcache; go test tests/client_test.go" |
35 |
| - |
36 |
| -configure-no-stream-block: |
37 |
| - docker cp docker/nginx_no_stream.conf $(DOCKER_NGINX_PLUS):/etc/nginx/nginx.conf |
38 |
| - docker exec $(DOCKER_NGINX_PLUS) nginx -s reload |
| 11 | + docker compose up -d --build test-nginx test-client |
| 12 | + docker compose logs -f test-nginx test-client |
39 | 13 |
|
40 |
| -test-run-no-stream-block: configure-no-stream-block |
41 |
| - docker run --rm \ |
42 |
| - --network=$(DOCKER_NETWORK) \ |
43 |
| - -e TEST_API_ENDPOINT \ |
44 |
| - -e TEST_API_ENDPOINT_OF_HELPER \ |
45 |
| - -e TEST_UNAVAILABLE_STREAM_ADDRESS \ |
46 |
| - -v $(shell pwd):/go/src/github.com/nginxinc/nginx-plus-go-client \ |
47 |
| - -w /go/src/github.com/nginxinc/nginx-plus-go-client \ |
48 |
| - $(GOLANG_CONTAINER) /bin/sh -c "go clean -testcache; go test tests/client_no_stream_test.go" |
| 14 | +test-run-no-stream-block: |
| 15 | + docker compose up -d --build test-no-stream |
| 16 | + docker compose logs -f test-no-stream |
49 | 17 |
|
50 | 18 | clean:
|
51 |
| - -docker kill $(DOCKER_NGINX_PLUS) |
52 |
| - -docker kill $(DOCKER_NGINX_PLUS_HELPER) |
53 |
| - -docker network rm $(DOCKER_NETWORK) |
| 19 | + docker compose down --remove-orphans |
0 commit comments