Skip to content

Commit 61a796b

Browse files
MLE-16280: Added pod image repo and tag values in the upgrade options(#290)
* added image repo and tag values in the upgrade options and additional checks
1 parent b7a53dd commit 61a796b

File tree

3 files changed

+60
-11
lines changed

3 files changed

+60
-11
lines changed

test/e2e/group_cfg_test.go

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,37 @@ func TestSingleGroupChange(t *testing.T) {
110110
podZeroName := testUtil.HelmInstall(t, options, releaseName, kubectlOptions, helmChartPath)
111111

112112
k8s.WaitUntilPodAvailable(t, kubectlOptions, podZeroName, 15, 20*time.Second)
113+
// wait until the pod is in Running status
114+
output, err := testUtil.WaitUntilPodRunning(t, kubectlOptions, podZeroName, 20, 15*time.Second)
115+
if err != nil {
116+
t.Error(err.Error())
117+
}
118+
if output != "Running" {
119+
t.Error(output)
120+
}
113121

114122
newGroupName := "new_group"
115123

116124
helmUpgradeOptions := &helm.Options{
117125
KubectlOptions: kubectlOptions,
118126
SetValues: map[string]string{
119-
"group.name": newGroupName,
127+
"image.repository": imageRepo,
128+
"image.tag": imageTag,
129+
"group.name": newGroupName,
120130
},
121131
}
122132
helm.Upgrade(t, helmUpgradeOptions, helmChartPath, releaseName)
123133

124134
k8s.RunKubectl(t, kubectlOptions, "delete", "pod", podZeroName)
125135

126-
k8s.WaitUntilPodAvailable(t, kubectlOptions, podZeroName, 15, 20*time.Second)
136+
// wait until the pod is in Running status
137+
output, err = testUtil.WaitUntilPodRunning(t, kubectlOptions, podZeroName, 20, 15*time.Second)
138+
if err != nil {
139+
t.Error(err.Error())
140+
}
141+
if output != "Running" {
142+
t.Error(output)
143+
}
127144

128145
// wait until the pod is in Ready status
129146
tunnel := k8s.NewTunnel(
@@ -195,8 +212,14 @@ func TestMultipleGroupChange(t *testing.T) {
195212
t.Logf("====Installing Helm Chart " + dnodeReleaseName)
196213
dnodePodName := testUtil.HelmInstall(t, options, dnodeReleaseName, kubectlOptions, helmChartPath)
197214

198-
// wait until the pod is in ready status
199-
k8s.WaitUntilPodAvailable(t, kubectlOptions, dnodePodName, 15, 20*time.Second)
215+
// wait until the pod is in Running status
216+
output, err := testUtil.WaitUntilPodRunning(t, kubectlOptions, dnodePodName, 20, 15*time.Second)
217+
if err != nil {
218+
t.Error(err.Error())
219+
}
220+
if output != "Running" {
221+
t.Error(output)
222+
}
200223

201224
bootstrapHost := fmt.Sprintf("%s-0.%s.%s.svc.cluster.local", dnodeReleaseName, dnodeReleaseName, namespaceName)
202225
enodeOptions := &helm.Options{
@@ -217,23 +240,38 @@ func TestMultipleGroupChange(t *testing.T) {
217240
t.Logf("====Installing Helm Chart " + enodeReleaseName)
218241
enodePodName0 := testUtil.HelmInstall(t, enodeOptions, enodeReleaseName, kubectlOptions, helmChartPath)
219242

220-
// wait until the first enode pod is in Ready status
221-
k8s.WaitUntilPodAvailable(t, kubectlOptions, enodePodName0, 15, 20*time.Second)
243+
// wait until the pod is in Running status
244+
output, err = testUtil.WaitUntilPodRunning(t, kubectlOptions, enodePodName0, 20, 15*time.Second)
245+
if err != nil {
246+
t.Error(err.Error())
247+
}
248+
if output != "Running" {
249+
t.Error(output)
250+
}
222251

223252
newDnodeGroupName := "newDnode"
224253
newEnodeGroupName := "newEnode"
225254

226255
helmUpgradeOptionsDnode := &helm.Options{
227256
KubectlOptions: kubectlOptions,
228257
SetValues: map[string]string{
229-
"group.name": newDnodeGroupName,
258+
"image.repository": imageRepo,
259+
"image.tag": imageTag,
260+
"group.name": newDnodeGroupName,
230261
},
231262
}
232263
helm.Upgrade(t, helmUpgradeOptionsDnode, helmChartPath, dnodeReleaseName)
233264

234265
k8s.RunKubectl(t, kubectlOptions, "delete", "pod", dnodePodName)
235266

236-
k8s.WaitUntilPodAvailable(t, kubectlOptions, dnodePodName, 15, 20*time.Second)
267+
// wait until the pod is in Running status
268+
output, err = testUtil.WaitUntilPodRunning(t, kubectlOptions, dnodePodName, 20, 15*time.Second)
269+
if err != nil {
270+
t.Error(err.Error())
271+
}
272+
if output != "Running" {
273+
t.Error(output)
274+
}
237275

238276
tunnel := k8s.NewTunnel(
239277
kubectlOptions, k8s.ResourceTypePod, dnodePodName, 8002, 8002)
@@ -252,14 +290,23 @@ func TestMultipleGroupChange(t *testing.T) {
252290
helmUpgradeOptionsEnode := &helm.Options{
253291
KubectlOptions: kubectlOptions,
254292
SetValues: map[string]string{
255-
"group.name": newEnodeGroupName,
293+
"image.repository": imageRepo,
294+
"image.tag": imageTag,
295+
"group.name": newEnodeGroupName,
256296
},
257297
}
258298
helm.Upgrade(t, helmUpgradeOptionsEnode, helmChartPath, enodeReleaseName)
259299

260300
k8s.RunKubectl(t, kubectlOptions, "delete", "pod", enodePodName0)
261301

262-
k8s.WaitUntilPodAvailable(t, kubectlOptions, enodePodName0, 15, 20*time.Second)
302+
// wait until the pod is in Running status
303+
output, err = testUtil.WaitUntilPodRunning(t, kubectlOptions, enodePodName0, 20, 15*time.Second)
304+
if err != nil {
305+
t.Error(err.Error())
306+
}
307+
if output != "Running" {
308+
t.Error(output)
309+
}
263310

264311
// change the group name for dnode and verify it passes
265312
t.Logf("====Test updating group name for %s to %s", enodeGrpName, newEnodeGroupName)

test/e2e/scaling_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ func TestHelmScaleUp(t *testing.T) {
9090
SetValues: map[string]string{
9191
"persistence.enabled": "true",
9292
"replicaCount": "2",
93+
"image.repository": imageRepo,
94+
"image.tag": imageTag,
9395
"logCollection.enabled": "false",
9496
"auth.adminUsername": username,
9597
"auth.adminPassword": password,

test/testUtil/restart_pod.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func RestartPodAndVerify(t *testing.T, delAtOnce bool, podList []string, namespa
3232

3333
// wait until the pod is in Ready status and MarkLogic server is ready
3434
for _, pod := range podList {
35-
k8s.WaitUntilPodAvailable(t, kubectlOpt, pod, 15, 15*time.Second)
35+
k8s.WaitUntilPodAvailable(t, kubectlOpt, pod, 20, 15*time.Second)
3636
if strings.HasSuffix(pod, "-0") {
3737
_, err := MLReadyCheck(t, kubectlOpt, pod, tlsConfig)
3838
if err != nil {

0 commit comments

Comments
 (0)