Skip to content

Commit

Permalink
Merge pull request kubernetes#24924 from p0lyn0mial/releae-4-4-tmp-fi…
Browse files Browse the repository at this point in the history
…x-crd-publishing-tests

Bug 1828790: provides a temporal fix to improve CRD publishing e2e tests in an HA setup

Origin-commit: 19c011f7e9efb69c6dd0ac25c81fa64ab2aad92c
  • Loading branch information
k8s-publishing-bot committed May 14, 2020
2 parents d385b30 + a074307 commit 2bec654
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/e2e/apimachinery/crd_publish_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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{
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2bec654

Please sign in to comment.