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