@@ -20,14 +20,15 @@ import (
20
20
)
21
21
22
22
const (
23
- gcpMachineTemplateName = "gcp-machine-template"
24
- OnHostMaintenanceTerminate = "Terminate"
25
- OnHostMaintenanceMigrate = "Migrate"
23
+ gcpMachineTemplateNamePrefix = "gcp-machine-template- "
24
+ OnHostMaintenanceTerminate = "Terminate"
25
+ OnHostMaintenanceMigrate = "Migrate"
26
26
)
27
27
28
28
var (
29
- clusterName string
30
- cl client.Client
29
+ clusterName string
30
+ cl client.Client
31
+ gcpMachineTemplateName string
31
32
)
32
33
33
34
var _ = Describe ("Cluster API GCP MachineSet" , framework .LabelCAPI , framework .LabelDisruptive , Ordered , func () {
@@ -60,6 +61,11 @@ var _ = Describe("Cluster API GCP MachineSet", framework.LabelCAPI, framework.La
60
61
framework .CreateCoreCluster (ctx , cl , clusterName , "GCPCluster" )
61
62
mapiMachineSpec = getGCPMAPIProviderSpec (cl )
62
63
})
64
+
65
+ BeforeEach (func () {
66
+ gcpMachineTemplateName = fmt .Sprintf ("%s%s" , gcpMachineTemplateNamePrefix , framework .GenerateRandomString (6 ))
67
+ })
68
+
63
69
AfterEach (func () {
64
70
if platform != configv1 .GCPPlatformType {
65
71
// Because AfterEach always runs, even when tests are skipped, we have to
@@ -194,8 +200,15 @@ var _ = Describe("Cluster API GCP MachineSet", framework.LabelCAPI, framework.La
194
200
Namespace : framework .ClusterAPINamespace ,
195
201
Name : gcpMachineTemplateName ,
196
202
}, createdTemplate )).To (Succeed ())
197
- var confidentialComputevalue = * createdTemplate .Spec .Template .Spec .ConfidentialCompute
198
- Expect (fmt .Sprintf ("%v" , confidentialComputevalue )).To (Equal (fmt .Sprintf ("%v" , * confidentialCompute )))
203
+
204
+ var expectedConfidentialComputeValue string
205
+ if * confidentialCompute == gcpv1 .ConfidentialComputePolicyEnabled {
206
+ expectedConfidentialComputeValue = "Enabled"
207
+ } else {
208
+ expectedConfidentialComputeValue = "Disabled"
209
+ }
210
+
211
+ Expect (fmt .Sprintf ("%v" , expectedConfidentialComputeValue )).To (Equal (fmt .Sprintf ("%v" , * confidentialCompute )))
199
212
},
200
213
Entry ("Confidential Compute enabled" , & confidentialComputeEnabled ),
201
214
Entry ("Confidential Compute disabled" , & confidentialComputeDisabled ),
0 commit comments