The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4169
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Thomas Hipp <[email protected]>
From 060eed8e07d9621cbcf0edd6f230fc4cef2f860a Mon Sep 17 00:00:00 2001 From: Thomas Hipp <[email protected]> Date: Fri, 12 Jan 2018 15:56:06 +0100 Subject: [PATCH] test: fix shellcheck complaints Signed-off-by: Thomas Hipp <[email protected]> --- test/includes/lxd.sh | 2 +- test/includes/setup.sh | 1 + test/includes/storage.sh | 2 +- test/main.sh | 2 +- test/suites/basic.sh | 5 +++++ test/suites/config.sh | 4 ++-- test/suites/image_auto_update.sh | 1 + test/suites/image_prefer_cached.sh | 1 + test/suites/init_auto.sh | 4 ++-- 9 files changed, 15 insertions(+), 7 deletions(-) diff --git a/test/includes/lxd.sh b/test/includes/lxd.sh index bc6349a25..9e2f2eb5d 100644 --- a/test/includes/lxd.sh +++ b/test/includes/lxd.sh @@ -203,7 +203,7 @@ kill_lxd() { wipe "${daemon_dir}" # Remove the daemon from the list - sed "\|^${daemon_dir}|d" -i "${TEST_DIR}/daemons" + sed "#^${daemon_dir}#d" -i "${TEST_DIR}/daemons" } shutdown_lxd() { diff --git a/test/includes/setup.sh b/test/includes/setup.sh index 1ecbc5cbe..55f0ed67d 100644 --- a/test/includes/setup.sh +++ b/test/includes/setup.sh @@ -9,6 +9,7 @@ ensure_has_localhost_remote() { } ensure_import_testimage() { + # shellcheck disable=SC1117 if ! lxc image alias list | grep -q "^| testimage\s*|.*$"; then if [ -e "${LXD_TEST_IMAGE:-}" ]; then lxc image import "${LXD_TEST_IMAGE}" --alias testimage diff --git a/test/includes/storage.sh b/test/includes/storage.sh index a3f019cac..f970c9093 100644 --- a/test/includes/storage.sh +++ b/test/includes/storage.sh @@ -106,7 +106,7 @@ deconfigure_loop_device() { fi rm -f "${lv_loop_file}" - sed -i "\|^${loopdev}|d" "${TEST_DIR}/loops" + sed -i "#^${loopdev}#d" "${TEST_DIR}/loops" } umount_loops() { diff --git a/test/main.sh b/test/main.sh index 0890f9d77..674bc798b 100755 --- a/test/main.sh +++ b/test/main.sh @@ -74,7 +74,7 @@ cleanup() { fi echo "==> Test result: ${TEST_RESULT}" - # shellcheck disable=SC2086 + # shellcheck disable=SC2086,SC1117 printf "To poke around, use:\n LXD_DIR=%s LXD_CONF=%s sudo -E %s/bin/lxc COMMAND\n" "${LXD_DIR}" "${LXD_CONF}" ${GOPATH:-} echo "Tests Completed (${TEST_RESULT}): hit enter to continue" diff --git a/test/suites/basic.sh b/test/suites/basic.sh index a5cdab776..3a6673a1b 100644 --- a/test/suites/basic.sh +++ b/test/suites/basic.sh @@ -197,23 +197,28 @@ test_basic_usage() { # 1. Basic built-in alias functionality [ "$(lxc ls)" = "$(lxc list)" ] # 2. Basic user-defined alias functionality + # shellcheck disable=SC1117 printf "aliases:\n l: list\n" >> "${LXD_CONF}/config.yml" [ "$(lxc l)" = "$(lxc list)" ] # 3. Built-in aliases and user-defined aliases can coexist [ "$(lxc ls)" = "$(lxc l)" ] # 4. Multi-argument alias keys and values + # shellcheck disable=SC1117 printf " i ls: image list\n" >> "${LXD_CONF}/config.yml" [ "$(lxc i ls)" = "$(lxc image list)" ] # 5. Aliases where len(keys) != len(values) (expansion/contraction of number of arguments) + # shellcheck disable=SC1117 printf " ils: image list\n container ls: list\n" >> "${LXD_CONF}/config.yml" [ "$(lxc ils)" = "$(lxc image list)" ] [ "$(lxc container ls)" = "$(lxc list)" ] # 6. User-defined aliases override built-in aliases + # shellcheck disable=SC1117 printf " cp: list\n" >> "${LXD_CONF}/config.yml" [ "$(lxc ls)" = "$(lxc cp)" ] # 7. User-defined aliases override commands and don't recurse lxc init testimage foo LXC_CONFIG_SHOW=$(lxc config show foo --expanded) + # shellcheck disable=SC1117 printf " config show: config show --expanded\n" >> "${LXD_CONF}/config.yml" [ "$(lxc config show foo)" = "$LXC_CONFIG_SHOW" ] lxc delete foo diff --git a/test/suites/config.sh b/test/suites/config.sh index 5cce313cf..011ae1708 100644 --- a/test/suites/config.sh +++ b/test/suites/config.sh @@ -89,7 +89,7 @@ testloopmounts() { ensure_fs_unmounted "removed fs re-appeared after restart" lxc stop foo --force losetup -d "${lpath}" - sed -i "\|^${lpath}|d" "${TEST_DIR}/loops" + sed -i "#^${lpath}#d" "${TEST_DIR}/loops" } test_mount_order() { @@ -295,7 +295,7 @@ test_container_metadata() { # template content can be updated echo "some content" | lxc config template edit c my.tpl lxc config template show c my.tpl | grep -q "some content" - + # templates can be removed lxc config template delete c my.tpl ! lxc config template list c | grep -q my.tpl || false diff --git a/test/suites/image_auto_update.sh b/test/suites/image_auto_update.sh index 106cd7552..dc4a1c567 100644 --- a/test/suites/image_auto_update.sh +++ b/test/suites/image_auto_update.sh @@ -1,4 +1,5 @@ test_image_auto_update() { + # shellcheck disable=SC1117 if lxc image alias list | grep -q "^| testimage\s*|.*$"; then lxc image delete testimage fi diff --git a/test/suites/image_prefer_cached.sh b/test/suites/image_prefer_cached.sh index c999897d6..c2eea47d1 100644 --- a/test/suites/image_prefer_cached.sh +++ b/test/suites/image_prefer_cached.sh @@ -2,6 +2,7 @@ # one is preferred, even if the its remote has a more recent one. test_image_prefer_cached() { + # shellcheck disable=SC1117 if lxc image alias list | grep -q "^| testimage\s*|.*$"; then lxc image delete testimage fi diff --git a/test/suites/init_auto.sh b/test/suites/init_auto.sh index e3db395ef..5bca0aa73 100644 --- a/test/suites/init_auto.sh +++ b/test/suites/init_auto.sh @@ -19,7 +19,7 @@ test_init_auto() { LXD_DIR=${LXD_INIT_DIR} lxc profile show default | grep -q "pool: default" kill_lxd "${LXD_INIT_DIR}" - sed -i "\|^${loop_device_1}|d" "${TEST_DIR}/loops" + sed -i "#^${loop_device_1}#d" "${TEST_DIR}/loops" # lxd init --auto --storage-backend zfs --storage-pool <name>/<non-existing-dataset> LXD_INIT_DIR=$(mktemp -d -p "${TEST_DIR}" XXX) @@ -43,7 +43,7 @@ test_init_auto() { kill_lxd "${LXD_INIT_DIR}" zpool destroy "lxdtest-$(basename "${LXD_DIR}")-pool1-existing-pool" - sed -i "\|^${loop_device_1}|d" "${TEST_DIR}/loops" + sed -i "#^${loop_device_1}#d" "${TEST_DIR}/loops" # lxd init --storage-backend zfs --storage-create-loop 1 --storage-pool <name> --auto LXD_INIT_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
