Skip to content

Commit ddd313a

Browse files
committed
Modify stress tests
1 parent 67847c8 commit ddd313a

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/docker-in-docker-stress-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- name: "Install latest devcontainer CLI"
1919
run: npm install -g @devcontainers/cli
2020

21-
- name: "Generating tests for 'docker-in-docker' which validates if docker daemon is running"
22-
run: devcontainer features test --skip-scenarios -f docker-in-docker -i mcr.microsoft.com/devcontainers/base:noble .
21+
- name: "Generating tests for 'docker-in-docker' which validates if docker daemon is running (with iptablesSwitchAtRuntime=true)"
22+
run: devcontainer features test -f docker-in-docker --skip-autogenerated --filter "docker_stress_iptables_runtime" .
2323

2424
test-onCreate:
2525
strategy:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Stress scenario: validates the docker daemon works when the iptables
9+
# alternative switching is deferred to container start (iptablesSwitchAtRuntime=true).
10+
check "init-script-exists" bash -c "test -f /usr/local/share/docker-init.sh"
11+
check "runtime-iptables-block-present" bash -c "grep -q 'update-alternatives --set iptables' /usr/local/share/docker-init.sh"
12+
13+
check "version" docker --version
14+
check "docker-ps" bash -c "docker ps"
15+
check "log-exists" bash -c "ls /tmp/dockerd.log"
16+
check "log-for-completion" bash -c "cat /tmp/dockerd.log | grep 'Daemon has completed initialization'"
17+
check "log-contents" bash -c "cat /tmp/dockerd.log | grep 'API listen on /var/run/docker.sock'"
18+
19+
# Report result
20+
reportResults

test/docker-in-docker/scenarios.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,24 @@
260260
"features": {
261261
"docker-in-docker": {
262262
"version": "latest",
263-
"moby": "false"
263+
"moby": "false",
264+
"iptablesSwitchAtRuntime": true
264265
}
265266
},
266267
"remoteUser": "vscode",
267268
"onCreateCommand": "docker ps && sleep 5s && docker ps"
268269
},
270+
// DO NOT REMOVE: This scenario is used by the docker-in-docker-stress-test workflow
271+
"docker_stress_iptables_runtime": {
272+
"image": "mcr.microsoft.com/devcontainers/base:noble",
273+
"features": {
274+
"docker-in-docker": {
275+
"version": "latest",
276+
"moby": "false",
277+
"iptablesSwitchAtRuntime": true
278+
}
279+
}
280+
},
269281
"azure_linux": {
270282
"image": "mcr.microsoft.com/azurelinux/base/core:3.0",
271283
"features": {

0 commit comments

Comments
 (0)