From bacd75cd35a5203764cdacb9a29ced818ad74999 Mon Sep 17 00:00:00 2001 From: Mark Bolton Date: Tue, 21 Jan 2025 17:46:56 -0800 Subject: [PATCH] test: Update testsuite to set root dev instead of add Since the root device is now added by default upon project creation, the testsuite should not try to re-add the root device, and should instead set it. Signed-off-by: Mark Bolton --- .github/workflows/tests.yml | 2 +- test/suites/backup.sh | 12 ++++++------ test/suites/clustering.sh | 2 +- test/suites/container_devices_disk_restricted.sh | 2 +- test/suites/image_profiles.sh | 4 ++-- test/suites/projects.sh | 14 +++++++------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d888904424e5..4dbfcdf8b577 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -566,7 +566,7 @@ jobs: set -eux export PATH="/home/runner/go/bin:$PATH" sudo -E LXD_DIR=/var/lib/lxd lxc storage create default zfs - sudo -E LXD_DIR=/var/lib/lxd lxc profile device add default root disk path=/ pool=default + sudo -E LXD_DIR=/var/lib/lxd lxc profile device set default root path=/ pool=default sudo -E LXD_DIR=/var/lib/lxd lxc network create local-network sudo -E LXD_DIR=/var/lib/lxd lxc profile device add default eth0 nic network=local-network sudo -E LXD_DIR=/var/lib/lxd lxc config set core.https_address "[::]:8443" diff --git a/test/suites/backup.sh b/test/suites/backup.sh index 62a29c7807bf..a4d38fc51cee 100644 --- a/test/suites/backup.sh +++ b/test/suites/backup.sh @@ -84,7 +84,7 @@ test_container_recover() { lxc storage set "${poolName}" user.foo=bah lxc project create test -c features.images=false -c features.profiles=true -c features.storage.volumes=true - lxc profile device add default root disk path=/ pool="${poolName}" --project test + lxc profile device set default root path=/ pool="${poolName}" --project test lxc profile device add default eth0 nic nictype=p2p --project test lxc project switch test @@ -361,8 +361,8 @@ _backup_import_with_project() { deps/import-busybox --project "$project-b" --alias testimage # Add a root device to the default profile of the project - lxc profile device add default root disk path="/" pool="${pool}" - lxc profile device add default root disk path="/" pool="${pool}" --project "$project-b" + lxc profile device set default root path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" --project "$project-b" fi ensure_import_testimage @@ -525,7 +525,7 @@ _backup_import_with_project() { lxc delete -f c3 # Reset default storage pool - lxc profile device add default root disk path=/ pool="${default_pool}" + lxc profile device set default root path=/ pool="${default_pool}" lxc storage delete pool_2 @@ -559,7 +559,7 @@ _backup_export_with_project() { # Add a root device to the default profile of the project pool="lxdtest-$(basename "${LXD_DIR}")" - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" fi ensure_import_testimage @@ -705,7 +705,7 @@ _backup_volume_export_with_project() { deps/import-busybox --project "$project-b" --alias testimage # Add a root device to the default profile of the project. - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" fi ensure_import_testimage diff --git a/test/suites/clustering.sh b/test/suites/clustering.sh index 6ff495600a79..ca8b66e7c506 100644 --- a/test/suites/clustering.sh +++ b/test/suites/clustering.sh @@ -1976,7 +1976,7 @@ test_clustering_projects() { # Create a test project LXD_DIR="${LXD_ONE_DIR}" lxc project create p1 LXD_DIR="${LXD_ONE_DIR}" lxc project switch p1 - LXD_DIR="${LXD_ONE_DIR}" lxc profile device add default root disk path="/" pool="data" + LXD_DIR="${LXD_ONE_DIR}" lxc profile device set default root path="/" pool="data" # Create a container in the project. LXD_DIR="${LXD_ONE_DIR}" deps/import-busybox --project p1 --alias testimage diff --git a/test/suites/container_devices_disk_restricted.sh b/test/suites/container_devices_disk_restricted.sh index e447d4771509..936ba18aa583 100644 --- a/test/suites/container_devices_disk_restricted.sh +++ b/test/suites/container_devices_disk_restricted.sh @@ -27,7 +27,7 @@ test_container_devices_disk_restricted() { -c restricted.devices.disk.paths="${testRoot}/allowed1,${testRoot}/allowed2" lxc project switch restricted pool="lxdtest-$(basename "${LXD_DIR}")" - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" lxc profile show default # Create instance and add check relative source paths are not allowed. diff --git a/test/suites/image_profiles.sh b/test/suites/image_profiles.sh index e914291d5a61..199c5871c40d 100644 --- a/test/suites/image_profiles.sh +++ b/test/suites/image_profiles.sh @@ -67,7 +67,7 @@ test_profiles_project_images_profiles() { lxc project create project1 lxc project switch project1 storage=$(lxc storage list | grep "^| " | tail -n 1 | cut -d' ' -f2) - lxc profile device add default root disk path=/ pool="$storage" + lxc profile device set default root path=/ pool="$storage" _image_nil_profile_list _image_empty_profile_list @@ -94,7 +94,7 @@ test_profiles_project_profiles() { lxc project create project1 -c features.images=false lxc project switch project1 storage=$(lxc storage list | grep "^| " | tail -n 1 | cut -d' ' -f2) - lxc profile device add default root disk path=/ pool="$storage" + lxc profile device set default root path=/ pool="$storage" _image_nil_profile_list _image_empty_profile_list diff --git a/test/suites/projects.sh b/test/suites/projects.sh index 5212e379261a..e2fadea74ea9 100644 --- a/test/suites/projects.sh +++ b/test/suites/projects.sh @@ -90,7 +90,7 @@ test_projects_containers() { # Add a root device to the default profile of the project pool="lxdtest-$(basename "${LXD_DIR}")" - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" # Create a container in the project lxc init testimage c1 @@ -207,7 +207,7 @@ test_projects_snapshots() { deps/import-busybox --project foo --alias testimage # Add a root device to the default profile of the project - lxc profile device add default root disk path="/" pool="lxdtest-$(basename "${LXD_DIR}")" + lxc profile device set default root path="/" pool="lxdtest-$(basename "${LXD_DIR}")" # Create a container in the project lxc init testimage c1 @@ -256,7 +256,7 @@ test_projects_backups() { deps/import-busybox --project foo --alias testimage # Add a root device to the default profile of the project - lxc profile device add default root disk path="/" pool="lxdtest-$(basename "${LXD_DIR}")" + lxc profile device set default root path="/" pool="lxdtest-$(basename "${LXD_DIR}")" # Create a container in the project lxc init testimage c1 @@ -527,7 +527,7 @@ test_projects_network() { deps/import-busybox --project foo --alias testimage # Add a root device to the default profile of the project - lxc profile device add default root disk path="/" pool="lxdtest-$(basename "${LXD_DIR}")" + lxc profile device set default root path="/" pool="lxdtest-$(basename "${LXD_DIR}")" # Create a container in the project lxc init -n "${network}" testimage c1 @@ -557,7 +557,7 @@ test_projects_limits() { # Add a root device to the default profile of the project and import an image. pool="lxdtest-$(basename "${LXD_DIR}")" - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" deps/import-busybox --project p1 --alias testimage @@ -836,7 +836,7 @@ test_projects_limits() { # Add a root device to the default profile of the project and import an image. pool="lxdtest-$(basename "${LXD_DIR}")" - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" deps/import-busybox --project p1 --alias testimage @@ -935,7 +935,7 @@ test_projects_restrictions() { # Add a root device to the default profile of the project and import an image. pool="lxdtest-$(basename "${LXD_DIR}")" - lxc profile device add default root disk path="/" pool="${pool}" + lxc profile device set default root path="/" pool="${pool}" deps/import-busybox --project p1 --alias testimage fingerprint="$(lxc image list -c f --format json | jq -r .[0].fingerprint)"