mirror of
https://github.com/containers/podman.git
synced 2025-06-30 15:49:03 +08:00
test/system: speed up exit-code propagation test
IMO it is not important to cover each case with each sdnotify policy, to speed them up we run all the exit code cases only once just twice for each policy while switching the sdnotify policy between each case. This way we safe 50% of runs and should still have sufficient coverage. Before it took around 24 seconds, with this it is around 12 seconds now. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -466,15 +466,19 @@ none | true | false | 0
|
||||
none | false | false | 0
|
||||
"
|
||||
|
||||
# I am sorry, this is a long test as we need to test the upper matrix
|
||||
# twice. The first run is using the default sdnotify policy of "ignore".
|
||||
# In each iteration we switch between the sdnotify policy ignore and conmon.
|
||||
# We could run them in a loop for each case but the test is slow so let's
|
||||
# just switch between them as it should cover both policies sufficiently.
|
||||
# Note because of this make sure to have at least two exit code cases directly
|
||||
# after each other above so both polices will get at least once the error case.
|
||||
# The first run is using the default sdnotify policy of "ignore".
|
||||
# In this case, the service container serves as the main PID of the service
|
||||
# to have a minimal resource footprint. The second run is using the
|
||||
# "conmon" sdnotify policy in which case Podman needs to serve as the main
|
||||
# PID to act as an sdnotify proxy; there Podman will wait for the service
|
||||
# container to exit and reflects its exit code.
|
||||
sdnotify_policy=ignore
|
||||
while read exit_code_prop cmd1 cmd2 exit_code; do
|
||||
for sdnotify_policy in ignore conmon; do
|
||||
generate_exit_code_yaml $fname $cmd1 $cmd2 $sdnotify_policy
|
||||
yaml_sha=$(sha256sum $fname)
|
||||
service_container="${yaml_sha:0:12}-service"
|
||||
@ -488,9 +492,15 @@ none | false | false | 0
|
||||
run_podman container inspect --format '{{.KubeExitCodePropagation}}' $service_container
|
||||
is "$output" "$exit_code_prop" "service container has the expected policy set in its annotations"
|
||||
run_podman wait $service_container
|
||||
is "$output" "$exit_code" "service container exit code (propagation: $exit_code_prop, policy: $service_policy, cmds: $cmd1 + $cmd2)"
|
||||
is "$output" "$exit_code" "service container exit code (propagation: $exit_code_prop, policy: $sdnotify_policy, cmds: $cmd1 + $cmd2)"
|
||||
run_podman kube down $fname
|
||||
done
|
||||
|
||||
# in each iteration switch between conmon/ignore policy to get coverage for both
|
||||
if [[ $sdnotify_policy == "ignore" ]]; then
|
||||
sdnotify_policy=conmon
|
||||
else
|
||||
sdnotify_policy=ignore
|
||||
fi
|
||||
done < <(parse_table "$exit_tests")
|
||||
|
||||
# A final smoke test to make sure bogus policies lead to an error
|
||||
|
Reference in New Issue
Block a user