Merge pull request #84309 from hypnoglow/remove-test

kubeadm: remove commented test
This commit is contained in:
Kubernetes Prow Robot 2019-10-25 13:03:51 -07:00 committed by GitHub
commit 46b33af8ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,81 +123,6 @@ func TestLoadInitConfigurationFromFile(t *testing.T) {
}
}
/*
func TestInitConfigurationMarshallingFromFile(t *testing.T) {
controlPlaneV1beta1YAMLAbstracted := controlPlaneV1beta1YAML
controlPlaneInternalYAMLAbstracted := controlPlaneInternalYAML
controlPlaneDefaultedYAMLAbstracted := controlPlaneDefaultedYAML
if runtime.GOOS != "linux" {
controlPlaneV1beta1YAMLAbstracted = controlPlaneV1beta1YAMLNonLinux
controlPlaneInternalYAMLAbstracted = controlPlaneInternalYAMLNonLinux
controlPlaneDefaultedYAMLAbstracted = controlPlaneDefaultedYAMLNonLinux
}
var tests = []struct {
name, in, out string
groupVersion schema.GroupVersion
expectedErr bool
}{
// These tests are reading one file, loading it using LoadInitConfigurationFromFile that all of kubeadm is using for unmarshal of our API types,
// and then marshals the internal object to the expected groupVersion
//{ // v1beta1 -> internal NB. test commented after changes required for upgrading to go v1.12
// name: "v1beta1ToInternal",
// in: controlPlaneV1beta1YAMLAbstracted,
// out: controlPlaneInternalYAMLAbstracted,
// groupVersion: kubeadm.SchemeGroupVersion,
//},
{ // v1beta1 -> internal -> v1beta1
name: "v1beta1Tov1beta1",
in: controlPlaneV1beta1YAMLAbstracted,
out: controlPlaneV1beta1YAMLAbstracted,
groupVersion: kubeadmapiv1beta1.SchemeGroupVersion,
},
// These tests are reading one file that has only a subset of the fields populated, loading it using LoadInitConfigurationFromFile,
// and then marshals the internal object to the expected groupVersion
{ // v1beta1 -> default -> validate -> internal -> v1beta1
name: "incompleteYAMLToDefaultedv1beta1",
in: controlPlaneIncompleteYAML,
out: controlPlaneDefaultedYAMLAbstracted,
groupVersion: kubeadmapiv1beta1.SchemeGroupVersion,
},
{ // v1beta1 -> validation should fail
name: "invalidYAMLShouldFail",
in: controlPlaneInvalidYAML,
expectedErr: true,
},
}
for _, rt := range tests {
t.Run(rt.name, func(t2 *testing.T) {
internalcfg, err := LoadInitConfigurationFromFile(rt.in)
if err != nil {
if rt.expectedErr {
return
}
t2.Fatalf("couldn't unmarshal test data: %v", err)
}
actual, err := MarshalInitConfigurationToBytes(internalcfg, rt.groupVersion)
if err != nil {
t2.Fatalf("couldn't marshal internal object: %v", err)
}
expected, err := ioutil.ReadFile(rt.out)
if err != nil {
t2.Fatalf("couldn't read test data: %v", err)
}
if !bytes.Equal(expected, actual) {
t2.Errorf("the expected and actual output differs.\n\tin: %s\n\tout: %s\n\tgroupversion: %s\n\tdiff: \n%s\n",
rt.in, rt.out, rt.groupVersion.String(), diff(expected, actual))
}
})
}
}
*/
func TestDefaultTaintsMarshaling(t *testing.T) {
tests := []struct {
desc string