mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
test: update test to verify container restart on env change
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -5,11 +5,13 @@ ifdef::topdoc[:imagesdir: {topdoc}../../test/case/containers/environment]
|
||||
==== Description
|
||||
|
||||
Verify that environment variables can be set in container configuration
|
||||
and are available inside the running container.
|
||||
and are available inside the running container. Also verify that
|
||||
changing an environment variable triggers a container restart.
|
||||
|
||||
1 Set up a container config with multiple environment variables
|
||||
2. Serve variables back to host using a CGI script in container
|
||||
3. Verify served content against environment variables
|
||||
4. Change an environment variable and verify the container restarts
|
||||
|
||||
==== Topology
|
||||
|
||||
@@ -23,5 +25,7 @@ image::topology.svg[Container environment variables topology, align=center, scal
|
||||
. Verify container has started
|
||||
. Verify basic connectivity to data interface
|
||||
. Verify environment variables in CGI response
|
||||
. Change environment variable and verify container restarts
|
||||
. Verify container has restarted with updated env
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
Container environment variables
|
||||
|
||||
Verify that environment variables can be set in container configuration
|
||||
and are available inside the running container.
|
||||
and are available inside the running container. Also verify that
|
||||
changing an environment variable triggers a container restart.
|
||||
|
||||
1 Set up a container config with multiple environment variables
|
||||
2. Serve variables back to host using a CGI script in container
|
||||
3. Verify served content against environment variables
|
||||
4. Change an environment variable and verify the container restarts
|
||||
"""
|
||||
import infamy
|
||||
from infamy.util import until, to_binary, curl
|
||||
@@ -105,4 +107,24 @@ with infamy.Test() as test:
|
||||
|
||||
until(lambda: all(string in ns.call(lambda: curl(URL)) for string in expected_strings))
|
||||
|
||||
with test.step("Change environment variable and verify container restarts"):
|
||||
UPDATED_ENV_VARS = [
|
||||
{"key": "TEST_VAR", "value": "updated-value"},
|
||||
{"key": "APP_PORT", "value": "8080"},
|
||||
{"key": "DEBUG_MODE", "value": "true"},
|
||||
{"key": "PATH_WITH_SPACES", "value": "/path with spaces/test"}
|
||||
]
|
||||
|
||||
target.put_config_dict("infix-containers", {
|
||||
"containers": {
|
||||
"container": [{
|
||||
"name": f"{NAME}",
|
||||
"env": UPDATED_ENV_VARS,
|
||||
}]
|
||||
}
|
||||
})
|
||||
|
||||
with test.step("Verify container has restarted with updated env"):
|
||||
until(lambda: "TEST_VAR=updated-value" in ns.call(lambda: curl(URL)), attempts=60)
|
||||
|
||||
test.succeed()
|
||||
|
||||
Reference in New Issue
Block a user