Skip to content

Commit

Permalink
tests: Add test for per pool limits
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Aug 8, 2024
1 parent 80f0cea commit 8d846de
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/suites/projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,43 @@ test_projects_limits() {

deps/import-busybox --project p1 --alias testimage

# Test per-pool limits.
incus storage create limit1 dir
incus storage create limit2 dir

incus project set p1 limits.disk=50MiB
incus project set p1 limits.disk.pool.limit1=0
incus project set p1 limits.disk.pool.limit2=0

! incus storage list | grep -q limit1 || false
! incus storage list | grep -q limit2 || false

incus storage volume create "${pool}" foo size=10MiB
! incus storage volume create "${pool}" bar size=50MiB || false
incus storage volume delete "${pool}" foo

! incus storage volume create limit1 foo size=10GiB || false
! incus storage volume create limit2 foo size=10GiB || false

incus project set p1 limits.disk.pool.limit1=10MiB
incus project set p1 limits.disk.pool.limit2=10MiB
incus storage volume create limit1 foo size=10MiB
! incus storage volume create limit1 bar size=10MiB || false
incus storage volume create limit2 foo size=10MiB
! incus storage volume create limit2 bar size=10MiB || false

! incus storage volume create "${pool}" foo size=40MiB || false
incus storage volume delete limit1 foo
incus storage volume delete limit2 foo
incus storage volume create "${pool}" foo size=40MiB

incus storage volume delete "${pool}" foo
incus project unset p1 limits.disk.pool.limit1
incus project unset p1 limits.disk.pool.limit2
incus project unset p1 limits.disk
incus storage delete limit1
incus storage delete limit2

# Create a couple of containers in the project.
incus init testimage c1
incus init testimage c2
Expand Down

0 comments on commit 8d846de

Please sign in to comment.