Skip to content

Commit 43932c2

Browse files
p0lyn0mialbertinatto
authored andcommitted
UPSTREAM: <carry>: refactor/improve CRD publishing e2e tests in an HA setup
UPSTREAM: <carry>: refactor/improve CRD publishing e2e tests in an HA setup OpenShift-Rebase-Source: 51aeef3 OpenShift-Rebase-Source: 7fbb6a4
1 parent e651c3e commit 43932c2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

test/e2e/apimachinery/crd_publish_openapi.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,13 @@ func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, grou
523523
return setupCRDAndVerifySchemaWithOptions(f, schema, expect, groupSuffix, versions)
524524
}
525525

526-
func setupCRDAndVerifySchemaWithOptions(f *framework.Framework, schema, expect []byte, groupSuffix string, versions []string, options ...crd.Option) (*crd.TestCrd, error) {
526+
func setupCRDAndVerifySchemaWithOptions(f *framework.Framework, schema, expect []byte, groupSuffix string, versions []string, options ...crd.Option) (tCRD *crd.TestCrd, err error) {
527+
defer func() {
528+
if err != nil {
529+
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")
530+
time.Sleep(time.Second * 45)
531+
}
532+
}()
527533
group := fmt.Sprintf("%s-test-%s.example.com", f.BaseName, groupSuffix)
528534
if len(versions) == 0 {
529535
return nil, fmt.Errorf("require at least one version for CRD")
@@ -561,17 +567,17 @@ func setupCRDAndVerifySchemaWithOptions(f *framework.Framework, schema, expect [
561567
}
562568
crd.Spec.Versions = apiVersions
563569
})
564-
crd, err := crd.CreateMultiVersionTestCRD(f, group, options...)
570+
tCRD, err = crd.CreateMultiVersionTestCRD(f, group, options...)
565571
if err != nil {
566572
return nil, fmt.Errorf("failed to create CRD: %w", err)
567573
}
568574

569-
for _, v := range crd.Crd.Spec.Versions {
570-
if err := waitForDefinition(f.ClientSet, definitionName(crd, v.Name), expect); err != nil {
575+
for _, v := range tCRD.Crd.Spec.Versions {
576+
if err := waitForDefinition(f.ClientSet, definitionName(tCRD, v.Name), expect); err != nil {
571577
return nil, fmt.Errorf("%v", err)
572578
}
573579
}
574-
return crd, nil
580+
return tCRD, nil
575581
}
576582

577583
func cleanupCRD(ctx context.Context, f *framework.Framework, crd *crd.TestCrd) error {

0 commit comments

Comments
 (0)