use subtest for table units

employ consitent table var naming

  - https://github.com/kubernetes/kubernetes/pull/63659#discussion_r187736533
This commit is contained in:
John Calabrese
2018-05-10 07:07:26 -04:00
parent 4da73a5f3d
commit d1abc5c824
3 changed files with 30 additions and 20 deletions

View File

@@ -109,11 +109,13 @@ func TestGetControllerRef(t *testing.T) {
}
for _, td := range tds {
realOR := GetControllerRef(&td.pod)
if td.expectedNil {
assert.Nilf(t, realOR, "Failed to test: %s", td.name)
} else {
assert.Equalf(t, &td.expectedOR, realOR, "Failed to test: %s", td.name)
}
t.Run(td.name, func(t *testing.T) {
realOR := GetControllerRef(&td.pod)
if td.expectedNil {
assert.Nilf(t, realOR, "Failed to test: %s", td.name)
} else {
assert.Equalf(t, &td.expectedOR, realOR, "Failed to test: %s", td.name)
}
})
}
}