From f60f4443dfbe098c82006bbc6c5ce809c55691d4 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 30 Oct 2024 15:03:24 -0600 Subject: [PATCH] test: remove obsolete object user test flag In Rook v1.6 some new properties were added for ceph object store users, so the CI was skipping validation of that setting in the upgrade test. Now we are far past the need for that flag, and we can assume the latest flags exist for the tests. Signed-off-by: Travis Nielsen --- tests/integration/ceph_base_object_test.go | 30 +++++----------------- tests/integration/ceph_object_test.go | 2 +- tests/integration/ceph_upgrade_test.go | 10 ++++---- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/tests/integration/ceph_base_object_test.go b/tests/integration/ceph_base_object_test.go index 6358935aa..79521d1ec 100644 --- a/tests/integration/ceph_base_object_test.go +++ b/tests/integration/ceph_base_object_test.go @@ -238,8 +238,7 @@ func assertObjectStoreDeletion(t *testing.T, k8sh *utils.K8sHelper, namespace, s func createCephObjectUser( s *suite.Suite, helper *clients.TestClient, k8sh *utils.K8sHelper, - namespace, storeName, userID string, - checkPhase, checkQuotaAndCaps bool) { + namespace, storeName, userID string, checkQuotaAndCaps bool) { maxObjectInt, err := strconv.Atoi(maxObject) assert.Nil(s.T(), err) @@ -254,14 +253,13 @@ func createCephObjectUser( time.Sleep(5 * time.Second) } - checkCephObjectUser(s, helper, k8sh, namespace, storeName, userID, checkPhase, checkQuotaAndCaps) + checkCephObjectUser(s, helper, k8sh, namespace, storeName, userID, checkQuotaAndCaps) } func checkCephObjectUser( s *suite.Suite, helper *clients.TestClient, k8sh *utils.K8sHelper, - namespace, storeName, userID string, - checkPhase, checkQuotaAndCaps bool, -) { + namespace, storeName, userID string, checkQuotaAndCaps bool) { + logger.Infof("checking object store \"%s/%s\" user %q", namespace, storeName, userID) assert.True(s.T(), helper.ObjectUserClient.UserSecretExists(namespace, storeName, userID)) @@ -270,23 +268,9 @@ func checkCephObjectUser( assert.Equal(s.T(), userID, userInfo.UserID) assert.Equal(s.T(), userdisplayname, *userInfo.DisplayName) - if checkPhase { - // status.phase doesn't exist before Rook v1.6 - phase, err := k8sh.GetResource("--namespace", namespace, "cephobjectstoreuser", userID, "--output", "jsonpath={.status.phase}") - assert.NoError(s.T(), err) - assert.Equal(s.T(), k8sutil.ReadyStatus, phase) - } - if checkQuotaAndCaps { - // following fields in CephObjectStoreUser CRD doesn't exist before Rook v1.7.3 - maxObjectInt, err := strconv.Atoi(maxObject) - assert.Nil(s.T(), err) - maxSizeInt, err := strconv.Atoi(maxSize) - assert.Nil(s.T(), err) - assert.Equal(s.T(), maxBucket, userInfo.MaxBuckets) - assert.Equal(s.T(), int64(maxObjectInt), *userInfo.UserQuota.MaxObjects) - assert.Equal(s.T(), int64(maxSizeInt), *userInfo.UserQuota.MaxSize) - assert.Equal(s.T(), userCap, userInfo.Caps[0].Perm) - } + phase, err := k8sh.GetResource("--namespace", namespace, "cephobjectstoreuser", userID, "--output", "jsonpath={.status.phase}") + assert.NoError(s.T(), err) + assert.Equal(s.T(), k8sutil.ReadyStatus, phase) } func objectStoreCleanUp(s *suite.Suite, helper *clients.TestClient, k8sh *utils.K8sHelper, namespace, storeName string) { diff --git a/tests/integration/ceph_object_test.go b/tests/integration/ceph_object_test.go index db55cd39e..3763a3c1e 100644 --- a/tests/integration/ceph_object_test.go +++ b/tests/integration/ceph_object_test.go @@ -167,7 +167,7 @@ func testObjectStoreOperations(s *suite.Suite, helper *clients.TestClient, k8sh logger.Infof("Testing Object Operations on %s", storeName) t.Run("create CephObjectStoreUser", func(t *testing.T) { - createCephObjectUser(s, helper, k8sh, namespace, storeName, userid, true, true) + createCephObjectUser(s, helper, k8sh, namespace, storeName, userid, true) i := 0 for i = 0; i < 4; i++ { if helper.ObjectUserClient.UserSecretExists(namespace, storeName, userid) { diff --git a/tests/integration/ceph_upgrade_test.go b/tests/integration/ceph_upgrade_test.go index 04ee2b4bb..849ad06eb 100644 --- a/tests/integration/ceph_upgrade_test.go +++ b/tests/integration/ceph_upgrade_test.go @@ -145,7 +145,7 @@ func (s *UpgradeSuite) testUpgrade(useHelm bool, initialCephVersion v1.CephVersi rbdFilesToRead = append(rbdFilesToRead, newFile) cephfsFilesToRead = append(cephfsFilesToRead, newFile) - checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, true, false) + checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, false) // should be Bound after upgrade to Rook master // do not need retry b/c the OBC controller runs parallel to Rook-Ceph orchestration @@ -169,7 +169,7 @@ func (s *UpgradeSuite) testUpgrade(useHelm bool, initialCephVersion v1.CephVersi s.verifyFilesAfterUpgrade(newFile, rbdFilesToRead, cephfsFilesToRead) logger.Infof("Verified upgrade from reef to squid") - checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, true, false) + checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, false) } func (s *UpgradeSuite) TestUpgradeCephToReefDevel() { @@ -203,7 +203,7 @@ func (s *UpgradeSuite) TestUpgradeCephToReefDevel() { s.verifyFilesAfterUpgrade(newFile, rbdFilesToRead, cephfsFilesToRead) logger.Infof("verified upgrade from reef stable to reef devel") - checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, true, false) + checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, false) } func (s *UpgradeSuite) TestUpgradeCephToSquidDevel() { @@ -237,7 +237,7 @@ func (s *UpgradeSuite) TestUpgradeCephToSquidDevel() { s.verifyFilesAfterUpgrade(newFile, rbdFilesToRead, cephfsFilesToRead) logger.Infof("verified upgrade from squid stable to squid devel") - checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, true, false) + checkCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, false) } func (s *UpgradeSuite) deployClusterforUpgrade(baseRookImage, objectUserID, preFilename string) (int, []string, []string) { @@ -274,7 +274,7 @@ func (s *UpgradeSuite) deployClusterforUpgrade(baseRookImage, objectUserID, preF } logger.Infof("Initializing object user before the upgrade") - createCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, false, false) + createCephObjectUser(&s.Suite, s.helper, s.k8sh, s.namespace, installer.ObjectStoreName, objectUserID, false) logger.Info("Initializing object bucket claim before the upgrade") cobErr := s.helper.BucketClient.CreateBucketStorageClass(s.namespace, installer.ObjectStoreName, installer.ObjectStoreName, "Delete")