Skip to content

Commit d31fd4c

Browse files
committed
revert node quantity check removal
1 parent 086138b commit d31fd4c

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

test/service/service_suite_test.go

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ var _ = Describe("Cluster create/delete flow", Ordered, func() {
157157
Labels: &map[string]string{},
158158
}
159159

160+
// Unpause cluster to simulate cluster-agent behaviour
161+
patchData := []byte(`{"spec":{"paused":false}}`)
162+
cmd := exec.Command("kubectl", "-n", testTenantID.String(), "patch", "cl", clusterName, "--type=merge", "-p", string(patchData))
163+
err := cmd.Run()
164+
Expect(err).ToNot(HaveOccurred())
165+
160166
// it takes some time for template to be created in the tenant namespace so we retry the request until it succeeds with a 10 second timeout
161167
Eventually(func() (int, error) {
162168
resp, err := cli.PostV2ClustersWithResponse(context.Background(), &params, body)
@@ -188,16 +194,16 @@ var _ = Describe("Cluster create/delete flow", Ordered, func() {
188194
fmt.Printf("unexpected number of clusters: %d\n", resp.JSON200.TotalElements)
189195
return false, fmt.Errorf("unexpected number of clusters: %d", resp.JSON200.TotalElements)
190196
}
191-
// if *(*resp.JSON200.Clusters)[0].NodeQuantity != 1 {
192-
// return false, fmt.Errorf("unexpected number of nodes: %d", *(*resp.JSON200.Clusters)[0].NodeQuantity)
193-
// }
194-
//
197+
if *(*resp.JSON200.Clusters)[0].NodeQuantity != 1 {
198+
return false, fmt.Errorf("unexpected number of nodes: %d", *(*resp.JSON200.Clusters)[0].NodeQuantity)
199+
}
200+
195201
return true, nil
196202
}, 30*time.Second, 3*time.Second).Should(Equal(true))
197203

198204
Expect(*resp.JSON200.Clusters).To(HaveLen(1))
199205
Expect(*(*resp.JSON200.Clusters)[0].Name).To(Equal(clusterName))
200-
//Expect(*(*resp.JSON200.Clusters)[0].NodeQuantity).To(Equal(1))
206+
Expect(*(*resp.JSON200.Clusters)[0].NodeQuantity).To(Equal(1))
201207
})
202208

203209
// Annotate the DockerMachines with the host-id label to simulate the intel-capi-provider behaviour
@@ -228,14 +234,14 @@ var _ = Describe("Cluster create/delete flow", Ordered, func() {
228234
Expect(*resp.JSON200.Labels).To(HaveLen(2))
229235
Expect(*resp.JSON200.Labels).To(HaveKeyWithValue("app", "wordpress"))
230236
Expect(*resp.JSON200.Labels).To(HaveKeyWithValue("default-extension", "baseline"))
231-
//Expect(*resp.JSON200.Nodes).To(HaveLen(1))
232-
//nodes := *resp.JSON200.Nodes
233-
//Expect(*nodes[0].Role).To(Equal("all"))
234-
//Expect(*nodes[0].Id).To(Equal(hostIdAnnotationVal))
235-
//Expect(*nodes[0].Status.Condition).To(Equal(api.STATUSCONDITIONPROVISIONING))
236-
//Expect(*nodes[0].Status.Reason).To(Equal("Provisioning"))
237-
//Expect(*nodes[0].Status.Timestamp).ToNot(BeNil())
238-
//Expect(*resp.JSON200.Template).To(Equal(templateName))
237+
Expect(*resp.JSON200.Nodes).To(HaveLen(1))
238+
nodes := *resp.JSON200.Nodes
239+
Expect(*nodes[0].Role).To(Equal("all"))
240+
Expect(*nodes[0].Id).To(Equal(hostIdAnnotationVal))
241+
Expect(*nodes[0].Status.Condition).To(Equal(api.STATUSCONDITIONPROVISIONING))
242+
Expect(*nodes[0].Status.Reason).To(Equal("Provisioning"))
243+
Expect(*nodes[0].Status.Timestamp).ToNot(BeNil())
244+
Expect(*resp.JSON200.Template).To(Equal(templateName))
239245

240246
err = containsLabels(testTenantID.String(), clusterName, []string{
241247
"app:wordpress",

0 commit comments

Comments
 (0)