mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Add a haveKeys() helper function to match multiple keys
Signed-off-by: Itamar Holder <iholder@redhat.com>
This commit is contained in:
parent
90c362b343
commit
81abfca407
@ -165,3 +165,18 @@ func boundedSample(lower, upper interface{}) types.GomegaMatcher {
|
|||||||
"Histogram": gstruct.Ignore(),
|
"Histogram": gstruct.Ignore(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func haveKeys(keys ...string) types.GomegaMatcher {
|
||||||
|
gomega.ExpectWithOffset(1, keys).ToNot(gomega.BeEmpty())
|
||||||
|
matcher := gomega.HaveKey(keys[0])
|
||||||
|
|
||||||
|
if len(keys) == 1 {
|
||||||
|
return matcher
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, key := range keys[1:] {
|
||||||
|
matcher = gomega.And(matcher, gomega.HaveKey(key))
|
||||||
|
}
|
||||||
|
|
||||||
|
return matcher
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user