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

     1  //go:build acceptance || blockstorage || limits
     2  
     3  package v2
     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/v2/limits"
    12  	th "github.com/vnpaycloud-console/gophercloud/v2/testhelper"
    13  )
    14  
    15  func TestLimits(t *testing.T) {
    16  	clients.SkipReleasesAbove(t, "stable/ocata")
    17  
    18  	client, err := clients.NewBlockStorageV2Client()
    19  	th.AssertNoErr(t, err)
    20  
    21  	limits, err := limits.Get(context.TODO(), client).Extract()
    22  	th.AssertNoErr(t, err)
    23  
    24  	tools.PrintResource(t, limits)
    25  
    26  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalVolumes, 0)
    27  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalSnapshots, 0)
    28  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalVolumeGigabytes, 0)
    29  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalBackups, 0)
    30  	th.AssertIntGreaterOrEqual(t, limits.Absolute.MaxTotalBackupGigabytes, 0)
    31  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalVolumesUsed, 0)
    32  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalVolumesUsed, limits.Absolute.MaxTotalVolumes)
    33  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalGigabytesUsed, 0)
    34  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalGigabytesUsed, limits.Absolute.MaxTotalVolumeGigabytes)
    35  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalSnapshotsUsed, 0)
    36  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalSnapshotsUsed, limits.Absolute.MaxTotalSnapshots)
    37  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalBackupsUsed, 0)
    38  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalBackupsUsed, limits.Absolute.MaxTotalBackups)
    39  	th.AssertIntGreaterOrEqual(t, limits.Absolute.TotalBackupGigabytesUsed, 0)
    40  	th.AssertIntLesserOrEqual(t, limits.Absolute.TotalBackupGigabytesUsed, limits.Absolute.MaxTotalBackupGigabytes)
    41  }