Skip to content

Commit

Permalink
test: update shellcheck disable code
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Jul 9, 2024
1 parent fc30f63 commit 979cd28
Show file tree
Hide file tree
Showing 28 changed files with 79 additions and 79 deletions.
4 changes: 2 additions & 2 deletions test/includes/external_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ start_external_auth_daemon() {
cd macaroon-identity || return
go build ./...
)
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local credentials_file tcp_port
credentials_file="$1/macaroon-identity-credentials.csv"
tcp_port="$(local_tcp_port)"
Expand All @@ -22,7 +22,7 @@ EOF
}

kill_external_auth_daemon() {
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local pidfile="$1/macaroon-identity.pid"
kill "$(cat "$pidfile")" || true
rm -f macaroon-identity/macaroon-identity
Expand Down
4 changes: 2 additions & 2 deletions test/perf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LXD_NETNS=""

import_subdir_files() {
test "$1"
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local file
for file in "$1"/*.sh; do
# shellcheck disable=SC1090
Expand All @@ -27,7 +27,7 @@ log_message() {
}

run_benchmark() {
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local label description
label="$1"
description="$2"
Expand Down
2 changes: 1 addition & 1 deletion test/suites/basic.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_basic_usage() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local lxd_backend
lxd_backend=$(storage_backend "$LXD_DIR")

Expand Down
62 changes: 31 additions & 31 deletions test/suites/clustering.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_clustering_enable() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

LXD_INIT_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
Expand Down Expand Up @@ -179,7 +179,7 @@ test_clustering_enable() {
}

test_clustering_membership() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -339,7 +339,7 @@ test_clustering_membership() {
}

test_clustering_containers() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -512,7 +512,7 @@ test_clustering_containers() {
}

test_clustering_storage() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -855,7 +855,7 @@ test_clustering_storage() {
# two-stage process required multi-node clusters, or directly with the normal
# procedure for non-clustered daemons.
test_clustering_storage_single_node() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -930,7 +930,7 @@ test_clustering_storage_single_node() {
}

test_clustering_network() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1079,7 +1079,7 @@ test_clustering_network() {
# Perform an upgrade of a 2-member cluster, then a join a third member and
# perform one more upgrade
test_clustering_upgrade() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR LXD_NETNS

setup_clustering_bridge
Expand Down Expand Up @@ -1175,7 +1175,7 @@ test_clustering_upgrade() {

# Perform an upgrade of an 8-member cluster.
test_clustering_upgrade_large() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR LXD_NETNS N

setup_clustering_bridge
Expand Down Expand Up @@ -1231,7 +1231,7 @@ test_clustering_upgrade_large() {
}

test_clustering_publish() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1283,7 +1283,7 @@ test_clustering_publish() {
}

test_clustering_profiles() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1357,7 +1357,7 @@ EOF
}

test_clustering_update_cert() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1436,7 +1436,7 @@ test_clustering_update_cert() {
}

test_clustering_join_api() {
# shellcheck disable=2039,2034
# shellcheck disable=SC2039,SC3043
local LXD_DIR LXD_NETNS

setup_clustering_bridge
Expand Down Expand Up @@ -1476,7 +1476,7 @@ test_clustering_join_api() {
}

test_clustering_shutdown_nodes() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1548,7 +1548,7 @@ test_clustering_shutdown_nodes() {
}

test_clustering_projects() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1613,7 +1613,7 @@ test_clustering_projects() {
}

test_clustering_address() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1691,7 +1691,7 @@ test_clustering_address() {
}

test_clustering_image_replication() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -1854,7 +1854,7 @@ test_clustering_image_replication() {
}

test_clustering_dns() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

# Because we do not want tests to only run on Ubuntu (due to cluster's fan network dependency)
Expand Down Expand Up @@ -1940,7 +1940,7 @@ test_clustering_dns() {
}

test_clustering_recover() {
# shellcheck disable=2039,2034
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2022,7 +2022,7 @@ test_clustering_recover() {
# When a voter cluster member is shutdown, its role gets transferred to a spare
# node.
test_clustering_handover() {
# shellcheck disable=2039,2034
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2140,7 +2140,7 @@ test_clustering_handover() {
# If a voter node crashes and is detected as offline, its role is migrated to a
# stand-by.
test_clustering_rebalance() {
# shellcheck disable=2039,2034
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2228,7 +2228,7 @@ test_clustering_rebalance() {
# Recover a cluster where a raft node was removed from the nodes table but not
# from the raft configuration.
test_clustering_remove_raft_node() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2349,7 +2349,7 @@ test_clustering_remove_raft_node() {
}

test_clustering_failure_domains() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2405,17 +2405,17 @@ test_clustering_failure_domains() {

# Set failure domains

# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
printf "roles: [\"database\"]\nfailure_domain: \"az1\"" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node1
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
printf "roles: [\"database\"]\nfailure_domain: \"az2\"" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node2
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
printf "roles: [\"database\"]\nfailure_domain: \"az3\"" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node3
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
printf "roles: []\nfailure_domain: \"az1\"" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node4
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
printf "roles: []\nfailure_domain: \"az2\"" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node5
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
printf "roles: []\nfailure_domain: \"az3\"" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node6

LXD_DIR="${LXD_ONE_DIR}" lxc cluster show node2 | grep -q "failure_domain: az2"
Expand Down Expand Up @@ -2452,7 +2452,7 @@ test_clustering_failure_domains() {
}

test_clustering_image_refresh() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2658,7 +2658,7 @@ test_clustering_image_refresh() {
}

test_clustering_edit_configuration() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down Expand Up @@ -2807,7 +2807,7 @@ test_clustering_edit_configuration() {
}

test_clustering_remove_members() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

setup_clustering_bridge
Expand Down
2 changes: 1 addition & 1 deletion test/suites/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ test_config_edit() {
}

test_config_edit_container_snapshot_pool_config() {
# shellcheck disable=2034,2039,2155
# shellcheck disable=SC2039,SC3043,SC2155
local storage_pool="lxdtest-$(basename "${LXD_DIR}")"

ensure_import_testimage
Expand Down
4 changes: 2 additions & 2 deletions test/suites/container_devices_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test_container_devices_raw_mount_options() {
}

test_container_devices_disk_ceph() {
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local LXD_BACKEND

LXD_BACKEND=$(storage_backend "$LXD_DIR")
Expand All @@ -118,7 +118,7 @@ test_container_devices_disk_ceph() {
}

test_container_devices_disk_cephfs() {
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local LXD_BACKEND

LXD_BACKEND=$(storage_backend "$LXD_DIR")
Expand Down
2 changes: 1 addition & 1 deletion test/suites/container_local_cross_pool_handling.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_container_local_cross_pool_handling() {
ensure_import_testimage

# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_STORAGE_DIR lxd_backend
# shellcheck disable=SC2034
lxd_backend=$(storage_backend "$LXD_DIR")
Expand Down
2 changes: 1 addition & 1 deletion test/suites/database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ EOF
}

test_database_no_disk_space(){
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

LXD_NOSPACE_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
Expand Down
2 changes: 1 addition & 1 deletion test/suites/external_auth.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_macaroon_auth() {
# shellcheck disable=SC2039
# shellcheck disable=SC2039,SC3043
local identity_endpoint
# shellcheck disable=SC2086
identity_endpoint="$(cat ${TEST_DIR}/macaroon-identity.endpoint)"
Expand Down
2 changes: 1 addition & 1 deletion test/suites/filtering.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test API filtering.
test_filtering() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD_DIR

LXD_FILTERING_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
Expand Down
16 changes: 8 additions & 8 deletions test/suites/image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_image_expiry() {
# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD2_DIR LXD2_ADDR
LXD2_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
chmod +x "${LXD2_DIR}"
Expand Down Expand Up @@ -50,8 +50,8 @@ test_image_expiry() {

test_image_list_all_aliases() {
ensure_import_testimage
# shellcheck disable=2039,2034,2155
local sum=$(lxc image info testimage | grep ^Fingerprint | cut -d' ' -f2)
# shellcheck disable=SC2039,SC3043,SC2034,SC2155
local sum="$(lxc image info testimage | grep ^Fingerprint | cut -d' ' -f2)"
lxc image alias create zzz "$sum"
lxc image list | grep -vq zzz
# both aliases are listed if the "aliases" column is included in output
Expand All @@ -63,16 +63,16 @@ test_image_list_all_aliases() {
test_image_import_dir() {
ensure_import_testimage
lxc image export testimage
# shellcheck disable=2039,2034,2155
local image=$(ls -1 -- *.tar.xz)
# shellcheck disable=SC2039,SC3043,SC2034,SC2155
local image="$(ls -1 -- *.tar.xz)"
mkdir -p unpacked
tar -C unpacked -xf "$image"
# shellcheck disable=2039,2034,2155
local fingerprint=$(lxc image import unpacked | awk '{print $NF;}')
# shellcheck disable=SC2039,SC3043,SC2034,SC2155
local fingerprint="$(lxc image import unpacked | awk '{print $NF;}')"
rm -rf "$image" unpacked

lxc image export "$fingerprint"
# shellcheck disable=2039,2034,2155
# shellcheck disable=SC2039,SC3043
local exported="${fingerprint}.tar.xz"

tar tvf "$exported" | grep -Fq metadata.yaml
Expand Down
2 changes: 1 addition & 1 deletion test/suites/image_auto_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test_image_auto_update() {
lxc image delete testimage
fi

# shellcheck disable=2039
# shellcheck disable=SC2039,SC3043
local LXD2_DIR LXD2_ADDR
LXD2_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
chmod +x "${LXD2_DIR}"
Expand Down
Loading

0 comments on commit 979cd28

Please sign in to comment.