Skip to content

Commit 02f0552

Browse files
authored
V2 integration test fixes (#451)
* isolate integration test fixtures for v2 * update coprocess integration test to avoid GNUvsBSD sed on test running machine
1 parent 4e2a8d3 commit 02f0552

21 files changed

Lines changed: 55 additions & 57 deletions

File tree

integration_tests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Fixtures Directory: `integration_tests/fixtures`
2222

2323
- Folders in the fixtures directory will be built as docker images in alphabetical order
2424
- Each folder should contain a `Dockerfile` and any resources necessary to build the image
25-
- The resulting image will be named `cpfix_fixture_name`
25+
- The resulting image will be named `cpfix2_fixture_name`
2626

2727
*Note*: Since fixtures are created in alpha order, they can have FROM directives for previously created images
2828

@@ -51,7 +51,7 @@ This script can make some assumptions:
5151
- For each fixture:
5252
- Copy `build` into `integration_test/fixtures/fixture_name/build` so it can easily be sourced by the `Dockerfile`
5353
- `cd integration_tests/fixtures/fixture_name`
54-
- `docker build -t cpfix_fixture_name .`
54+
- `docker build -t cpfix2_fixture_name .`
5555

5656
### Run tests
5757
- Scan through all folders in `integration_tests/tests` in alpha order

integration_tests/fixtures/app/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN npm install -g json http-server
99

1010
COPY build/containerpilot /bin/containerpilot
1111
COPY app-with-consul.json /app-with-consul.json
12+
COPY app-with-coprocess.json /app-with-coprocess.json
1213
COPY app-with-consul-prestart-sigusr1.json /app-with-consul-prestart-sigusr1.json
1314
COPY app-with-consul-prestart-sighup.json /app-with-consul-prestart-sighup.json
1415
COPY app-with-etcd.json /app-with-etcd.json

integration_tests/tests/test_coprocess/containerpilot.json renamed to integration_tests/fixtures/app/app-with-coprocess.json

File renamed without changes.

integration_tests/tests/test_coprocess/docker-compose.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
consul:
2-
image: "cpfix_consul"
2+
image: "cpfix2_consul"
33
mem_limit: 128m
44
hostname: consul
55

66
app:
7-
image: "cpfix_app"
7+
image: "cpfix2_app"
88
mem_limit: 128m
99
links:
1010
- consul:consul
1111
environment:
12-
- CONTAINERPILOT=file:///etc/containerpilot.json
12+
- CONTAINERPILOT=file:///app-with-coprocess.json
1313
volumes:
1414
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'
15-
- './containerpilot.json:/etc/containerpilot.json'
1615
- './coprocess.sh:/bin/coprocess.sh'
1716

1817
test:
19-
image: "cpfix_test_probe"
18+
image: "cpfix2_test_probe"
2019
mem_limit: 128m
2120
links:
2221
- consul:consul

integration_tests/tests/test_coprocess/run.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ function finish {
55
result=$?
66
if [ $result -ne 0 ]; then
77
echo '----- APP LOGS ------'
8-
docker logs $(docker ps -l -f "ancestor=cpfix_app" --format="{{.ID}}")
8+
docker logs $(docker ps -l -f "ancestor=cpfix2_app" --format="{{.ID}}")
99
echo '---------------------'
1010
fi
11-
# clean up after the test
12-
sed -i 's/arg2/arg1/' ./containerpilot.json
1311
exit $result
1412
}
1513
trap finish EXIT
@@ -20,32 +18,32 @@ docker-compose up -d
2018
docker-compose run --no-deps test /go/bin/test_probe test_consul > /dev/null 2>&1
2119
if [ ! $? -eq 0 ] ; then exit 1 ; fi
2220

23-
ID=$(docker ps -l -f "ancestor=cpfix_app" --format="{{.ID}}")
21+
ID=$(docker ps -l -f "ancestor=cpfix2_app" --format="{{.ID}}")
2422

2523
# verify the coprocess is running
26-
docker exec -it ${ID} ps -ef | grep coprocess
24+
docker exec -it "$ID" ps -ef | grep coprocess
2725

2826
# kill the coprocess and verify it restarts
29-
docker exec -it ${ID} pkill coprocess
27+
docker exec -it "$ID" pkill coprocess
3028
sleep 1
31-
docker exec -it ${ID} ps -ef | grep coprocess
29+
docker exec -it "$ID" ps -ef | grep coprocess
3230

3331
# kill the coprocess and verify it doesn't restart again
34-
docker exec -it ${ID} pkill coprocess
32+
docker exec -it "$ID" pkill coprocess
3533
sleep 1
3634

3735
set +e
38-
docker exec -it ${ID} ps -ef | grep coprocess && exit 1
36+
docker exec -it "$ID" ps -ef | grep coprocess && exit 1
3937
set +e
4038

4139
# update the ContainerPilot config and verify the coprocess is running
4240
# with the new flags (this resets the restart limit)
43-
sed -i 's/arg1/arg2/' ./containerpilot.json
44-
docker exec -it ${ID} kill -SIGHUP 1
41+
docker exec -it "$ID" sed -i 's/arg1/arg2/' /app-with-coprocess.json
42+
docker exec -it "$ID" kill -SIGHUP 1
4543
sleep 1
46-
docker exec -it ${ID} ps -ef | grep coprocess | grep arg2
44+
docker exec -it "$ID" ps -ef | grep coprocess | grep arg2
4745

4846
# kill the coprocess and verify it restarts
49-
docker exec -it ${ID} pkill coprocess
47+
docker exec -it "$ID" pkill coprocess
5048
sleep 1
51-
docker exec -it ${ID} ps -ef | grep coprocess
49+
docker exec -it "$ID" ps -ef | grep coprocess

integration_tests/tests/test_discovery_consul/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
consul:
2-
image: "cpfix_consul"
2+
image: "cpfix2_consul"
33
mem_limit: 128m
44
hostname: consul
55

66
app:
7-
image: "cpfix_app"
7+
image: "cpfix2_app"
88
mem_limit: 128m
99
links:
1010
- consul:consul
1111
volumes:
1212
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'
1313

1414
nginx:
15-
image: "cpfix_nginx"
15+
image: "cpfix2_nginx"
1616
mem_limit: 128m
1717
links:
1818
- consul:consul
1919
volumes:
2020
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'
2121

2222
test:
23-
image: "cpfix_test_probe"
23+
image: "cpfix2_test_probe"
2424
mem_limit: 128m
2525
links:
2626
- app:app

integration_tests/tests/test_discovery_etcd/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
etcd:
2-
image: "cpfix_etcd"
2+
image: "cpfix2_etcd"
33
mem_limit: 128m
44
hostname: etcd
55
ports:
66
- 4001:4001
77

88
app:
9-
image: "cpfix_app"
9+
image: "cpfix2_app"
1010
mem_limit: 128m
1111
links:
1212
- etcd:etcd
@@ -16,7 +16,7 @@ app:
1616
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'
1717

1818
nginx:
19-
image: "cpfix_nginx"
19+
image: "cpfix2_nginx"
2020
mem_limit: 128m
2121
links:
2222
- etcd:etcd
@@ -26,7 +26,7 @@ nginx:
2626
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'
2727

2828
test:
29-
image: "cpfix_test_probe"
29+
image: "cpfix2_test_probe"
3030
mem_limit: 128m
3131
links:
3232
- app:app

integration_tests/tests/test_envvars/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
etcd:
2-
image: "cpfix_etcd"
2+
image: "cpfix2_etcd"
33
mem_limit: 128m
44
hostname: etcd
55
ports:

integration_tests/tests/test_logging/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
consul:
2-
image: "cpfix_consul"
2+
image: "cpfix2_consul"
33
mem_limit: 128m
44
hostname: consul
55

66
app:
7-
image: "cpfix_app"
7+
image: "cpfix2_app"
88
mem_limit: 128m
99
links:
1010
- consul:consul
@@ -14,7 +14,7 @@ app:
1414
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'
1515

1616
test:
17-
image: "cpfix_test_probe"
17+
image: "cpfix2_test_probe"
1818
mem_limit: 128m
1919
links:
2020
- consul:consul

integration_tests/tests/test_no_command/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
app:
2-
image: "cpfix_app"
2+
image: "cpfix2_app"
33
mem_limit: 128m
44
volumes:
55
- '${CONTAINERPILOT_BIN}:/bin/containerpilot:ro'

0 commit comments

Comments
 (0)