Skip to content

Commit b8f1202

Browse files
committed
Add support for Makefile parameterization
Hard code network alias
1 parent 4b32c44 commit b8f1202

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
NGINX_PLUS_VERSION=19-1
22
NGINX_IMAGE=nginxplus:$(NGINX_PLUS_VERSION)
3+
DOCKER_NETWORK?=test
4+
DOCKER_NGINX_PLUS?=nginx-plus
5+
DOCKER_NGINX_PLUS_HELPER?=nginx-plus-helper
36

47
test: docker-build run-nginx-plus test-run configure-no-stream-block test-run-no-stream-block clean
58

@@ -10,24 +13,24 @@ docker-build:
1013
docker build --build-arg NGINX_PLUS_VERSION=$(NGINX_PLUS_VERSION)~stretch -t $(NGINX_IMAGE) docker
1114

1215
run-nginx-plus:
13-
docker network create --driver bridge test
14-
docker run --network=test -d --name nginx-plus --network-alias=nginx-plus-test --rm -p 8080:8080 -p 8081:8081 $(NGINX_IMAGE)
15-
docker run --network=test -d --name nginx-plus-helper --network-alias=nginx-plus-test --rm -p 8090:8080 -p 8091:8081 $(NGINX_IMAGE)
16+
docker network create --driver bridge $(DOCKER_NETWORK)
17+
docker run --network=$(DOCKER_NETWORK) -d --name $(DOCKER_NGINX_PLUS) --network-alias=nginx-plus-test --rm -p 8080:8080 -p 8081:8081 $(NGINX_IMAGE)
18+
docker run --network=$(DOCKER_NETWORK) -d --name $(DOCKER_NGINX_PLUS_HELPER) --network-alias=nginx-plus-test --rm -p 8090:8080 -p 8091:8081 $(NGINX_IMAGE)
1619

1720
test-run:
1821
go test client/*
1922
go clean -testcache
20-
go test tests/client_test.go
23+
go test tests/client_test.go
2124

2225
configure-no-stream-block:
23-
docker cp docker/nginx_no_stream.conf nginx-plus:/etc/nginx/nginx.conf
24-
docker exec nginx-plus nginx -s reload
26+
docker cp docker/nginx_no_stream.conf $(DOCKER_NGINX_PLUS):/etc/nginx/nginx.conf
27+
docker exec $(DOCKER_NGINX_PLUS) nginx -s reload
2528

2629
test-run-no-stream-block:
2730
go clean -testcache
2831
go test tests/client_no_stream_test.go
2932

3033
clean:
31-
-docker kill nginx-plus
32-
-docker kill nginx-plus-helper
33-
-docker network rm test
34+
-docker kill $(DOCKER_NGINX_PLUS)
35+
-docker kill $(DOCKER_NGINX_PLUS_HELPER)
36+
-docker network rm $(DOCKER_NETWORK)

0 commit comments

Comments
 (0)