use subtest for table units (pkg/master)

This commit is contained in:
Guoliang Wang
2018-05-14 14:58:18 +08:00
parent e24fd8efb1
commit f15a0fc0da
4 changed files with 137 additions and 104 deletions

View File

@@ -189,18 +189,18 @@ func TestWriteClientCAs(t *testing.T) {
}
for _, test := range tests {
client := fake.NewSimpleClientset(test.preexistingObjs...)
test.hook.tryToWriteClientCAs(client.Core())
t.Run(test.name, func(t *testing.T) {
client := fake.NewSimpleClientset(test.preexistingObjs...)
test.hook.tryToWriteClientCAs(client.Core())
actualConfigMaps, updated := getFinalConfiMaps(client)
if !reflect.DeepEqual(test.expectedConfigMaps, actualConfigMaps) {
t.Errorf("%s: %v", test.name, diff.ObjectReflectDiff(test.expectedConfigMaps, actualConfigMaps))
continue
}
if test.expectUpdate != updated {
t.Errorf("%s: expected %v, got %v", test.name, test.expectUpdate, updated)
continue
}
actualConfigMaps, updated := getFinalConfiMaps(client)
if !reflect.DeepEqual(test.expectedConfigMaps, actualConfigMaps) {
t.Fatalf("%s: %v", test.name, diff.ObjectReflectDiff(test.expectedConfigMaps, actualConfigMaps))
}
if test.expectUpdate != updated {
t.Fatalf("%s: expected %v, got %v", test.name, test.expectUpdate, updated)
}
})
}
}