github.com/vnpaycloud-console/gophercloud/v2@v2.0.5/internal/acceptance/openstack/blockstorage/v3/limits_test.go (about)

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