Skip to content

Commit

Permalink
Fix flakyness of servicemesh integration tests
Browse files Browse the repository at this point in the history
The cluster needs a few time to settle after creation of CRD's.
  • Loading branch information
jwendell committed Nov 14, 2022
1 parent ee9edc3 commit cf2c81c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 0 additions & 3 deletions tests/integration/servicemesh/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"istio.io/istio/pkg/test/framework"
"istio.io/istio/pkg/test/framework/components/istio"
"istio.io/istio/tests/integration/servicemesh/maistra"
"istio.io/istio/tests/integration/servicemesh/router"
)

var i istio.Instance
Expand All @@ -33,8 +32,6 @@ func TestMain(m *testing.M) {
// nolint: staticcheck
framework.
NewSuite(m).
RequireMaxClusters(1).
Setup(router.InstallOpenShiftRouter).
Setup(maistra.ApplyServiceMeshCRDs).
Setup(istio.Setup(&i, nil)).
Setup(maistra.Install).
Expand Down
10 changes: 9 additions & 1 deletion tests/integration/servicemesh/maistra/maistra.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@ import (
"istio.io/istio/pkg/test/framework"
"istio.io/istio/pkg/test/framework/components/cluster"
"istio.io/istio/pkg/test/framework/resource"
"istio.io/istio/pkg/test/scopes"
"istio.io/istio/pkg/test/util/retry"
)

func ApplyServiceMeshCRDs(ctx resource.Context) (err error) {
scopes.Framework.Infof("=== Applying Maistra CRD's")
crds, err := manifests.GetManifestsByName()
if err != nil {
return fmt.Errorf("cannot read maistra CRD YAMLs: %s", err)
}
scopes.Framework.Infof("=== Got %d Maistra CRD's", len(crds))

for _, c := range ctx.Clusters().Kube().Primaries() {
for _, crd := range crds {
for name, crd := range crds {
scopes.Framework.Infof("=== Applying Maistra CRD %q", name)
// we need to manually Create() the CRD because Apply() wants to write its content into an annotation which fails because of size limitations
rawJSON, err := yaml.YAMLToJSON(crd)
if err != nil {
Expand All @@ -66,6 +71,9 @@ func ApplyServiceMeshCRDs(ctx resource.Context) (err error) {
}
}
}

scopes.Framework.Infof("=== Waiting 10s after applying Maistra CRD's")
time.Sleep(time.Second * 10)
return err
}

Expand Down

0 comments on commit cf2c81c

Please sign in to comment.