Skip to content

Commit dd75382

Browse files
committed
tests: Add a test for app layer ordering
`containertool` currently prepends the app layer to the layer stack, but it should append it. This means that a later layer will not override a file with the same path in an earlier layer. This commit adds an integration tests which stacks two layers on top of each other using containertool and verifies that the second layer overrides the first.
1 parent dc8f7df commit dd75382

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Interop tests
2+
3+
on:
4+
workflow_call:
5+
# inputs:
6+
# example:
7+
# required: true
8+
# type: string
9+
10+
jobs:
11+
layering-test:
12+
name: Layering test
13+
runs-on: ubuntu-latest
14+
services:
15+
registry:
16+
image: registry:2
17+
ports:
18+
- 5000:5000
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
persist-credentials: false
24+
25+
- name: Mark the workspace as safe
26+
# https://github.com/actions/checkout/issues/766
27+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
28+
29+
# First layer: payload does not have to be an executable, it just has to have known contents
30+
- name: Build first layer
31+
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
35+
36+
# Second layer: payload does not have to be an executable, it just has to have known contents. It should replace the first layer.
37+
- name: Build another layer, which should override 'payload' from the first layer
38+
run: |
39+
echo second > payload
40+
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

.github/workflows/pull_request.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
license_header_check_project_name: "SwiftContainerPlugin"
1515
shell_check_container_image: "swift:6.0-noble"
1616

17+
# Unit tests for functions and modules
1718
unit-tests:
1819
name: Unit tests
1920
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
@@ -24,6 +25,7 @@ jobs:
2425
linux_nightly_6_1_arguments_override: "--skip SmokeTests"
2526
linux_nightly_main_arguments_override: "--skip SmokeTests"
2627

28+
# Test functions and modules against an separate registry
2729
integration-tests:
2830
name: Integration tests
2931
runs-on: ubuntu-latest
@@ -51,6 +53,12 @@ jobs:
5153
run: |
5254
swift test
5355
56+
# Test that outputs can be handled properly by other systems
57+
interop-tests:
58+
name: Interop tests
59+
uses: ./.github/workflows/interop_tests.yml
60+
61+
# Full build-package-deploy-run cycles
5462
endtoend-tests:
5563
name: End to end tests
5664
uses: ./.github/workflows/endtoend_tests.yml

0 commit comments

Comments
 (0)