From 2491d38e031e3bb8d54245adc889915c6e9d527b Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Thu, 28 Sep 2017 12:51:35 -0400 Subject: [PATCH] Also refactor setting flags for running kpod * Remove duplicate definitions of storage-related flags for kpod, since we set them in helpers.bash now, and the other locations that were also setting it were doing so after loading the definitions in helpers. * Set kpod storage flags after checking if we need to force use of the "vfs" storage driver for cri-o, to make sure kpod also ends up with the same override if we're using one. Signed-off-by: Nalin Dahyabhai --- test/cgroups.bats | 2 +- test/helpers.bash | 7 ++----- test/kpod_export.bats | 4 ---- test/kpod_mount.bats | 12 ++++-------- test/kpod_pause.bats | 4 +--- test/kpod_push.bats | 2 +- test/{tag.bats => kpod_tag.bats} | 4 ---- test/kpod_wait.bats | 4 ---- 8 files changed, 9 insertions(+), 30 deletions(-) rename test/{tag.bats => kpod_tag.bats} (90%) diff --git a/test/cgroups.bats b/test/cgroups.bats index 44d1acfc..cbe27be4 100644 --- a/test/cgroups.bats +++ b/test/cgroups.bats @@ -37,4 +37,4 @@ function teardown() { cleanup_ctrs cleanup_pods stop_crio -} \ No newline at end of file +} diff --git a/test/helpers.bash b/test/helpers.bash index e0723e8b..e68fd5e1 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -59,11 +59,6 @@ PIDS_LIMIT=${PIDS_LIMIT:-1024} # Log size max limit LOG_SIZE_MAX_LIMIT=${LOG_SIZE_MAX_LIMIT:--1} -# Options for kpod. -ROOT="${TESTDIR}/crio" -RUNROOT="${TESTDIR}/crio-run" -KPOD_OPTIONS="--root ${ROOT} --runroot ${RUNROOT} ${STORAGE_OPTS} --runtime ${RUNTIME_BINARY}" - TESTDIR=$(mktemp -d) # kpod pull needs a configuration file for shortname pulls @@ -95,6 +90,8 @@ CRIO_CNI_PLUGIN="/opt/cni/bin/" POD_CIDR="10.88.0.0/16" POD_CIDR_MASK="10.88.*.*" +KPOD_OPTIONS="--root $TESTDIR/crio $STORAGE_OPTS --runroot $TESTDIR/crio-run --runtime ${RUNTIME_BINARY}" + cp "$CONMON_BINARY" "$TESTDIR/conmon" PATH=$PATH:$TESTDIR diff --git a/test/kpod_export.bats b/test/kpod_export.bats index fca3021a..9454db39 100644 --- a/test/kpod_export.bats +++ b/test/kpod_export.bats @@ -3,10 +3,6 @@ load helpers IMAGE="redis:alpine" -ROOT="${TESTDIR}/crio" -RUNROOT="${TESTDIR}/crio-run" -# Do not add --storage-driver vfs -KPOD_OPTIONS="--root ${ROOT} --runroot ${RUNROOT} --runtime ${RUNTIME_BINARY}" function teardown() { cleanup_test diff --git a/test/kpod_mount.bats b/test/kpod_mount.bats index 7b947722..237dd584 100644 --- a/test/kpod_mount.bats +++ b/test/kpod_mount.bats @@ -1,16 +1,12 @@ #!/usr/bin/env bats -function teardown() { - cleanup_test -} - load helpers IMAGE="redis:alpine" -ROOT="${TESTDIR}/crio" -RUNROOT="${TESTDIR}/crio-run" -# Do not add --storage-driver vfs -KPOD_OPTIONS="--root ${ROOT} --runroot ${RUNROOT} --runtime ${RUNTIME_BINARY}" + +function teardown() { + cleanup_test +} @test "mount" { start_crio diff --git a/test/kpod_pause.bats b/test/kpod_pause.bats index ebb96cbb..746d39db 100644 --- a/test/kpod_pause.bats +++ b/test/kpod_pause.bats @@ -3,9 +3,7 @@ load helpers IMAGE="redis:alpine" -ROOT="$TESTDIR/crio" -RUNROOT="$TESTDIR/crio-run" -KPOD_OPTIONS="--root $ROOT --runroot $RUNROOT $STORAGE_OPTS --runtime $RUNTIME_BINARY" + function teardown() { cleanup_test } diff --git a/test/kpod_push.bats b/test/kpod_push.bats index 983f1409..d1507f12 100644 --- a/test/kpod_push.bats +++ b/test/kpod_push.bats @@ -12,7 +12,7 @@ function teardown() { run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" containers-storage:[$ROOT]busybox:test + run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" containers-storage:[${TESTDIR}/crio]busybox:test echo "$output" [ "$status" -eq 0 ] run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" busybox:test diff --git a/test/tag.bats b/test/kpod_tag.bats similarity index 90% rename from test/tag.bats rename to test/kpod_tag.bats index 24e495d6..6c00456b 100644 --- a/test/tag.bats +++ b/test/kpod_tag.bats @@ -2,11 +2,7 @@ load helpers - IMAGE="docker.io/library/alpine:latest" -ROOT="$TESTDIR/crio" -RUNROOT="$TESTDIR/crio-run" -KPOD_OPTIONS="--root $ROOT --runroot $RUNROOT --storage-driver vfs" function teardown() { cleanup_test diff --git a/test/kpod_wait.bats b/test/kpod_wait.bats index 5bc396b8..f1e02b7c 100644 --- a/test/kpod_wait.bats +++ b/test/kpod_wait.bats @@ -3,10 +3,6 @@ load helpers IMAGE="redis:alpine" -ROOT="$TESTDIR/crio" -RUNROOT="$TESTDIR/crio-run" -KPOD_OPTIONS="--root $ROOT --runroot $RUNROOT ${STORAGE_OPTS}" - # Returns the POD ID function pod_run_from_template(){