From 2fc885d80525ae9fa07e00c77e99ae716371b6bd Mon Sep 17 00:00:00 2001 From: Thibault Richard Date: Mon, 15 Nov 2021 21:07:25 +0100 Subject: [PATCH] Do not reuse the same variable to get trial/license secrets --- pkg/controller/license/trial/trial_controller_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/controller/license/trial/trial_controller_test.go b/pkg/controller/license/trial/trial_controller_test.go index 8fc4e3064b..f4dab7ce31 100644 --- a/pkg/controller/license/trial/trial_controller_test.go +++ b/pkg/controller/license/trial/trial_controller_test.go @@ -122,13 +122,14 @@ func TestReconcileTrials_Reconcile(t *testing.T) { } requireValidTrial := func(c k8s.Client) { - var sec corev1.Secret + var trialLicenseSecret corev1.Secret + require.NoError(t, c.Get(context.Background(), trialLicenseNsn, &trialLicenseSecret)) + var trialStatusSecret corev1.Secret require.NoError(t, c.Get(context.Background(), types.NamespacedName{ Namespace: testNs, Name: licensing.TrialStatusSecretKey, - }, &sec)) - require.NoError(t, c.Get(context.Background(), trialLicenseNsn, &sec)) - pubKeyBytes := sec.Data[licensing.TrialPubkeyKey] + }, &trialStatusSecret)) + pubKeyBytes := trialStatusSecret.Data[licensing.TrialPubkeyKey] key, err := licensing.ParsePubKey(pubKeyBytes) require.NoError(t, err) _, lic, err := licensing.TrialLicense(c, trialLicenseNsn)