diff --git a/e2e/tests/storage_rate_limit_test.go b/e2e/tests/storage_rate_limit_test.go index ae18cbed9..ac6f6e3fb 100644 --- a/e2e/tests/storage_rate_limit_test.go +++ b/e2e/tests/storage_rate_limit_test.go @@ -484,6 +484,8 @@ func (s *StorageTestSuite) TestQueryBucketRateLimit() { } func (s *StorageTestSuite) TestSetBucketFlowRateLimit_Discontinue() { + s.enableMessage() + sp, user, bucketName, _, _, _ := s.createObject() // SetBucketRateLimit diff --git a/e2e/tests/storage_test.go b/e2e/tests/storage_test.go index 63ee84549..fbc421aa9 100644 --- a/e2e/tests/storage_test.go +++ b/e2e/tests/storage_test.go @@ -23,6 +23,8 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + virtualgrouptypes "github.com/bnb-chain/greenfield/x/virtualgroup/types" + "github.com/bnb-chain/greenfield/e2e/core" "github.com/bnb-chain/greenfield/sdk/keys" "github.com/bnb-chain/greenfield/sdk/types" @@ -985,6 +987,29 @@ func (s *StorageTestSuite) TestDiscontinueBucket_UserDeleted() { s.Require().True(statusRes.SyncInfo.LatestBlockHeight > heightAfter) } +func (s *StorageTestSuite) GetSecondarySP(sps ...*core.StorageProvider) ([]*core.StorageProvider, []uint32) { + var secondarySPs []*core.StorageProvider + var secondarySPIDs []uint32 + + for _, ssp := range s.StorageProviders { + isSecondSP := true + for _, sp := range sps { + if ssp.Info.Id == sp.Info.Id { + isSecondSP = false + break + } + } + if isSecondSP { + secondarySPIDs = append(secondarySPIDs, ssp.Info.Id) + secondarySPs = append(secondarySPs, ssp) + } + if len(secondarySPIDs) == 6 { + break + } + } + return secondarySPs, secondarySPIDs +} + // createObject with default VISIBILITY_TYPE_PRIVATE func (s *StorageTestSuite) createObject() (*core.StorageProvider, keys.KeyManager, string, storagetypes.Uint, string, storagetypes.Uint) { return s.createObjectWithVisibility(storagetypes.VISIBILITY_TYPE_PRIVATE) @@ -994,8 +1019,15 @@ func (s *StorageTestSuite) createObjectWithVisibility(v storagetypes.VisibilityT var err error // CreateBucket sp := s.BaseSuite.PickStorageProvider() - gvg, found := sp.GetFirstGlobalVirtualGroup() - s.Require().True(found) + + _, secondarySps := s.GetSecondarySP(sp) + gvgID, _ := s.BaseSuite.CreateGlobalVirtualGroup(sp, 0, secondarySps, 1) + gvgResp, err := s.Client.VirtualGroupQueryClient.GlobalVirtualGroup(context.Background(), &virtualgrouptypes.QueryGlobalVirtualGroupRequest{ + GlobalVirtualGroupId: gvgID, + }) + s.Require().NoError(err) + gvg := gvgResp.GlobalVirtualGroup + user := s.GenAndChargeAccounts(1, 1000000)[0] bucketName := storageutils.GenRandomBucketName() msgCreateBucket := storagetypes.NewMsgCreateBucket(