@@ -306,167 +306,4 @@ func TestIncorrectBootsrapHostname(t *testing.T) {
306
306
t .Logf ("Enode group status response:\n " + string (body ))
307
307
}
308
308
309
- func TestDefaultGroup (t * testing.T ) {
310
- var resp * http.Response
311
- var body []byte
312
- var err error
313
-
314
- username := "admin"
315
- password := "admin"
316
- imageRepo , repoPres := os .LookupEnv ("dockerRepository" )
317
- imageTag , tagPres := os .LookupEnv ("dockerVersion" )
318
- namespaceName := "marklogic-" + strings .ToLower (random .UniqueId ())
319
- kubectlOptions := k8s .NewKubectlOptions ("" , "" , namespaceName )
320
- releaseName := "test-default-group"
321
- podName := releaseName + "-marklogic-0"
322
-
323
- // Path to the helm chart we will test
324
- helmChartPath , e := filepath .Abs ("../../charts" )
325
-
326
- if e != nil {
327
- t .Fatalf (e .Error ())
328
- }
329
-
330
- if ! repoPres {
331
- imageRepo = "marklogic-centos/marklogic-server-centos"
332
- t .Logf ("No imageRepo variable present, setting to default value: " + imageRepo )
333
- }
334
-
335
- if ! tagPres {
336
- imageTag = "10-internal"
337
- t .Logf ("No imageTag variable present, setting to default value: " + imageTag )
338
- }
339
-
340
- // Helm options for enode creation
341
- noGroupOptions := & helm.Options {
342
- KubectlOptions : kubectlOptions ,
343
- SetValues : map [string ]string {
344
- "replicaCount" : "1" ,
345
- "image.repository" : imageRepo ,
346
- "image.tag" : imageTag ,
347
- "auth.adminUsername" : username ,
348
- "auth.adminPassword" : password ,
349
- "logCollection.enabled" : "false" ,
350
- },
351
- }
352
-
353
- t .Logf ("====Creating namespace: " + namespaceName )
354
- k8s .CreateNamespace (t , kubectlOptions , namespaceName )
355
-
356
- defer t .Logf ("====Deleting namespace: " + namespaceName )
357
- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
358
-
359
- t .Logf ("====Installing No Group Helm Chart " + releaseName )
360
- helm .Install (t , noGroupOptions , helmChartPath , releaseName )
361
-
362
- // wait until the pod is in ready status
363
- k8s .WaitUntilPodAvailable (t , kubectlOptions , podName , 10 , 20 * time .Second )
364
-
365
- tunnel := k8s .NewTunnel (
366
- kubectlOptions , k8s .ResourceTypePod , podName , 8002 , 8002 )
367
-
368
- defer tunnel .Close ()
369
-
370
- tunnel .ForwardPort (t )
371
-
372
- // Verify only single group was created and it is default group
373
- groupStatusEndpoint := fmt .Sprintf ("http://%s/manage/v2/groups?format=json" , tunnel .Endpoint ())
374
- groupStatus := digestAuth .NewRequest (username , password , "GET" , groupStatusEndpoint , "" )
375
- t .Logf (`groupStatusEndpoint: %s` , groupStatusEndpoint )
376
- if resp , err = groupStatus .Execute (); err != nil {
377
- t .Fatalf (err .Error ())
378
- }
379
- if body , err = ioutil .ReadAll (resp .Body ); err != nil {
380
- t .Fatalf (err .Error ())
381
- }
382
- groupNameJSON := gjson .Get (string (body ), "group-default-list.list-items.list-item[0].nameref" )
383
- groupQuantityJSON := gjson .Get (string (body ), "group-default-list.list-items.list-count.value" )
384
- if groupNameJSON .Str != "Default" && groupQuantityJSON .Num != 1 {
385
- t .Errorf ("Only group should exist and it should be the Default group, instead %v groups exist and the first group is named %v" , groupQuantityJSON .Num , groupNameJSON .Str )
386
- }
387
-
388
- t .Logf ("Groups status response:\n " + string (body ))
389
- }
390
-
391
- func TestSingleGroupCreated (t * testing.T ) {
392
- var resp * http.Response
393
- var body []byte
394
- var err error
395
-
396
- username := "admin"
397
- password := "admin"
398
- imageRepo , repoPres := os .LookupEnv ("dockerRepository" )
399
- imageTag , tagPres := os .LookupEnv ("dockerVersion" )
400
- namespaceName := "marklogic-" + strings .ToLower (random .UniqueId ())
401
- kubectlOptions := k8s .NewKubectlOptions ("" , "" , namespaceName )
402
- releaseName := "test-default-group"
403
- podName := releaseName + "-marklogic-0"
404
-
405
- // Path to the helm chart we will test
406
- helmChartPath , e := filepath .Abs ("../../charts" )
407
-
408
- if e != nil {
409
- t .Fatalf (e .Error ())
410
- }
411
-
412
- if ! repoPres {
413
- imageRepo = "marklogic-centos/marklogic-server-centos"
414
- t .Logf ("No imageRepo variable present, setting to default value: " + imageRepo )
415
- }
416
-
417
- if ! tagPres {
418
- imageTag = "10-internal"
419
- t .Logf ("No imageTag variable present, setting to default value: " + imageTag )
420
- }
421
-
422
- // Helm options for enode creation
423
- noGroupOptions := & helm.Options {
424
- KubectlOptions : kubectlOptions ,
425
- SetValues : map [string ]string {
426
- "replicaCount" : "3" ,
427
- "image.repository" : imageRepo ,
428
- "image.tag" : imageTag ,
429
- "auth.adminUsername" : username ,
430
- "auth.adminPassword" : password ,
431
- "logCollection.enabled" : "false" ,
432
- "group.name" : "enode" ,
433
- },
434
- }
435
-
436
- t .Logf ("====Creating namespace: " + namespaceName )
437
- k8s .CreateNamespace (t , kubectlOptions , namespaceName )
438
-
439
- defer t .Logf ("====Deleting namespace: " + namespaceName )
440
- defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
441
-
442
- t .Logf ("====Installing No Group Helm Chart " + releaseName )
443
- helm .Install (t , noGroupOptions , helmChartPath , releaseName )
444
-
445
- // wait until the pod is in ready status
446
- k8s .WaitUntilPodAvailable (t , kubectlOptions , podName , 10 , 20 * time .Second )
447
-
448
- tunnel := k8s .NewTunnel (
449
- kubectlOptions , k8s .ResourceTypePod , podName , 8002 , 8002 )
450
-
451
- defer tunnel .Close ()
452
-
453
- tunnel .ForwardPort (t )
454
-
455
- // Verify no groups beyond enode were created/modified
456
- groupStatusEndpoint := fmt .Sprintf ("http://%s/manage/v2/groups?format=json" , tunnel .Endpoint ())
457
- groupStatus := digestAuth .NewRequest (username , password , "GET" , groupStatusEndpoint , "" )
458
- t .Logf (`groupStatusEndpoint: %s` , groupStatusEndpoint )
459
- if resp , err = groupStatus .Execute (); err != nil {
460
- t .Fatalf (err .Error ())
461
- }
462
- if body , err = ioutil .ReadAll (resp .Body ); err != nil {
463
- t .Fatalf (err .Error ())
464
- }
465
- groupQuantityJSON := gjson .Get (string (body ), "group-default-list.list-items.list-count.value" )
466
-
467
- if groupQuantityJSON .Num != 1 {
468
- t .Errorf ("Only group should exist, instead %v groups exist" , groupQuantityJSON .Num )
469
- }
470
-
471
- t .Logf ("Groups status response:\n " + string (body ))
472
- }
309
+
0 commit comments