Skip to content

Commit 1359195

Browse files
committed
test: verify modifying a running container takes
Add new test step that adds a content mount to /var/www/index.html to verify that changes to a running container are activated. This test pass was previously part of the container bridge test, but was moved here to allow that test to focus on bridge specific checks. Issue #930 Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 472488a commit 1359195

File tree

2 files changed

+48
-30
lines changed

2 files changed

+48
-30
lines changed

test/case/infix_containers/container_phys/container_phys.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ endif::testgroup[]
1717
endif::topdoc[]
1818
==== Test sequence
1919
. Set up topology and attach to target DUT
20-
. Create container 'web-phys' from bundled OCI image
21-
. Verify container 'web-phys' has started
20+
. Create httpd container from bundled OCI image
21+
. Verify container has started
2222
. Verify host:data can ping 10.0.0.2
23-
. Verify container 'web-phys' is reachable on http://10.0.0.2:91
23+
. Verify container is reachable on http://10.0.0.2:91
24+
. Verify modifying a running container takes
2425

2526

2627
<<<

test/case/infix_containers/container_phys/test.py

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
"""
1212
import base64
1313
import infamy
14-
from infamy.util import until
14+
from infamy.util import until, to_binary
1515

1616
with infamy.Test() as test:
1717
NAME = "web-phys"
1818
DUTIP = "10.0.0.2"
1919
OURIP = "10.0.0.1"
20+
MESG = "Kilroy was here"
21+
BODY = f"<html><body><p>{MESG}</p></body></html>"
2022
URL = f"http://{DUTIP}:91/index.html"
2123

2224
with test.step("Set up topology and attach to target DUT"):
@@ -26,43 +28,39 @@
2628
if not target.has_model("infix-containers"):
2729
test.skip()
2830

29-
with test.step("Create container 'web-phys' from bundled OCI image"):
31+
with test.step("Create httpd container from bundled OCI image"):
3032
_, ifname = env.ltop.xlate("target", "data")
3133

3234
target.put_config_dict("ietf-interfaces", {
3335
"interfaces": {
34-
"interface": [
35-
{
36-
"name": f"{ifname}",
37-
"ipv4": {
38-
"address": [{
39-
"ip": f"{DUTIP}",
40-
"prefix-length": 24
41-
}]
42-
},
43-
"container-network": {}
44-
}
45-
]
36+
"interface": [{
37+
"name": f"{ifname}",
38+
"ipv4": {
39+
"address": [{
40+
"ip": f"{DUTIP}",
41+
"prefix-length": 24
42+
}]
43+
},
44+
"container-network": {}
45+
}]
4646
}
4747
})
4848
target.put_config_dict("infix-containers", {
4949
"containers": {
50-
"container": [
51-
{
52-
"name": f"{NAME}",
53-
"image": f"oci-archive:{infamy.Container.HTTPD_IMAGE}",
54-
"command": "/usr/sbin/httpd -f -v -p 91",
55-
"network": {
56-
"interface": [
57-
{ "name": f"{ifname}" }
58-
]
59-
}
50+
"container": [{
51+
"name": f"{NAME}",
52+
"image": f"oci-archive:{infamy.Container.HTTPD_IMAGE}",
53+
"command": "/usr/sbin/httpd -f -v -p 91",
54+
"network": {
55+
"interface": [
56+
{"name": f"{ifname}"}
57+
]
6058
}
61-
]
59+
}]
6260
}
6361
})
6462

65-
with test.step("Verify container 'web-phys' has started"):
63+
with test.step("Verify container has started"):
6664
c = infamy.Container(target)
6765
until(lambda: c.running(NAME), attempts=10)
6866

@@ -74,7 +72,26 @@
7472
with test.step("Verify host:data can ping 10.0.0.2"):
7573
ns.must_reach(DUTIP)
7674

77-
with test.step("Verify container 'web-phys' is reachable on http://10.0.0.2:91"):
75+
with test.step("Verify container is reachable on http://10.0.0.2:91"):
7876
until(lambda: url.nscheck(ns, "It works"), attempts=10)
7977

78+
with test.step("Verify modifying a running container takes"):
79+
# Regression test for issue #930
80+
data = to_binary(BODY)
81+
82+
target.put_config_dict("infix-containers", {
83+
"containers": {
84+
"container": [{
85+
"name": f"{NAME}",
86+
"mount": [{
87+
"name": "index.html",
88+
"content": f"{data}",
89+
"target": "/var/www/index.html"
90+
}]
91+
}]
92+
}
93+
})
94+
95+
until(lambda: url.nscheck(ns, MESG), attempts=10)
96+
8097
test.succeed()

0 commit comments

Comments
 (0)