Skip to content

Commit

Permalink
Add t.Run for better tests visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
arybolovlev committed Nov 29, 2023
1 parent f550b98 commit 0f0aed8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions kubernetes/structures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ func TestFlattenMetadataFields(t *testing.T) {
}},
},
}
for _, c := range cases {
out := flattenMetadataFields(c.meta)
if !reflect.DeepEqual(out, c.expected) {
t.Fatalf("Error matching output and expected: %#v vs %#v", out, c.expected)
}
for n, c := range cases {
t.Run(n, func(t *testing.T) {
out := flattenMetadataFields(c.meta)
if !reflect.DeepEqual(out, c.expected) {
t.Fatalf("Error matching output and expected: %#v vs %#v", out, c.expected)
}
})
}
}

Expand Down Expand Up @@ -280,10 +282,12 @@ func TestFlattenMetadata(t *testing.T) {
}},
}
d := schema.TestResourceDataRaw(t, map[string]*schema.Schema{"metadata": namespacedMetadataSchema("fake", true)}, rawData)
for _, c := range cases {
out := flattenMetadata(c.meta, d, c.providerMeta)
if !reflect.DeepEqual(out, c.expected) {
t.Fatalf("Error matching output and expected: %#v vs %#v", out, c.expected)
}
for n, c := range cases {
t.Run(n, func(t *testing.T) {
out := flattenMetadata(c.meta, d, c.providerMeta)
if !reflect.DeepEqual(out, c.expected) {
t.Fatalf("Error matching output and expected: %#v vs %#v", out, c.expected)
}
})
}
}

0 comments on commit 0f0aed8

Please sign in to comment.