github.com/gophercloud/gophercloud@v1.11.0/internal/acceptance/openstack/blockstorage/extensions/limits_test.go (about)

     1  package extensions
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/gophercloud/gophercloud/internal/acceptance/clients"
     7  	"github.com/gophercloud/gophercloud/internal/acceptance/tools"
     8  	"github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/limits"
     9  	th "github.com/gophercloud/gophercloud/testhelper"
    10  )
    11  
    12  func TestLimits(t *testing.T) {
    13  	client, err := clients.NewBlockStorageV3Client()
    14  	th.AssertNoErr(t, err)
    15  
    16  	limits, err := limits.Get(client).Extract()
    17  	th.AssertNoErr(t, err)
    18  
    19  	tools.PrintResource(t, limits)
    20  
    21  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalVolumes, 0)
    22  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalSnapshots, 0)
    23  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalVolumeGigabytes, 0)
    24  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalBackups, 0)
    25  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalBackupGigabytes, 0)
    26  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalVolumesUsed, 0)
    27  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalVolumesUsed, limits.Absolute.MaxTotalVolumes)
    28  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalGigabytesUsed, 0)
    29  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalGigabytesUsed, limits.Absolute.MaxTotalVolumeGigabytes)
    30  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalSnapshotsUsed, 0)
    31  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalSnapshotsUsed, limits.Absolute.MaxTotalSnapshots)
    32  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalBackupsUsed, 0)
    33  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalBackupsUsed, limits.Absolute.MaxTotalBackups)
    34  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalBackupGigabytesUsed, 0)
    35  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalBackupGigabytesUsed, limits.Absolute.MaxTotalBackupGigabytes)
    36  }