Skip to content

Commit e55bf19

Browse files
authored
tests: Fix error for when a VM unable to deploy (#203)
1 parent 4f180b8 commit e55bf19

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

test/e2e/invalid_resource.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ import (
4040
)
4141

4242
var (
43-
specName = "invalid-resource"
44-
input CommonSpecInput
45-
namespace *corev1.Namespace
46-
cancelWatches context.CancelFunc
47-
clusterResources *clusterctl.ApplyClusterTemplateAndWaitResult
43+
specName = "invalid-resource"
44+
input CommonSpecInput
45+
namespace *corev1.Namespace
46+
cancelWatches context.CancelFunc
47+
clusterResources *clusterctl.ApplyClusterTemplateAndWaitResult
48+
instanceStateError = "\"instanceState\":\"Error\""
4849
)
4950

5051
// InvalidResourceSpec implements a test that verifies that creating a new cluster fails when the specified resource does not exist
@@ -89,7 +90,7 @@ func InvalidResourceSpec(ctx context.Context, inputGetter func() CommonSpecInput
8990
})
9091

9192
It("Should fail due to the compute resources are not sufficient for the specified offering [TC8]", func() {
92-
testInvalidResource(ctx, input, "insufficient-compute-resources", "Unable to create a deployment for VM")
93+
testInvalidResource(ctx, input, "insufficient-compute-resources", instanceStateError)
9394
})
9495

9596
It("Should fail due to the specified disk offer is not customized but the disk size is specified", func() {
@@ -134,8 +135,7 @@ func InvalidResourceSpec(ctx context.Context, inputGetter func() CommonSpecInput
134135

135136
It("Should fail to upgrade worker machine due to insufficient compute resources", func() {
136137
By("Making sure the expected error didn't occur yet")
137-
expectedError := "Unable to create a deployment for VM"
138-
Expect(errorExistsInLog(logFolder, expectedError)).To(BeFalse())
138+
Expect(errorExistsInLog(logFolder, instanceStateError)).To(BeFalse())
139139

140140
By("Increasing the machine deployment instance size")
141141
deployment := clusterResources.MachineDeployments[0]
@@ -144,13 +144,12 @@ func InvalidResourceSpec(ctx context.Context, inputGetter func() CommonSpecInput
144144
upgradeMachineDeploymentInfrastructureRef(ctx, deployment)
145145

146146
By("Checking for the expected error")
147-
waitForErrorInLog(logFolder, expectedError)
147+
waitForErrorInLog(logFolder, instanceStateError)
148148
})
149149

150150
It("Should fail to upgrade control plane machine due to insufficient compute resources", func() {
151151
By("Making sure the expected error didn't occur yet")
152-
expectedError := "Unable to create a deployment for VM"
153-
Expect(errorExistsInLog(logFolder, expectedError)).To(BeFalse())
152+
Expect(errorExistsInLog(logFolder, instanceStateError)).To(BeFalse())
154153

155154
By("Increasing the machine deployment instance size")
156155
cp := clusterResources.ControlPlane
@@ -159,7 +158,7 @@ func InvalidResourceSpec(ctx context.Context, inputGetter func() CommonSpecInput
159158
upgradeControlPlaneInfrastructureRef(ctx, cp)
160159

161160
By("Checking for the expected error")
162-
waitForErrorInLog(logFolder, expectedError)
161+
waitForErrorInLog(logFolder, instanceStateError)
163162
})
164163
})
165164

0 commit comments

Comments
 (0)