Skip to content

Commit 1d66edd

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 79ca17f commit 1d66edd

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
@@ -522,7 +522,13 @@ func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, grou
522522
return setupCRDAndVerifySchemaWithOptions(f, schema, expect, groupSuffix, versions)
523523
}
524524

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

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

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

0 commit comments

Comments
 (0)