Skip to content

Commit f574323

Browse files
committed
add test cases for XDQP configuration
1 parent 86e6faa commit f574323

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed

test/e2e/install_test.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,26 @@ func TestHelmInstall(t *testing.T) {
113113
// the generated password should be able to access the manage endpoint
114114
assert.Equal(t, 200, response.StatusCode)
115115

116-
t.Log("====Verify no groups beyond enode were created/modified====")
116+
t.Log("====Verify xdqp-ssl-enabled is set to true by default")
117+
endpoint := fmt.Sprintf("http://%s/manage/v2/groups/Default/properties?format=json", tunnel8002.Endpoint())
118+
t.Logf(`Endpoint for group properties: %s`, endpoint)
119+
120+
request = digestAuth.NewRequest(username, password, "GET", endpoint, "")
121+
resp, err = request.Execute()
122+
if err != nil {
123+
t.Fatalf(err.Error())
124+
}
125+
defer resp.Body.Close()
126+
body, err = ioutil.ReadAll(resp.Body)
127+
if err != nil {
128+
t.Fatalf(err.Error())
129+
}
130+
131+
xdqpSSLEnabled := gjson.Get(string(body), `xdqp-ssl-enabled`)
132+
// verify xdqp-ssl-enabled is set to trues
133+
assert.Equal(t, true, xdqpSSLEnabled.Bool(), "xdqp-ssl-enabled should be set to true")
134+
135+
t.Log("====Verify no groups beyond default were created/modified====")
117136
groupStatusEndpoint := fmt.Sprintf("http://%s/manage/v2/groups?format=json", tunnel8002.Endpoint())
118137
groupStatus := digestAuth.NewRequest(username, password, "GET", groupStatusEndpoint, "")
119138
t.Logf(`groupStatusEndpoint: %s`, groupStatusEndpoint)
@@ -129,5 +148,4 @@ func TestHelmInstall(t *testing.T) {
129148
t.Errorf("Only one group should exist, instead %v groups exist", groupQuantityJSON.Num)
130149
}
131150

132-
t.Logf("Groups status response:\n" + string(body))
133151
}

test/e2e/separate_nodes_test.go

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func TestSeparateEDnode(t *testing.T) {
5656
"auth.adminUsername": username,
5757
"auth.adminPassword": password,
5858
"group.name": "dnode",
59+
"group.enableXdqpSsl": "true",
5960
"logCollection.enabled": "false",
6061
},
6162
}
@@ -91,7 +92,6 @@ func TestSeparateEDnode(t *testing.T) {
9192
if err != nil {
9293
t.Fatalf(err.Error())
9394
}
94-
t.Logf("Get hosts response:\n" + string(body))
9595

9696
bootstrapHostJSON := gjson.Get(string(body), `host-default-list.list-items.list-item.#(roleref="bootstrap").nameref`)
9797
t.Logf(`BootstrapHost: = %s`, bootstrapHostJSON)
@@ -100,6 +100,25 @@ func TestSeparateEDnode(t *testing.T) {
100100
t.Errorf("Bootstrap does not exists on cluster")
101101
}
102102

103+
t.Log("====Verify xdqp-ssl-enabled is set to true")
104+
endpoint := fmt.Sprintf("http://%s/manage/v2/groups/dnode/properties?format=json", tunnel.Endpoint())
105+
t.Logf(`Endpoint for group properties: %s`, endpoint)
106+
107+
request := digestAuth.NewRequest(username, password, "GET", endpoint, "")
108+
resp, err = request.Execute()
109+
if err != nil {
110+
t.Fatalf(err.Error())
111+
}
112+
defer resp.Body.Close()
113+
body, err = ioutil.ReadAll(resp.Body)
114+
if err != nil {
115+
t.Fatalf(err.Error())
116+
}
117+
118+
xdqpSSLEnabled := gjson.Get(string(body), `xdqp-ssl-enabled`)
119+
// verify xdqp-ssl-enabled is set to trues
120+
assert.Equal(t, true, xdqpSSLEnabled.Bool(), "xdqp-ssl-enabled should be set to true")
121+
103122
enodeOptions := &helm.Options{
104123
KubectlOptions: kubectlOptions,
105124
SetValues: map[string]string{
@@ -111,6 +130,7 @@ func TestSeparateEDnode(t *testing.T) {
111130
"auth.adminPassword": password,
112131
"group.name": "enode",
113132
"bootstrapHostName": bootstrapHostJSON.Str,
133+
"group.enableXdqpSsl": "false",
114134
"logCollection.enabled": "false",
115135
},
116136
}
@@ -120,6 +140,25 @@ func TestSeparateEDnode(t *testing.T) {
120140
// wait until the first enode pod is in Ready status
121141
k8s.WaitUntilPodAvailable(t, kubectlOptions, enodePodName0, 45, 20*time.Second)
122142

143+
t.Log("====Verify xdqp-ssl-enabled is set to false on Enode")
144+
endpoint = fmt.Sprintf("http://%s/manage/v2/groups/enode/properties?format=json", tunnel.Endpoint())
145+
t.Logf(`Endpoint for group properties: %s`, endpoint)
146+
147+
request = digestAuth.NewRequest(username, password, "GET", endpoint, "")
148+
resp, err = request.Execute()
149+
if err != nil {
150+
t.Fatalf(err.Error())
151+
}
152+
defer resp.Body.Close()
153+
body, err = ioutil.ReadAll(resp.Body)
154+
if err != nil {
155+
t.Fatalf(err.Error())
156+
}
157+
158+
xdqpSSLEnabled = gjson.Get(string(body), `xdqp-ssl-enabled`)
159+
// verify xdqp-ssl-enabled is set to false
160+
assert.Equal(t, false, xdqpSSLEnabled.Bool())
161+
123162
groupEndpoint := fmt.Sprintf("http://%s/manage/v2/groups", tunnel.Endpoint())
124163
t.Logf(`Endpoint: %s`, groupEndpoint)
125164

@@ -132,7 +171,6 @@ func TestSeparateEDnode(t *testing.T) {
132171
if body, err = ioutil.ReadAll(resp.Body); err != nil {
133172
t.Fatalf(err.Error())
134173
}
135-
t.Logf("Groups status response:\n" + string(body))
136174

137175
// verify groups dnode, enode exists on the cluster
138176
if !strings.Contains(string(body), "<nameref>dnode</nameref>") && !strings.Contains(string(body), "<nameref>enode</nameref>") {

0 commit comments

Comments
 (0)