Skip to content

Commit

Permalink
test: Update testsuite to set root dev instead of add
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
boltmark committed Jan 22, 2025
1 parent 2dd53c4 commit bacd75c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions test/suites/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/suites/clustering.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/suites/container_devices_disk_restricted.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions test/suites/image_profiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/suites/projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)"
Expand Down

0 comments on commit bacd75c

Please sign in to comment.