-
-
Notifications
You must be signed in to change notification settings - Fork 296
Closed
Description
I am using the following code to ensure that list.Items[]
has exactly one element and that element has an empty Spec.Devices
:
emptySlice := gomega.HaveField("Spec.Devices", gomega.BeEmpty())
gomega.Eventually(ctx, listSlices).WithTimeout(time.Minute).Should(gomega.HaveField("Items", gomega.ContainElements(emptySlice)))
My code under test incorrectly deleted all items (= list.Items[]
empty). But the failure message then contained information about some previous item:
[FAILED] Timed out after 60.000s.
Value for field 'Items' failed to satisfy matcher.
Expected
<[]v1alpha3.ResourceSlice | len:0, cap:0>: nil
to contain elements
<[]*matchers.HaveFieldMatcher | len:1, cap:1>: [
{
Field: "Spec.Devices",
Expected:
{},
extractedField: <[]v1alpha3.Device | len:128, cap:170>[
{
Name: "dev-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0000",
Basic: {
Attributes: {
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.example.com/xxxxxxxxxxxxxxxxxxxxxxxxxxxx0010": {
IntValue: nil,
BoolValue: nil,
StringValue: "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv",
VersionValue: nil,
},
...
Gomega truncated this representation as it exceeds 'format.MaxLength'.
Consider having the object provide a custom 'GomegaStringer' representation
or adjust the parameters in Gomega's 'format' package.
Metadata
Metadata
Assignees
Labels
No labels