Skip to content

Commit 743697d

Browse files
author
Barkha Choithani
committed
added two tests for separate e/d node impl
1 parent de23770 commit 743697d

File tree

1 file changed

+42
-10
lines changed

1 file changed

+42
-10
lines changed

test/e2e/separate_nodes_test.go

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ func TestSeparateEDnode(t *testing.T) {
5050
defer t.Logf("====Deleting namespace: " + namespaceName)
5151
defer k8s.DeleteNamespace(t, kubectlOptions, namespaceName)
5252

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)
5656

57-
podName := releaseName + "-marklogic-0"
57+
podName := dnodeReleaseName + "-marklogic-0"
5858

5959
// wait until the pod is in Ready status
6060
k8s.WaitUntilPodAvailable(t, kubectlOptions, podName, 10, 20*time.Second)
@@ -81,6 +81,11 @@ func TestSeparateEDnode(t *testing.T) {
8181
bootstrapHost := gjson.Get(string(body), `host-default-list.list-items.list-item.#(roleref="bootstrap").nameref`)
8282
t.Logf(`BootstrapHost: = %s` , bootstrapHost)
8383

84+
// verify bootstrap host exists on the cluster
85+
if bootstrapHost.String() == "" {
86+
t.Errorf("Bootstrap does not exists on cluster")
87+
}
88+
8489
enodeOptions := &helm.Options{
8590
KubectlOptions: kubectlOptions,
8691
SetValues: map[string]string{
@@ -95,14 +100,14 @@ func TestSeparateEDnode(t *testing.T) {
95100
"logCollection.enabled": "false",
96101
},
97102
}
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)
101106

102-
enodePodName := releaseName2 + "-marklogic-0"
107+
enodePodName-0 := enodeReleaseName + "-marklogic-0"
103108

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)
106111

107112
group_endpoint := fmt.Sprintf("http://%s/manage/v2/groups", tunnel.Endpoint())
108113
t.Logf(`Endpoint: %s`, group_endpoint)
@@ -124,4 +129,31 @@ func TestSeparateEDnode(t *testing.T) {
124129
t.Errorf("Groups does not exists on cluster")
125130
}
126131

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+
}
127159
}

0 commit comments

Comments
 (0)