Skip to content

Commit 8387305

Browse files
fix(test): update the patches for machinedetails test
1 parent 6d0e4e6 commit 8387305

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

pkg/handlers/nutanix/mutation/machinedetails/inject_control_plane_test.go

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,19 @@ var (
8686
},
8787
}
8888
matchersForAllImageTemplating = []capitest.JSONPatchMatcher{
89-
// boot type
9089
{
9190
Operation: "add",
9291
Path: "/spec/template/spec/bootType",
9392
ValueMatcher: gomega.BeEquivalentTo(capxv1.NutanixBootTypeLegacy),
9493
},
95-
// cluster
9694
{
97-
Operation: "add",
98-
Path: "/spec/template/spec/cluster/name",
99-
ValueMatcher: gomega.BeEquivalentTo("fake-pe-cluster"),
95+
Operation: "add",
96+
Path: "/spec/template/spec/cluster",
97+
ValueMatcher: gomega.SatisfyAll(
98+
gomega.HaveKeyWithValue("type", gomega.BeEquivalentTo(capxv1.NutanixIdentifierName)),
99+
gomega.HaveKeyWithValue("name", gomega.BeEquivalentTo("fake-pe-cluster")),
100+
),
100101
},
101-
{
102-
Operation: "replace",
103-
Path: "/spec/template/spec/cluster/type",
104-
ValueMatcher: gomega.BeEquivalentTo(capxv1.NutanixIdentifierName),
105-
},
106-
107102
{
108103
Operation: "replace",
109104
Path: "/spec/template/spec/vcpuSockets",
@@ -125,9 +120,14 @@ var (
125120
ValueMatcher: gomega.BeEquivalentTo("40Gi"),
126121
},
127122
{
128-
Operation: "replace",
129-
Path: "/spec/template/spec/subnet",
130-
ValueMatcher: gomega.HaveLen(1),
123+
Operation: "add",
124+
Path: "/spec/template/spec/subnet",
125+
ValueMatcher: gomega.ContainElement(
126+
gomega.SatisfyAll(
127+
gomega.HaveKeyWithValue("type", gomega.BeEquivalentTo(capxv1.NutanixIdentifierName)),
128+
gomega.HaveKeyWithValue("name", gomega.BeEquivalentTo("fake-subnet")),
129+
),
130+
),
131131
},
132132
{
133133
Operation: "add",
@@ -159,14 +159,12 @@ var (
159159
ValueMatcher: gomega.BeEquivalentTo(capxv1.NutanixBootTypeLegacy),
160160
},
161161
{
162-
Operation: "add",
163-
Path: "/spec/template/spec/cluster/name",
164-
ValueMatcher: gomega.BeEquivalentTo("fake-pe-cluster"),
165-
},
166-
{
167-
Operation: "replace",
168-
Path: "/spec/template/spec/cluster/type",
169-
ValueMatcher: gomega.BeEquivalentTo(capxv1.NutanixIdentifierName),
162+
Operation: "add",
163+
Path: "/spec/template/spec/cluster",
164+
ValueMatcher: gomega.SatisfyAll(
165+
gomega.HaveKeyWithValue("type", gomega.BeEquivalentTo(capxv1.NutanixIdentifierName)),
166+
gomega.HaveKeyWithValue("name", gomega.BeEquivalentTo("fake-pe-cluster")),
167+
),
170168
},
171169
{
172170
Operation: "replace",
@@ -189,9 +187,14 @@ var (
189187
ValueMatcher: gomega.BeEquivalentTo("40Gi"),
190188
},
191189
{
192-
Operation: "replace",
193-
Path: "/spec/template/spec/subnet",
194-
ValueMatcher: gomega.HaveLen(1),
190+
Operation: "add",
191+
Path: "/spec/template/spec/subnet",
192+
ValueMatcher: gomega.ContainElement(
193+
gomega.SatisfyAll(
194+
gomega.HaveKeyWithValue("type", gomega.BeEquivalentTo(capxv1.NutanixIdentifierName)),
195+
gomega.HaveKeyWithValue("name", gomega.BeEquivalentTo("fake-subnet")),
196+
),
197+
),
195198
},
196199
{
197200
Operation: "add",

0 commit comments

Comments
 (0)