From c1381282a322bbe3397f4a44352e3d2dd4d464eb Mon Sep 17 00:00:00 2001 From: Igor Zibarev Date: Thu, 24 Oct 2019 22:58:01 +0300 Subject: [PATCH] kubeadm: remove commented test Removes commented test TestInitConfigurationMarshallingFromFile as requested per https://github.com/kubernetes/kubeadm/issues/1431 --- .../app/util/config/initconfiguration_test.go | 75 ------------------- 1 file changed, 75 deletions(-) diff --git a/cmd/kubeadm/app/util/config/initconfiguration_test.go b/cmd/kubeadm/app/util/config/initconfiguration_test.go index d71f291dc5e..9a46ea75478 100644 --- a/cmd/kubeadm/app/util/config/initconfiguration_test.go +++ b/cmd/kubeadm/app/util/config/initconfiguration_test.go @@ -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