Merge pull request #86319 from Huang-Wei/fluffout-sched-tests

Fix up the sub-test style
This commit is contained in:
Kubernetes Prow Robot
2019-12-17 04:20:32 -08:00
committed by GitHub
2 changed files with 49 additions and 39 deletions

View File

@@ -202,18 +202,21 @@ func TestImageLocalityPriority(t *testing.T) {
func TestNormalizedImageName(t *testing.T) {
for _, testCase := range []struct {
Name string
Input string
Output string
}{
{Input: "root", Output: "root:latest"},
{Input: "root:tag", Output: "root:tag"},
{Input: "gcr.io:5000/root", Output: "gcr.io:5000/root:latest"},
{Input: "root@" + getImageFakeDigest("root"), Output: "root@" + getImageFakeDigest("root")},
{Name: "add :latest postfix 1", Input: "root", Output: "root:latest"},
{Name: "add :latest postfix 2", Input: "gcr.io:5000/root", Output: "gcr.io:5000/root:latest"},
{Name: "keep it as is 1", Input: "root:tag", Output: "root:tag"},
{Name: "keep it as is 2", Input: "root@" + getImageFakeDigest("root"), Output: "root@" + getImageFakeDigest("root")},
} {
image := normalizedImageName(testCase.Input)
if image != testCase.Output {
t.Errorf("expected image reference: %q, got %q", testCase.Output, image)
}
t.Run(testCase.Name, func(t *testing.T) {
image := normalizedImageName(testCase.Input)
if image != testCase.Output {
t.Errorf("expected image reference: %q, got %q", testCase.Output, image)
}
})
}
}