Organize framework unit tests in subtests

This commit is contained in:
drfish
2021-01-30 12:29:26 +08:00
parent 24f13032b3
commit 0c3d8b9720
8 changed files with 194 additions and 146 deletions

View File

@@ -281,10 +281,12 @@ func TestGetContainerPorts(t *testing.T) {
},
}
for _, test := range tests {
result := getContainerPorts(test.pod1, test.pod2)
if !reflect.DeepEqual(test.expected, result) {
t.Errorf("Got different result than expected.\nDifference detected on:\n%s", diff.ObjectGoPrintSideBySide(test.expected, result))
}
for i, test := range tests {
t.Run(fmt.Sprintf("case_%d", i), func(t *testing.T) {
result := getContainerPorts(test.pod1, test.pod2)
if !reflect.DeepEqual(test.expected, result) {
t.Errorf("Got different result than expected.\nDifference detected on:\n%s", diff.ObjectGoPrintSideBySide(test.expected, result))
}
})
}
}