@@ -50,11 +50,11 @@ func TestSeparateEDnode(t *testing.T) {
50
50
defer t .Logf ("====Deleting namespace: " + namespaceName )
51
51
defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
52
52
53
- releaseName := "test-dnode-group"
54
- t .Logf ("====Installing Helm Chart" + releaseName )
55
- helm .Install (t , options , helmChartPath , releaseName )
53
+ dnodeReleaseName := "test-dnode-group"
54
+ t .Logf ("====Installing Helm Chart" + dnodeReleaseName )
55
+ helm .Install (t , options , helmChartPath , dnodeReleaseName )
56
56
57
- podName := releaseName + "-marklogic-0"
57
+ podName := dnodeReleaseName + "-marklogic-0"
58
58
59
59
// wait until the pod is in Ready status
60
60
k8s .WaitUntilPodAvailable (t , kubectlOptions , podName , 10 , 20 * time .Second )
@@ -81,6 +81,11 @@ func TestSeparateEDnode(t *testing.T) {
81
81
bootstrapHost := gjson .Get (string (body ), `host-default-list.list-items.list-item.#(roleref="bootstrap").nameref` )
82
82
t .Logf (`BootstrapHost: = %s` , bootstrapHost )
83
83
84
+ // verify bootstrap host exists on the cluster
85
+ if bootstrapHost .String () == "" {
86
+ t .Errorf ("Bootstrap does not exists on cluster" )
87
+ }
88
+
84
89
enodeOptions := & helm.Options {
85
90
KubectlOptions : kubectlOptions ,
86
91
SetValues : map [string ]string {
@@ -95,14 +100,14 @@ func TestSeparateEDnode(t *testing.T) {
95
100
"logCollection.enabled" : "false" ,
96
101
},
97
102
}
98
- releaseName2 := "test-enode-group"
99
- t .Logf ("====Installing Helm Chart " + releaseName2 )
100
- helm .Install (t , enodeOptions , helmChartPath , releaseName2 )
103
+ enodeReleaseName := "test-enode-group"
104
+ t .Logf ("====Installing Helm Chart " + enodeReleaseName )
105
+ helm .Install (t , enodeOptions , helmChartPath , enodeReleaseName )
101
106
102
- enodePodName := releaseName2 + "-marklogic-0"
107
+ enodePodName - 0 := enodeReleaseName + "-marklogic-0"
103
108
104
- // wait until the pod is in Ready status
105
- k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName , 15 , 20 * time .Second )
109
+ // wait until the first enode pod is in Ready status
110
+ k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName - 0 , 15 , 20 * time .Second )
106
111
107
112
group_endpoint := fmt .Sprintf ("http://%s/manage/v2/groups" , tunnel .Endpoint ())
108
113
t .Logf (`Endpoint: %s` , group_endpoint )
@@ -124,4 +129,31 @@ func TestSeparateEDnode(t *testing.T) {
124
129
t .Errorf ("Groups does not exists on cluster" )
125
130
}
126
131
132
+ enodePodName - 1 := enodeReleaseName + "-marklogic-1"
133
+
134
+ // wait until the second enode pod is in Ready status
135
+ k8s .WaitUntilPodAvailable (t , kubectlOptions , enodePodName - 1 , 15 , 20 * time .Second )
136
+
137
+ enode_endpoint := fmt .Sprintf ("http://%s/manage/v2/groups/enode?format=json" , tunnel .Endpoint ())
138
+ t .Logf (`Endpoint: %s` , enode_endpoint )
139
+
140
+ dr_enode := digest_auth .NewRequest (username , password , "GET" , enode_endpoint , "" )
141
+
142
+ if resp , err = dr_enode .Execute (); err != nil {
143
+ t .Fatalf (err .Error ())
144
+ }
145
+ defer resp .Body .Close ()
146
+
147
+ if body , err = ioutil .ReadAll (resp .Body ); err != nil {
148
+ t .Fatalf (err .Error ())
149
+ }
150
+ t .Logf ("Response:\n " + string (body ))
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 )
154
+
155
+ // verify bootstrap host exists on the cluster
156
+ if ! strings .Contains (enode_host_count .String (),"2" ) {
157
+ t .Errorf ("enode hosts does not exists on cluster" )
158
+ }
127
159
}
0 commit comments