tests: create-cluster integration tests should validate additional objects

As we start creating them for addon support, we want to be sure that
they aren't created elsewhere.
This commit is contained in:
justinsb 2021-09-06 14:43:35 -04:00
parent 89a9a4a1aa
commit 153cf97049
1 changed files with 19 additions and 0 deletions

View File

@ -260,6 +260,25 @@ func runCreateClusterIntegrationTest(t *testing.T, srcDir string, version string
yamlAll = append(yamlAll, actualYAML)
}
// Compare additional objects
addons, err := clientset.AddonsFor(&clusters.Items[0]).List()
if err != nil {
t.Fatalf("error listing addons: %v", err)
}
for _, addon := range addons {
u := addon.ToUnstructured()
actualYAMLBytes, err := kopscodecs.ToVersionedYamlWithVersion(u, schema.GroupVersion{Group: "kops.k8s.io", Version: version})
if err != nil {
t.Fatalf("unexpected error serializing Addon: %v", err)
}
actualYAML := strings.TrimSpace(string(actualYAMLBytes))
yamlAll = append(yamlAll, actualYAML)
}
actualYAML := strings.Join(yamlAll, "\n\n---\n\n")
golden.AssertMatchesFile(t, actualYAML, path.Join(srcDir, expectedClusterPath))
}