From 9d70b9f5ad7cdbbb5c46f0761aa6332e4eca2413 Mon Sep 17 00:00:00 2001 From: Jooseppi Luna Date: Wed, 13 Nov 2024 15:35:03 -0500 Subject: [PATCH] Clarify which secret is for which unisphere in reverseproxy configmap (#366) * use more intuitive secret names in config.yaml * Update config.yaml * Update actions.yaml * golangci-lint warning - cap name is already used for builtin * golangci-lint warning - max name is already used for builtin * updated secret names * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * Update powermax_test.go * go fmt fixes --------- Co-authored-by: niranjan-n1 --- .github/workflows/actions.yaml | 2 +- csireverseproxy/deploy/config.yaml | 16 ++++++++-------- csireverseproxy/test-config/config.yaml | 16 ++++++++-------- pkg/symmetrix/powermax.go | 4 ++-- pkg/symmetrix/powermax_test.go | 21 +++++++++++++++++++++ test/integration/step_defs_test.go | 8 ++++---- 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index e63c8e1d..582d9ab4 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -12,7 +12,7 @@ jobs: - name: Checkout the code uses: actions/checkout@v4 - name: Run the formatter, linter, and vetter - uses: dell/common-github-actions/go-code-formatter-linter-vetter@main + uses: dell/common-github-actions/go-code-formatter-vetter@main with: directories: ./... test: diff --git a/csireverseproxy/deploy/config.yaml b/csireverseproxy/deploy/config.yaml index 9c3773a6..22909b9a 100644 --- a/csireverseproxy/deploy/config.yaml +++ b/csireverseproxy/deploy/config.yaml @@ -8,24 +8,24 @@ standAloneConfig: primaryURL: https://primary-1.unisphe.re:8443 backupURL: https://backup-1.unisphe.re:8443 proxyCredentialSecrets: - - proxy-secret-11 - - proxy-secret-12 + - primary-unisphere-secret-1 + - backup-unisphere-secret-1 - storageArrayId: "000000000002" primaryURL: https://primary-2.unisphe.re:8443 backupURL: https://backup-2.unisphe.re:8443 proxyCredentialSecrets: - - proxy-secret-21 - - proxy-secret-22 + - primary-unisphere-secret-2 + - backup-unisphere-secret-2 managementServers: - url: https://primary-1.unisphe.re:8443 - arrayCredentialSecret: primary-1-secret + arrayCredentialSecret: primary-unisphere-secret-1 skipCertificateValidation: true - url: https://backup-1.unisphe.re:8443 - arrayCredentialSecret: backup-1-secret + arrayCredentialSecret: backup-unisphere-secret-1 skipCertificateValidation: false - url: https://primary-2.unisphe.re:8443 - arrayCredentialSecret: primary-2-secret + arrayCredentialSecret: primary-unisphere-secret-2 skipCertificateValidation: true - url: https://backup-2.unisphe.re:8443 - arrayCredentialSecret: backup-2-secret + arrayCredentialSecret: backup-unisphere-secret-2 skipCertificateValidation: false diff --git a/csireverseproxy/test-config/config.yaml b/csireverseproxy/test-config/config.yaml index 32f68c07..71152f5d 100644 --- a/csireverseproxy/test-config/config.yaml +++ b/csireverseproxy/test-config/config.yaml @@ -6,24 +6,24 @@ standAloneConfig: primaryURL: https://primary-1.unisphe.re:8443 backupURL: https://backup-1.unisphe.re:8443 proxyCredentialSecrets: - - proxy-secret-11 - - proxy-secret-12 + - primary-unisphere-secret-1 + - backup-unisphere-secret-1 - storageArrayId: "000000000002" primaryURL: https://primary-2.unisphe.re:8443 backupURL: https://backup-2.unisphe.re:8443 proxyCredentialSecrets: - - proxy-secret-21 - - proxy-secret-22 + - primary-unisphere-secret-2 + - backup-unisphere-secret-2 managementServers: - url: https://primary-1.unisphe.re:8443 - arrayCredentialSecret: primary-1-secret + arrayCredentialSecret: primary-unisphere-secret-1 skipCertificateValidation: true - url: https://backup-1.unisphe.re:8443 - arrayCredentialSecret: backup-1-secret + arrayCredentialSecret: backup-unisphere-secret-1 skipCertificateValidation: false - url: https://primary-2.unisphe.re:8443 - arrayCredentialSecret: primary-2-secret + arrayCredentialSecret: primary-unisphere-secret-2 skipCertificateValidation: true - url: https://backup-2.unisphe.re:8443 - arrayCredentialSecret: backup-2-secret + arrayCredentialSecret: backup-unisphere-secret-2 skipCertificateValidation: false diff --git a/pkg/symmetrix/powermax.go b/pkg/symmetrix/powermax.go index 94873cd3..fd5f73bb 100644 --- a/pkg/symmetrix/powermax.go +++ b/pkg/symmetrix/powermax.go @@ -73,8 +73,8 @@ type ReplicationCapabilitiesCache struct { time CacheTime } -func (rep *ReplicationCapabilitiesCache) update(cap *types.SymmetrixCapability) { - rep.cap = cap +func (rep *ReplicationCapabilitiesCache) update(capability *types.SymmetrixCapability) { + rep.cap = capability rep.time.Set(SnapLicenseCacheValidity) } diff --git a/pkg/symmetrix/powermax_test.go b/pkg/symmetrix/powermax_test.go index 1fa53289..3c31b05e 100644 --- a/pkg/symmetrix/powermax_test.go +++ b/pkg/symmetrix/powermax_test.go @@ -18,6 +18,7 @@ import ( "testing" pmax "github.com/dell/gopowermax/v2" + types "github.com/dell/gopowermax/v2/types/v100" ) func TestGetPowerMaxClient(t *testing.T) { @@ -53,3 +54,23 @@ func TestGetPowerMaxClient(t *testing.T) { t.Errorf("Should have failed with none of the arrays managed") } } + +// ctx context.Context, client pmax.Pmax, symID string +func TestUpdate(t *testing.T) { + symmetrixCapability := types.SymmetrixCapability{ + SymmetrixID: "fakeSymmetrix", + SnapVxCapable: true, + RdfCapable: true, + } + rep := ReplicationCapabilitiesCache{} + rep.update(&symmetrixCapability) + if rep.cap.SymmetrixID != "fakeSymmetrix" { + t.Errorf("update call failed -- SymmetrixID not set properly in capability: cap.SymmetrixID: %+v", rep.cap.SymmetrixID) + if !rep.cap.SnapVxCapable { + t.Errorf("update call failed -- SnapVxCapable not set properly in capability: cap.SnapVxCapable: %+v", rep.cap.SnapVxCapable) + if !rep.cap.RdfCapable { + t.Errorf("update call failed -- RdfCapable not set properly in capability: cap.RdfCapable: %+v", rep.cap.RdfCapable) + } + } + } +} diff --git a/test/integration/step_defs_test.go b/test/integration/step_defs_test.go index e97daa8d..f19410bd 100644 --- a/test/integration/step_defs_test.go +++ b/test/integration/step_defs_test.go @@ -1542,11 +1542,11 @@ func (f *feature) allVolumesAreDeletedSuccessfully() error { symVolumeID := idComponents[len(idComponents)-1] symID := idComponents[len(idComponents)-2] fmt.Printf("Waiting for volume %s %s to be deleted\n", id, symVolumeID) - max := 40 * nVols - if 300 > max { - max = 300 + maxVols := 40 * nVols + if 300 > maxVols { + maxVols = 300 } - for i := 0; i < max; i++ { + for i := 0; i < maxVols; i++ { vol, err := f.pmaxClient.GetVolumeByID(context.Background(), symID, symVolumeID) if vol == nil { deleted = strings.Contains(err.Error(), "Could not find")