Use t.Run for /pkg/cri tests
A majority of the tests in /pkg/cri are testing/validating multiple things per test (generally spec or options validations). This flow lends itself well to using *testing.T's Run method to run each thing as a subtest so `go test` output can actually display which subtest failed/passed. Some of the tests in the packages in pkg/cri already did this, but a bunch simply logged what sub-testcase was currently running without invoking t.Run. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
This commit is contained in:
@@ -73,12 +73,13 @@ func TestNormalizeImageRef(t *testing.T) {
|
||||
expect: "gcr.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582",
|
||||
},
|
||||
} {
|
||||
t.Logf("TestCase %q", test.input)
|
||||
normalized, err := NormalizeImageRef(test.input)
|
||||
assert.NoError(t, err)
|
||||
output := normalized.String()
|
||||
assert.Equal(t, test.expect, output)
|
||||
_, err = reference.Parse(output)
|
||||
assert.NoError(t, err, "%q should be containerd supported reference", output)
|
||||
t.Run(test.input, func(t *testing.T) {
|
||||
normalized, err := NormalizeImageRef(test.input)
|
||||
assert.NoError(t, err)
|
||||
output := normalized.String()
|
||||
assert.Equal(t, test.expect, output)
|
||||
_, err = reference.Parse(output)
|
||||
assert.NoError(t, err, "%q should be containerd supported reference", output)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user