File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44Tests verifying link:https://opencontainers.org/[OCI container] support:
55
6+ - Cleanup of any stale containers/volumes before the suite runs
67 - Basic web server container running in host network mode
78 - Container enable/disable functionality via configuration
89 - Container environment variable configuration and access
@@ -13,6 +14,10 @@ Tests verifying link:https://opencontainers.org/[OCI container] support:
1314 - Container upgrade using RPC with cleanup of old image
1415 - Firewall container running in host network mode with full privileges
1516
17+ include::cleanup/Readme.adoc[]
18+
19+ <<<
20+
1621include::basic/Readme.adoc[]
1722
1823<<<
Original file line number Diff line number Diff line change 11---
22
3+ - name : Container Cleanup
4+ case : cleanup/test.py
5+
36- name : Container Basic
47 case : basic/test.py
58
Original file line number Diff line number Diff line change 1+ test.adoc
Original file line number Diff line number Diff line change 1+ === Container Cleanup
2+
3+ ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/cleanup]
4+
5+ ==== Description
6+
7+ Remove all containers and volumes from the target before running other
8+ container tests. Persistent podman storage on test hardware can hold
9+ stale containers from earlier deployments or test runs, which then
10+ appear in operational data and may trip YANG validation -- making
11+ unrelated tests look flaky.
12+
13+ This test runs first in the container suite to guarantee a known-empty
14+ podman state.
15+
16+ ==== Topology
17+
18+ image::topology.svg[Container Cleanup topology, align=center, scaledwidth=75%]
19+
20+ ==== Sequence
21+
22+ . Set up topology and attach to target DUT
23+ . Remove all containers and volumes via podman
24+ . Verify no containers remain
25+
26+
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ """Container Cleanup
3+
4+ Remove all containers and volumes from the target before running other
5+ container tests. Persistent podman storage on test hardware can hold
6+ stale containers from earlier deployments or test runs, which then
7+ appear in operational data and may trip YANG validation -- making
8+ unrelated tests look flaky.
9+
10+ This test runs first in the container suite to guarantee a known-empty
11+ podman state.
12+ """
13+ import infamy
14+ import infamy .ssh as ssh
15+
16+
17+ with infamy .Test () as test :
18+ with test .step ("Set up topology and attach to target DUT" ):
19+ env = infamy .Env ()
20+ target = env .attach ("target" , "mgmt" )
21+ tgtssh = env .attach ("target" , "mgmt" , "ssh" )
22+
23+ if not target .has_model ("infix-containers" ):
24+ test .skip ()
25+
26+ with test .step ("Remove all containers and volumes via podman" ):
27+ tgtssh .runsh ("sudo podman rm -af" )
28+ tgtssh .runsh ("sudo podman volume prune -af" )
29+
30+ with test .step ("Verify no containers remain" ):
31+ out = tgtssh .runsh ("sudo podman ps -aq" ).stdout .strip ()
32+ if out :
33+ print (f"Containers still present: { out !r} " )
34+ test .fail ()
35+
36+ test .succeed ()
Original file line number Diff line number Diff line change 1+ ../../../infamy/topologies/1x1.dot
Original file line number Diff line number Diff line change 99 "running" : true ,
1010 "status" : " Up About a minute" ,
1111 "cmdline" : " /usr/bin/tini -- /usr/sbin/httpd -f -v" ,
12- "command" : " /usr/sbin/httpd -f -v" ,
1312 "network" : {
1413 "interface" : [
1514 {
3029 "running" : true ,
3130 "status" : " Up About a minute" ,
3231 "cmdline" : " /usr/bin/tini -- /usr/sbin/httpd -f -v -p 91" ,
33- "command" : " /usr/sbin/httpd -f -v -p 91" ,
3432 "network" : {
3533 "interface" : [
3634 {
5351 "running" : true ,
5452 "status" : " Up About a minute" ,
5553 "cmdline" : " /usr/bin/tini -- /usr/sbin/nft-helper /etc/nftables.conf" ,
56- "command" : " /usr/sbin/nft-helper /etc/nftables.conf" ,
5754 "network" : {
5855 "host" : true
5956 }
Original file line number Diff line number Diff line change 11881188 "container" : [
11891189 {
11901190 "cmdline" : " /usr/bin/tini -- /usr/sbin/httpd -f -v" ,
1191- "command" : " /usr/sbin/httpd -f -v" ,
11921191 "id" : " 78d28082c2e5d494c82aa181c95118ce498e25930ad9e288ba010257ca336378" ,
11931192 "image" : " localhost/curios-httpd-oci-amd64-v24.11.0:latest" ,
11941193 "image-id" : " d6930d60a73be9980f8e19b4b4f63586a6d3492178e20bea962e4e9b8c654033" ,
12091208 },
12101209 {
12111210 "cmdline" : " /usr/bin/tini -- /usr/sbin/httpd -f -v -p 91" ,
1212- "command" : " /usr/sbin/httpd -f -v -p 91" ,
12131211 "id" : " 3451cfceca4eee1091c1dfedece2faee99bc8a729e781799d9c0b4368a31d86d" ,
12141212 "image" : " localhost/curios-httpd-oci-amd64-v24.11.0:latest" ,
12151213 "image-id" : " d6930d60a73be9980f8e19b4b4f63586a6d3492178e20bea962e4e9b8c654033" ,
12321230 },
12331231 {
12341232 "cmdline" : " /usr/bin/tini -- /usr/sbin/nft-helper /etc/nftables.conf" ,
1235- "command" : " /usr/sbin/nft-helper /etc/nftables.conf" ,
12361233 "id" : " 4e7c3daeba15546e7640014b9ee46e389737ed36583e5cb2f8b75a07a82e8523" ,
12371234 "image" : " localhost/curios-nftables-oci-amd64-v24.11.0:latest" ,
12381235 "image-id" : " 7a3cc502436250357a6664100a600f306334b4d7203890b85b7ea9b8da6b5665" ,
You can’t perform that action at this time.
0 commit comments