@@ -12,14 +12,14 @@ import (
12
12
"github.com/gruntwork-io/terratest/modules/helm"
13
13
"github.com/gruntwork-io/terratest/modules/k8s"
14
14
"github.com/gruntwork-io/terratest/modules/random"
15
- digest_auth "github.com/xinsnake/go-http-digest-auth-client"
16
15
"github.com/tidwall/gjson"
16
+ digestAuth "github.com/xinsnake/go-http-digest-auth-client"
17
17
)
18
18
19
19
func TestSeparateEDnode (t * testing.T ) {
20
- // Path to the helm chart we will test
20
+ // Path to the helm chart we will test
21
21
helmChartPath , e := filepath .Abs ("../../charts" )
22
- if ( e != nil ) {
22
+ if e != nil {
23
23
t .Fatalf (e .Error ())
24
24
}
25
25
username := "admin"
@@ -33,14 +33,14 @@ func TestSeparateEDnode(t *testing.T) {
33
33
options := & helm.Options {
34
34
KubectlOptions : kubectlOptions ,
35
35
SetValues : map [string ]string {
36
- "persistence.enabled" : "false" ,
37
- "replicaCount" : "1" ,
38
- "image.repository" : "marklogic-centos/marklogic-server-centos" ,
39
- "image.tag" : "10-internal" ,
40
- "auth.adminUsername" : username ,
41
- "auth.adminPassword" : password ,
42
- "group.name" : "dnode" ,
43
- "logCollection.enabled" : "false" ,
36
+ "persistence.enabled" : "false" ,
37
+ "replicaCount" : "1" ,
38
+ "image.repository" : "marklogic-centos/marklogic-server-centos" ,
39
+ "image.tag" : "10-internal" ,
40
+ "auth.adminUsername" : username ,
41
+ "auth.adminPassword" : password ,
42
+ "group.name" : "dnode" ,
43
+ "logCollection.enabled" : "false" ,
44
44
},
45
45
}
46
46
@@ -49,7 +49,7 @@ func TestSeparateEDnode(t *testing.T) {
49
49
50
50
defer t .Logf ("====Deleting namespace: " + namespaceName )
51
51
defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
52
-
52
+
53
53
dnodeReleaseName := "test-dnode-group"
54
54
t .Logf ("====Installing Helm Chart" + dnodeReleaseName )
55
55
helm .Install (t , options , helmChartPath , dnodeReleaseName )
@@ -64,10 +64,10 @@ func TestSeparateEDnode(t *testing.T) {
64
64
kubectlOptions , k8s .ResourceTypePod , podName , 8002 , 8002 )
65
65
defer tunnel .Close ()
66
66
tunnel .ForwardPort (t )
67
- hosts_endpoint := fmt .Sprintf ("http://%s/manage/v2/hosts?format=json" , tunnel .Endpoint ())
68
- t .Logf (`Endpoint: %s` , hosts_endpoint )
67
+ hostsEndpoint := fmt .Sprintf ("http://%s/manage/v2/hosts?format=json" , tunnel .Endpoint ())
68
+ t .Logf (`Endpoint: %s` , hostsEndpoint )
69
69
70
- dr := digest_auth .NewRequest (username , password , "GET" , hosts_endpoint , "" )
70
+ dr := digestAuth .NewRequest (username , password , "GET" , hostsEndpoint , "" )
71
71
72
72
if resp , err = dr .Execute (); err != nil {
73
73
t .Fatalf (err .Error ())
@@ -79,7 +79,7 @@ func TestSeparateEDnode(t *testing.T) {
79
79
}
80
80
t .Logf ("Response:\n " + string (body ))
81
81
bootstrapHost := gjson .Get (string (body ), `host-default-list.list-items.list-item.#(roleref="bootstrap").nameref` )
82
- t .Logf (`BootstrapHost: = %s` , bootstrapHost )
82
+ t .Logf (`BootstrapHost: = %s` , bootstrapHost )
83
83
84
84
// verify bootstrap host exists on the cluster
85
85
if bootstrapHost .String () == "" {
@@ -89,32 +89,32 @@ func TestSeparateEDnode(t *testing.T) {
89
89
enodeOptions := & helm.Options {
90
90
KubectlOptions : kubectlOptions ,
91
91
SetValues : map [string ]string {
92
- "persistence.enabled" : "false" ,
93
- "replicaCount" : "2" ,
94
- "image.repository" : "marklogic-centos/marklogic-server-centos" ,
95
- "image.tag" : "10-internal" ,
96
- "auth.adminUsername" : username ,
97
- "auth.adminPassword" : password ,
98
- "group.name" : "enode" ,
99
- "bootstrapHostName" : bootstrapHost .String (),
100
- "logCollection.enabled" : "false" ,
92
+ "persistence.enabled" : "false" ,
93
+ "replicaCount" : "2" ,
94
+ "image.repository" : "marklogic-centos/marklogic-server-centos" ,
95
+ "image.tag" : "10-internal" ,
96
+ "auth.adminUsername" : username ,
97
+ "auth.adminPassword" : password ,
98
+ "group.name" : "enode" ,
99
+ "bootstrapHostName" : bootstrapHost .String (),
100
+ "logCollection.enabled" : "false" ,
101
101
},
102
102
}
103
103
enodeReleaseName := "test-enode-group"
104
104
t .Logf ("====Installing Helm Chart " + enodeReleaseName )
105
105
helm .Install (t , enodeOptions , helmChartPath , enodeReleaseName )
106
106
107
- enodePodName - 0 := enodeReleaseName + "-marklogic-0"
107
+ enodePodName0 := enodeReleaseName + "-marklogic-0"
108
108
109
109
// wait until the first enode pod is in Ready status
110
- k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName - 0 , 15 , 20 * time .Second )
110
+ k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName0 , 15 , 20 * time .Second )
111
111
112
- group_endpoint := fmt .Sprintf ("http://%s/manage/v2/groups" , tunnel .Endpoint ())
113
- t .Logf (`Endpoint: %s` , group_endpoint )
112
+ groupEndpoint := fmt .Sprintf ("http://%s/manage/v2/groups" , tunnel .Endpoint ())
113
+ t .Logf (`Endpoint: %s` , groupEndpoint )
114
114
115
- dr_groups := digest_auth .NewRequest (username , password , "GET" , group_endpoint , "" )
115
+ drGroups := digestAuth .NewRequest (username , password , "GET" , groupEndpoint , "" )
116
116
117
- if resp , err = dr_groups .Execute (); err != nil {
117
+ if resp , err = drGroups .Execute (); err != nil {
118
118
t .Fatalf (err .Error ())
119
119
}
120
120
defer resp .Body .Close ()
@@ -129,17 +129,17 @@ func TestSeparateEDnode(t *testing.T) {
129
129
t .Errorf ("Groups does not exists on cluster" )
130
130
}
131
131
132
- enodePodName - 1 := enodeReleaseName + "-marklogic-1"
132
+ enodePodName1 := enodeReleaseName + "-marklogic-1"
133
133
134
134
// wait until the second enode pod is in Ready status
135
- k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName - 1 , 15 , 20 * time .Second )
135
+ k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName1 , 15 , 20 * time .Second )
136
136
137
- enode_endpoint := fmt .Sprintf ("http://%s/manage/v2/groups/enode?format=json" , tunnel .Endpoint ())
138
- t .Logf (`Endpoint: %s` , enode_endpoint )
137
+ enodeEndpoint := fmt .Sprintf ("http://%s/manage/v2/groups/enode?format=json" , tunnel .Endpoint ())
138
+ t .Logf (`Endpoint: %s` , enodeEndpoint )
139
139
140
- dr_enode := digest_auth .NewRequest (username , password , "GET" , enode_endpoint , "" )
140
+ drEnode := digestAuth .NewRequest (username , password , "GET" , enodeEndpoint , "" )
141
141
142
- if resp , err = dr_enode .Execute (); err != nil {
142
+ if resp , err = drEnode .Execute (); err != nil {
143
143
t .Fatalf (err .Error ())
144
144
}
145
145
defer resp .Body .Close ()
@@ -149,11 +149,11 @@ func TestSeparateEDnode(t *testing.T) {
149
149
}
150
150
t .Logf ("Response:\n " + string (body ))
151
151
152
- enode_host_count := gjson .Get (string (body ), `group-default.relations.relation-group.#(typeref="hosts").relation-count.value` )
153
- t .Logf (`enode_host_count : = %s` , enode_host_count )
152
+ enodeHostCount := gjson .Get (string (body ), `group-default.relations.relation-group.#(typeref="hosts").relation-count.value` )
153
+ t .Logf (`enodeHostCount : = %s` , enodeHostCount )
154
154
155
155
// verify bootstrap host exists on the cluster
156
- if ! strings .Contains (enode_host_count .String (),"2" ) {
156
+ if ! strings .Contains (enodeHostCount .String (), "2" ) {
157
157
t .Errorf ("enode hosts does not exists on cluster" )
158
158
}
159
- }
159
+ }
0 commit comments