@@ -33,14 +33,48 @@ func TestGeneratePatches(
33
33
Name : "unset variable" ,
34
34
},
35
35
capitest.PatchTestDef {
36
- Name : "all fields set" ,
36
+ Name : "all required fields set" ,
37
37
Vars : []runtimehooksv1.Variable {
38
38
capitest .VariableWithValue (
39
39
variableName ,
40
40
v1alpha1.NutanixPrismCentralEndpointSpec {
41
41
Host : "prism-central.nutanix.com" ,
42
42
Port : 9441 ,
43
- Insecure : false ,
43
+ Insecure : true ,
44
+ Credentials : corev1.LocalObjectReference {
45
+ Name : "credentials" ,
46
+ },
47
+ },
48
+ variablePath ... ,
49
+ ),
50
+ },
51
+ RequestItem : request .NewNutanixClusterTemplateRequestItem ("" ),
52
+ ExpectedPatchMatchers : []capitest.JSONPatchMatcher {
53
+ {
54
+ Operation : "replace" ,
55
+ Path : "/spec/template/spec/prismCentral" ,
56
+ ValueMatcher : gomega .SatisfyAll (
57
+ gomega .HaveKeyWithValue (
58
+ "address" ,
59
+ gomega .BeEquivalentTo ("prism-central.nutanix.com" ),
60
+ ),
61
+ gomega .HaveKeyWithValue ("port" , gomega .BeEquivalentTo (9441 )),
62
+ gomega .HaveKeyWithValue ("insecure" , true ),
63
+ gomega .HaveKey ("credentialRef" ),
64
+ gomega .Not (gomega .HaveKey ("additionalTrustBundle" )),
65
+ ),
66
+ },
67
+ },
68
+ },
69
+ capitest.PatchTestDef {
70
+ Name : "additional trust bundle is set" ,
71
+ Vars : []runtimehooksv1.Variable {
72
+ capitest .VariableWithValue (
73
+ variableName ,
74
+ v1alpha1.NutanixPrismCentralEndpointSpec {
75
+ Host : "prism-central.nutanix.com" ,
76
+ Port : 9441 ,
77
+ Insecure : true ,
44
78
Credentials : corev1.LocalObjectReference {
45
79
Name : "credentials" ,
46
80
},
@@ -60,6 +94,7 @@ func TestGeneratePatches(
60
94
gomega .BeEquivalentTo ("prism-central.nutanix.com" ),
61
95
),
62
96
gomega .HaveKeyWithValue ("port" , gomega .BeEquivalentTo (9441 )),
97
+ // Assert the insecure field was set to false as the additional trust bundle is set
63
98
gomega .HaveKeyWithValue ("insecure" , false ),
64
99
gomega .HaveKey ("credentialRef" ),
65
100
gomega .HaveKey ("additionalTrustBundle" ),
0 commit comments