From 50a685bd1ed7e3e758d5508c9fd8f8a2e614c6eb Mon Sep 17 00:00:00 2001 From: Ygal Blum Date: Tue, 19 Sep 2023 10:40:46 +0300 Subject: [PATCH] Quadlet Image test - rearrange test function Move all variable definitions to the top of the function Remove unneeded prints Signed-off-by: Ygal Blum --- test/system/252-quadlet.bats | 72 ++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/test/system/252-quadlet.bats b/test/system/252-quadlet.bats index bf60670deea8..e0b4c4c77335 100644 --- a/test/system/252-quadlet.bats +++ b/test/system/252-quadlet.bats @@ -1016,25 +1016,11 @@ EOF } @test "quadlet - image files" { - registry=localhost:${PODMAN_LOGIN_REGISTRY_PORT} - image_on_local_registry=$registry/quadlet_image_test:$(random_string) - authfile=$PODMAN_TMPDIR/authfile.json - - # First, start the registry and populate the authfile that we can use for the test. - start_registry - run_podman login --authfile=$authfile \ - --tls-verify=false \ - --username ${PODMAN_LOGIN_USER} \ - --password ${PODMAN_LOGIN_PASS} \ - $registry - - run_podman image tag $IMAGE $image_on_local_registry - run_podman image push --tls-verify=false --authfile=$authfile $image_on_local_registry - - local image_for_test=$image_on_local_registry + local quadlet_tmpdir=$PODMAN_TMPDIR/quadlets - # Remove the local image to make sure it will be pulled again - run_podman image rm --ignore $image_for_test + local registry=localhost:${PODMAN_LOGIN_REGISTRY_PORT} + local image_for_test=$registry/quadlet_image_test:$(random_string) + local authfile=$PODMAN_TMPDIR/authfile.json local quadlet_image_unit=image_test_$(random_string).image local quadlet_image_file=$PODMAN_TMPDIR/$quadlet_image_unit @@ -1045,29 +1031,15 @@ AuthFile=$authfile TLSVerify=false EOF - # Use the same directory for all quadlet files to make sure later steps access previous ones - local quadlet_tmpdir=$PODMAN_TMPDIR/quadlets - mkdir $quadlet_tmpdir - - # Have quadlet create the systemd unit file for the image unit - run_quadlet "$quadlet_image_file" "$quadlet_tmpdir" - # Save the image service name since the variable will be overwritten - local image_service=$QUADLET_SERVICE_NAME - local quadlet_volume_unit=image_test_$(random_string).volume local quadlet_volume_file=$PODMAN_TMPDIR/$quadlet_volume_unit + local volume_name=systemd-$(basename $quadlet_volume_file .volume) cat > $quadlet_volume_file < $quadlet_container_file <