@@ -50,8 +50,8 @@ func TestCockroachDbHelmInstall(t *testing.T) {
5050 }
5151
5252 k8s .CreateNamespace (t , kubectlOptions , namespaceName )
53- // ... and make sure to delete the namespace at the end of the test
54- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
53+ // ... and make sure to delete the namespace at the end of the test.
54+ defer testutil .DeleteNamespace (t , k8sClient , namespaceName )
5555
5656 const testDBName = "testdb"
5757
@@ -88,7 +88,7 @@ func TestCockroachDbHelmInstall(t *testing.T) {
8888 }
8989 }()
9090
91- // Next we wait for the service endpoint
91+ // Next we wait for the service endpoint.
9292 serviceName := fmt .Sprintf ("%s-cockroachdb-public" , releaseName )
9393 k8s .WaitUntilServiceAvailable (t , kubectlOptions , serviceName , 30 , 2 * time .Second )
9494
@@ -123,8 +123,8 @@ func TestCockroachDbHelmInstallWithCAProvided(t *testing.T) {
123123 }
124124
125125 k8s .CreateNamespace (t , kubectlOptions , namespaceName )
126- // ... and make sure to delete the namespace at the end of the test
127- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
126+ // ... and make sure to delete the namespace at the end of the test.
127+ defer testutil .DeleteNamespace (t , k8sClient , namespaceName )
128128
129129 certOutput , err := shell .RunCommandAndGetOutputE (t , cmd )
130130 t .Log (certOutput )
@@ -168,7 +168,7 @@ func TestCockroachDbHelmInstallWithCAProvided(t *testing.T) {
168168 },
169169 )
170170
171- // custom user CA certificate secret should not be deleted by pre-delete job
171+ // custom user CA certificate secret should not be deleted by pre-delete job.
172172 _ , err = k8s .GetSecretE (t , kubectlOptions , crdbCluster .CaSecret )
173173 require .NoError (t , err )
174174 }()
@@ -180,7 +180,7 @@ func TestCockroachDbHelmInstallWithCAProvided(t *testing.T) {
180180 }
181181 }()
182182
183- // Next we wait for the service endpoint
183+ // Next we wait for the service endpoint.
184184 serviceName := fmt .Sprintf ("%s-cockroachdb-public" , releaseName )
185185 k8s .WaitUntilServiceAvailable (t , kubectlOptions , serviceName , 30 , 2 * time .Second )
186186
@@ -190,7 +190,7 @@ func TestCockroachDbHelmInstallWithCAProvided(t *testing.T) {
190190 testutil .RequireCRDBToFunction (t , crdbCluster , false )
191191}
192192
193- // Test to check migration from Bring your own certificate method to self-sginer cert utility
193+ // Test to check migration from Bring your own certificate method to self-sginer cert utility.
194194func TestCockroachDbHelmMigration (t * testing.T ) {
195195 namespaceName := "cockroach" + strings .ToLower (random .UniqueId ())
196196 kubectlOptions := k8s .NewKubectlOptions ("" , "" , namespaceName )
@@ -250,8 +250,8 @@ func TestCockroachDbHelmMigration(t *testing.T) {
250250 }
251251
252252 k8s .CreateNamespace (t , kubectlOptions , namespaceName )
253- // Make sure to delete the namespace at the end of the test
254- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
253+ // Make sure to delete the namespace at the end of the test.
254+ defer testutil .DeleteNamespace (t , k8sClient , namespaceName )
255255
256256 cmds := []shell.Command {cmdCa , cmdNode , cmdClient }
257257 for i := range cmds {
@@ -270,7 +270,7 @@ func TestCockroachDbHelmMigration(t *testing.T) {
270270 fmt .Sprintf ("--from-file=%s/ca.crt" , certsDir ))
271271 require .NoError (t , err )
272272
273- // Setup the args
273+ // Setup the args.
274274 options := & helm.Options {
275275 KubectlOptions : k8s .NewKubectlOptions ("" , "" , namespaceName ),
276276 SetValues : patchHelmValues (map [string ]string {
@@ -299,12 +299,12 @@ func TestCockroachDbHelmMigration(t *testing.T) {
299299 testutil .RequireClusterToBeReadyEventuallyTimeout (t , crdbCluster , 600 * time .Second )
300300 time .Sleep (20 * time .Second )
301301
302- // Setup the args for upgrade
302+ // Setup the args for upgrade.
303303 crdbCluster .NodeSecret = fmt .Sprintf ("%s-cockroachdb-node-secret" , releaseName )
304304 crdbCluster .ClientSecret = fmt .Sprintf ("%s-cockroachdb-client-secret" , releaseName )
305305 crdbCluster .CaSecret = fmt .Sprintf ("%s-cockroachdb-ca-secret" , releaseName )
306306
307- // Default method is self-signer so no need to set explicitly
307+ // Default method is self-signer so no need to set explicitly.
308308 options = & helm.Options {
309309 KubectlOptions : k8s .NewKubectlOptions ("" , "" , namespaceName ),
310310 SetValues : patchHelmValues (map [string ]string {
@@ -319,8 +319,8 @@ func TestCockroachDbHelmMigration(t *testing.T) {
319319 }
320320
321321 // Upgrade the cockroachdb helm chart and checks installation should succeed.
322- // Upgrade is done in goRoutine to unblock the code flow
323- // While upgrading statefulset pods need to be deleted manually to consume the new certificate chain
322+ // Upgrade is done in goRoutine to unblock the code flow.
323+ // While upgrading statefulset pods need to be deleted manually to consume the new certificate chain.
324324 wg := sync.WaitGroup {}
325325 wg .Add (1 )
326326
@@ -338,7 +338,7 @@ func TestCockroachDbHelmMigration(t *testing.T) {
338338
339339 wg .Wait ()
340340
341- // Wait for the service endpoint
341+ // Wait for the service endpoint.
342342 k8s .WaitUntilServiceAvailable (t , kubectlOptions , publicService , 30 , 2 * time .Second )
343343
344344 testutil .RequireCertificatesToBeValid (t , crdbCluster )
@@ -360,7 +360,7 @@ func TestCockroachDbWithInsecureMode(t *testing.T) {
360360
361361 k8s .CreateNamespace (t , kubectlOptions , namespaceName )
362362 // ... and make sure to delete the namespace at the end of the test
363- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
363+ defer testutil .DeleteNamespace (t , k8sClient , namespaceName )
364364
365365 // Setup the args. For this test, we will set the following input values:
366366 options := & helm.Options {
@@ -397,7 +397,7 @@ func TestCockroachDbWithCertManager(t *testing.T) {
397397
398398 k8s .CreateNamespace (t , kubectlOptions , namespaceName )
399399 // ... and make sure to delete the namespace at the end of the test
400- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
400+ defer testutil .DeleteNamespace (t , k8sClient , namespaceName )
401401
402402 certManagerHelmOptions := & helm.Options {
403403 KubectlOptions : k8s .NewKubectlOptions ("" , "" , "cert-manager" ),
@@ -526,7 +526,7 @@ func testWALFailoverExistingCluster(t *testing.T, additionalValues map[string]st
526526 }
527527
528528 k8s .CreateNamespace (t , kubectlOptions , namespaceName )
529- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
529+ defer testutil .DeleteNamespace (t , k8sClient , namespaceName )
530530
531531 // Print the debug logs in case of test failure.
532532 defer func () {
0 commit comments