From a074307a9eb673a07a831a499085e831ce627f1b Mon Sep 17 00:00:00 2001 From: Lukasz Szaszkiewicz Date: Tue, 28 Apr 2020 13:32:11 +0200 Subject: [PATCH] UPSTREAM: : this commit will be replaced by https://github.com/kubernetes/kubernetes/pull/90452 Origin-commit: 817b7762d70fc212af248c3509b4f42620405c27 --- test/e2e/apimachinery/crd_publish_openapi.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/e2e/apimachinery/crd_publish_openapi.go b/test/e2e/apimachinery/crd_publish_openapi.go index e8bdef1512478..fa610aba635eb 100644 --- a/test/e2e/apimachinery/crd_publish_openapi.go +++ b/test/e2e/apimachinery/crd_publish_openapi.go @@ -478,7 +478,13 @@ func setupCRD(f *framework.Framework, schema []byte, groupSuffix string, version return setupCRDAndVerifySchema(f, schema, expect, groupSuffix, versions...) } -func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, groupSuffix string, versions ...string) (*crd.TestCrd, error) { +func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, groupSuffix string, versions ...string) (tCRD *crd.TestCrd, err error) { + defer func() { + if err == nil { + framework.Logf("sleeping 45 seconds before running the actual tests, we hope that during all API servers converge during that window, see %q for more", "https://github.com/kubernetes/kubernetes/pull/90452") + time.Sleep(time.Second * 45) + } + }() group := fmt.Sprintf("%s-test-%s.example.com", f.BaseName, groupSuffix) if len(versions) == 0 { return nil, fmt.Errorf("require at least one version for CRD") @@ -491,7 +497,7 @@ func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, grou } } - crd, err := crd.CreateMultiVersionTestCRD(f, group, func(crd *apiextensionsv1.CustomResourceDefinition) { + tCRD, err = crd.CreateMultiVersionTestCRD(f, group, func(crd *apiextensionsv1.CustomResourceDefinition) { var apiVersions []apiextensionsv1.CustomResourceDefinitionVersion for i, version := range versions { version := apiextensionsv1.CustomResourceDefinitionVersion{ @@ -520,12 +526,12 @@ func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, grou return nil, fmt.Errorf("failed to create CRD: %v", err) } - for _, v := range crd.Crd.Spec.Versions { - if err := waitForDefinition(f.ClientSet, definitionName(crd, v.Name), expect); err != nil { + for _, v := range tCRD.Crd.Spec.Versions { + if err := waitForDefinition(f.ClientSet, definitionName(tCRD, v.Name), expect); err != nil { return nil, fmt.Errorf("%v", err) } } - return crd, nil + return tCRD, nil } func cleanupCRD(f *framework.Framework, crd *crd.TestCrd) error {