Skip to content

Commit b44bee7

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 07eb239 commit b44bee7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

test/e2e/apimachinery/crd_publish_openapi.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,13 @@ func setupCRDAndVerifySchema(f *framework.Framework, schema, expect []byte, grou
521521
return setupCRDAndVerifySchemaWithOptions(f, schema, expect, groupSuffix, versions)
522522
}
523523

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

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

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

0 commit comments

Comments
 (0)