From 30b827304367e9f5923967a13b468d03f8d591cc Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Sun, 8 Oct 2023 10:00:53 +0800 Subject: [PATCH] fix: modify sp tag --- e2e/e2e_migrate_bucket_test.go | 64 ++++------------------------------ 1 file changed, 7 insertions(+), 57 deletions(-) diff --git a/e2e/e2e_migrate_bucket_test.go b/e2e/e2e_migrate_bucket_test.go index 0e528132..c1df4f83 100644 --- a/e2e/e2e_migrate_bucket_test.go +++ b/e2e/e2e_migrate_bucket_test.go @@ -189,7 +189,7 @@ func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Simple_Case() { // selete a storage provider to miragte destSP := s.SelectDestSP(objectDetail) - s.T().Logf(":Migrate Bucket DstPrimarySPID %d", destSP.GetId()) + s.T().Logf("Migrate Bucket DstPrimarySPID %d", destSP.GetId()) // normal no conflict send migrate bucket transaction txhash, err := s.Client.MigrateBucket(s.ClientContext, bucketName, destSP.GetId(), types.MigrateBucketOptions{TxOpts: nil, IsAsyncMode: false}) @@ -209,7 +209,7 @@ func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Simple_Case() { s.CheckChallenge(uint32(objectDetail.ObjectInfo.Id.Uint64())) } -// test only conflict sp's case +// test conflict sp's case & quota consumed func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Simple_Conflict_Case() { // 1) create bucket and object in srcSP bucketName, _ := s.MustCreateBucket(storageTypes.VISIBILITY_TYPE_PUBLIC_READ) @@ -288,13 +288,6 @@ func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Simple_Conflict_Case() { s.CheckChallenge(uint32(objectDetail.ObjectInfo.Id.Uint64())) } -func (s *BucketMigrateTestSuite) Test_Empty_Quota_Simple_Case() { - bucketName := "hks1vldl" - quotaAfter, err := s.Client.GetBucketReadQuota(s.ClientContext, bucketName) - s.Require().NoError(err) - s.T().Logf("succeed to migrate Bucket, current quota:%v", quotaAfter) -} - // test empty bucket case func (s *BucketMigrateTestSuite) Test_Empty_Bucket_Migrate_Simple_Case() { // 1) create bucket and object in srcSP @@ -323,7 +316,7 @@ func (s *BucketMigrateTestSuite) Test_Empty_Bucket_Migrate_Simple_Case() { } s.Require().NotNil(destSP) - s.T().Logf(":Migrate Bucket DstPrimarySPID %s", destSP.String()) + s.T().Logf("Migrate Bucket DstPrimarySPID %s", destSP.String()) // normal no conflict send migrate bucket transaction txhash, err := s.Client.MigrateBucket(s.ClientContext, bucketName, destSP.GetId(), types.MigrateBucketOptions{TxOpts: nil, IsAsyncMode: false}) @@ -384,7 +377,10 @@ func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Cancel_Case() { // selete a storage provider to miragte destSP := s.SelectDestSP(objectDetail) - s.T().Logf(":Migrate Bucket DstPrimarySPID %d", destSP.GetId()) + s.T().Logf("Migrate Bucket DstPrimarySPID %d", destSP.GetId()) + quotaBefore, err := s.Client.GetBucketReadQuota(s.ClientContext, bucketName) + s.Require().NoError(err) + s.T().Logf("Migrate bucket %s from %d to DstPrimarySPID %d, current quota:%v", bucketName, objectDetail.GlobalVirtualGroup.PrimarySpId, destSP.GetId(), quotaBefore) // normal no conflict send migrate bucket transaction txhash, err := s.Client.MigrateBucket(s.ClientContext, bucketName, destSP.GetId(), types.MigrateBucketOptions{TxOpts: nil, IsAsyncMode: false}) @@ -402,8 +398,6 @@ func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Cancel_Case() { s.Require().NoError(err) s.T().Log(createTx.TxResult.String()) - time.Sleep(10 * time.Second) - txhash, err = s.Client.MigrateBucket(s.ClientContext, bucketName, destSP.GetId(), types.MigrateBucketOptions{TxOpts: nil, IsAsyncMode: false}) s.Require().NoError(err) s.T().Logf("MigrateBucket txhash : %s", txhash) @@ -413,47 +407,3 @@ func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Cancel_Case() { s.waitUntilBucketMigrateFinish(bucketName, destSP) } - -// test cancel migrate bucket -func (s *BucketMigrateTestSuite) Test_Bucket_Migrate_Cancel_Quota_Case() { - // 1) create bucket and object in srcSP - bucketName, _ := s.MustCreateBucket(storageTypes.VISIBILITY_TYPE_PUBLIC_READ) - - // test only one object's case - objectDetails, _, err := s.CreateObjects(bucketName, 1) - s.Require().NoError(err) - - objectDetail := objectDetails[0] - - // selete a storage provider to miragte - destSP := s.SelectDestSP(objectDetail) - - s.T().Logf(":Migrate Bucket DstPrimarySPID %d", destSP.GetId()) - - quotaBefore, err := s.Client.GetBucketReadQuota(s.ClientContext, bucketName) - s.Require().NoError(err) - s.T().Logf("Migrate bucket %s from %d to DstPrimarySPID %d, current quota:%v", bucketName, objectDetail.GlobalVirtualGroup.PrimarySpId, destSP.GetId(), quotaBefore) - - // normal no conflict send migrate bucket transaction - txhash, err := s.Client.MigrateBucket(s.ClientContext, bucketName, destSP.GetId(), types.MigrateBucketOptions{TxOpts: nil, IsAsyncMode: false}) - s.Require().NoError(err) - s.T().Logf("MigrateBucket txhash : %s", txhash) - createTx, err := s.Client.WaitForTx(s.ClientContext, txhash) - s.Require().NoError(err) - s.T().Log(createTx.TxResult.String()) - - time.Sleep(5 * time.Second) - - txhash, err = s.Client.CancelMigrateBucket(s.ClientContext, bucketName, types.CancelMigrateBucketOptions{}) - s.Require().NoError(err) - s.T().Logf("CancelMigrateBucket txhash : %s", txhash) - - createTx, err = s.Client.WaitForTx(s.ClientContext, txhash) - s.Require().NoError(err) - s.T().Log(createTx.TxResult.String()) - - time.Sleep(10 * time.Second) - quotaAfter, err := s.Client.GetBucketReadQuota(s.ClientContext, bucketName) - s.Require().NoError(err) - s.T().Logf("succeed to cancel migrate bucket, current quota:%v", quotaAfter) -}