Skip to content

Commit 2583f04

Browse files
authored
tests: Build the layering test images on scratch to avoid pulling swift:slim (#60)
Motivation ---------- The layering tests sometimes fail with 400 errors from the registry. This error could be caused by pulling the underlying base image from Docker Hub, although the logs do not give enough information to be certain. We don't need to run the container image in order to check that the payload file is being layered correctly. This would avoid the need to pull `swift:slim`, reducing the risk of external systems causing test failures. Modifications ------------- Build the test image on scratch. Instead of running the container and using `cat` to check the contents of `/payload`, create a container from the image and copy `/payload` out, without starting the container. Result ------ The layering tests should be less susceptible to failures caused by external systems. Test Plan --------- All tests continue to pass.
1 parent 89f49be commit 2583f04

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/interop_tests.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ jobs:
2929
# First layer: payload does not have to be an executable, it just has to have known contents
3030
- name: Build first layer
3131
run: |
32-
echo first > payload
33-
swift run containertool --repository localhost:5000/layering_test payload
34-
docker run --pull=always --rm --entrypoint=cat localhost:5000/layering_test payload | grep first
32+
echo first layer > payload
33+
swift run containertool --repository localhost:5000/layering_test payload --from scratch
34+
docker create --name first --pull always localhost:5000/layering_test
35+
docker cp first:/payload first.payload
36+
grep first first.payload
3537
3638
# Second layer: payload does not have to be an executable, it just has to have known contents. It should replace the first layer.
3739
- name: Build another layer, which should override 'payload' from the first layer
3840
run: |
39-
echo second > payload
41+
echo second layer > payload
4042
swift run containertool --repository localhost:5000/layering_test payload --from localhost:5000/layering_test:latest
41-
docker run --pull=always --rm --entrypoint=cat localhost:5000/layering_test payload | grep second
43+
docker create --name second --pull always localhost:5000/layering_test
44+
docker cp second:/payload second.payload
45+
grep second second.payload

0 commit comments

Comments
 (0)