Change:
Improve the to ensure that the expected storage version for a resource is one understood by previous releases. We have API testdata from prior versions available in When checking each group/version/kind in the test: accumulate all the versions of the group/kind available in previous (non-HEAD) releases if there is a beta or stable version of the group/kind available in previous releases, then the storage version must be in the set of previously available versions It is too easy to accidentally change the storage version prematurely and edit the test/integration/etcd test to match the bug cc
There are no sig labels on this issue. Please add an appropriate label by using one of the following commands: - Please see the for a listing of the SIGs, working groups, and committees available. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details

Discussion:
func gvkP(g, v, k string) *schema.GroupVersionKind { return &schema.GroupVersionKind{Group: g, Version: v, Kind: k} } <ins> func gvk(g, v, k string) schema.GroupVersionKind { return schema.GroupVersionKind{Group: g, Version: v, Kind: k} } </ins>

"context" "encoding/json" "fmt" <ins> "path/filepath" </ins> "reflect" "strings" "testing"

// namespace used for all tests, do not change this const testNamespace = "etcdstoragepathtestnamespace" <ins> // allowMissingTestdataFixtures contains the kinds expected to be missing serialization fixtures API testdata directory. // this should only contain custom resources and built-in types with open issues tracking adding serialization fixtures. // Do not add new built-in types to this list, add them to k8s.io/api/roundtrip_test.go instead. var allowMissingTestdataFixtures = map[schema.GroupVersionKind]bool{ // TODO(https://github.com/kubernetes/kubernetes/issues/79027) gvk("apiregistration.k8s.io", "v1", "APIService"):     true, gvk("apiregistration.k8s.io", "v1beta", "APIService"): true, // TODO(https://github.com/kubernetes/kubernetes/issues/79026) gvk("apiextensions.k8s.io", "v1beta1", "CustomResourceDefinition"): true, gvk("apiextensions.k8s.io", "v1", "CustomResourceDefinition"):      true, // Custom resources are not expected to have serialization fixtures in k8s.io/api gvk("awesome.bears.com", "v1", "Panda"):    true, gvk("cr.bar.com", "v1", "Foo"):             true, gvk("random.numbers.com", "v1", "Integer"): true, gvk("custom.fancy.com", "v2", "Pant"):      true, } </ins> // TestEtcdStoragePath tests to make sure that all objects are stored in an expected location in etcd. // It will start failing when a new type is added to ensure that all future types are added to this test. // It will also fail when a type gets moved to a different location. Be very careful in this situation because

expectedGVK = *testData.ExpectedGVK } <ins> // if previous releases had a non-alpha version of this group/kind, make sure the storage version is understood by a previous release fixtureFilenameGroup := expectedGVK.Group if fixtureFilenameGroup == "" { fixtureFilenameGroup = "core" } // find all versions of this group/kind in all versions of the serialization fixture testdata previousReleaseGroupKindFiles, err := filepath.Glob("../../../staging/src/k8s.io/api/testdata/*/" + fixtureFilenameGroup + ".*." + expectedGVK.Kind + ".yaml") if err != nil { t.Error(err) } if len(previousReleaseGroupKindFiles) == 0 && !allowMissingTestdataFixtures[expectedGVK] { // We should at least find the HEAD fixtures t.Errorf("No testdata serialization files found for %#v, cannot determine if previous releases could read this group/kind. Add this group-version to k8s.io/api/roundtrip_test.go", expectedGVK) } // find non-alpha versions of this group/kind understood by previous releases previousNonAlphaVersions := sets.NewString() for _, previousReleaseGroupKindFile := range previousReleaseGroupKindFiles { if serverVersion := filepath.Base(filepath.Dir(previousReleaseGroupKindFile)); serverVersion == "HEAD" { continue } parts := strings.Split(filepath.Base(previousReleaseGroupKindFile), ".") version := parts[len(parts)-3] if !strings.Contains(version, "alpha") { previousNonAlphaVersions.Insert(version) } } if len(previousNonAlphaVersions) > 0 && !previousNonAlphaVersions.Has(expectedGVK.Version) { t.Errorf("Previous releases understand non-alpha versions %q, but do not understand the expected current storage version %q. "+ "This means a current server will store data in etcd that is not understood by a previous version.", previousNonAlphaVersions.List(), expectedGVK.Version, ) } </ins> actualGVK := output.getGVK() if actualGVK != expectedGVK { t.Errorf("GVK for %s does not match, expected %s got %s", kind, expectedGVK, actualGVK)

} } <ins> var debug = false </ins> func dumpEtcdKVOnFailure(t *testing.T, kvClient clientv3.KV) { <del> if t.Failed() { </del> <ins> if t.Failed() && debug { </ins> response, err := kvClient.Get(context.Background(), "/", clientv3.WithPrefix()) if err != nil { t.Fatal(err)

kubeClientConfig.QPS = 99999 kubeClientConfig.Burst = 9999 <ins> // we make requests to all resources, don't log warnings about deprecated ones restclient.SetDefaultWarningHandler(restclient.NoWarnings{}) </ins> kubeClient := clientset.NewForConfigOrDie(kubeClientConfig) go func() {