summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-03-24 11:27:44 +0530
committerAditya R <arajan@redhat.com>2022-03-24 12:27:37 +0530
commit44936c14961ac7bdc033ece1a0ee11d293446cc1 (patch)
treeffc4ff793b0fb9d5098f037be09ff8a0f57ab9d6 /test
parent005a8e711ca8160bb77e76cda6b8b084c5dc8048 (diff)
downloadpodman-44936c14961ac7bdc033ece1a0ee11d293446cc1.tar.gz
podman-44936c14961ac7bdc033ece1a0ee11d293446cc1.tar.bz2
podman-44936c14961ac7bdc033ece1a0ee11d293446cc1.zip
test: add a test to verify race free concurrent/parallel builds
Invoking parallel/concurrent builds from podman race against each other following behviour was fixed in containers/storage#1153 and containers/image#1480 Test verifies if following bug is fixed in new race-free API or not. Read more about this issue, see bz 2055487 for more details. Test manually backported from: containers@63f92d0 Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/070-build.bats26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index c963d8325..94256b215 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -210,6 +210,32 @@ EOF
run_podman rmi -f build_test
}
+@test "podman parallel build should not race" {
+ skip_if_remote "following test is not supported for remote clients"
+
+ # Run thirty parallel builds using the same Containerfile
+ cat >$PODMAN_TMPDIR/Containerfile <<EOF
+FROM $IMAGE
+RUN echo hi
+EOF
+
+ local count=30
+ for i in $(seq --format '%02g' 1 $count); do
+ timeout --foreground -v --kill=10 60 \
+ $PODMAN build -t i$i $PODMAN_TMPDIR &>/dev/null &
+ done
+
+ # Wait for all background builds to complete. Note that this succeeds
+ # even if some of the individual builds fail! Our actual test is below.
+ wait
+
+ # Now delete all built images. If any image wasn't built, rmi will fail
+ # and test will fail.
+ for i in $(seq --format 'i%02g' 1 $count); do
+ run_podman rmi $i
+ done
+}
+
@test "podman build - URLs" {
tmpdir=$PODMAN_TMPDIR/build-test
mkdir -p $tmpdir