Skip to content

Commit

Permalink
Add a flag for app container name and retry verifyTrafficMirror (isti…
Browse files Browse the repository at this point in the history
…o#40053)

For some workloads the container name is different and the logs can be slower. So the verification of mirroring test cases is retried for 20 seconds.
  • Loading branch information
akshayjnambiar committed Jul 22, 2022
1 parent 212fc64 commit d3b1687
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions pkg/test/framework/components/echo/kube/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var (
serviceTemplateFile = "service.yaml"
deploymentTemplateFile = "deployment.yaml"
vmDeploymentTemplateFile = "vm_deployment.yaml"

appContainerName = "app"
)

func init() {
Expand All @@ -32,4 +34,6 @@ func init() {
flag.StringVar(&vmDeploymentTemplateFile, "istio.test.echo.kube.template.deployment.vm", vmDeploymentTemplateFile,
"Specifies the default template file to be used when generating the Kubernetes Deployment to simulate an instance of echo application in a VM. "+
"Can be either an absolute path or relative to the templates directory under the echo test component. A default will be selected if not specified.")
flag.StringVar(&appContainerName, "istio.test.echo.kube.container", appContainerName,
"Specifies the default container name to be used for the echo application. A default will be selected if not specified.")
}
4 changes: 0 additions & 4 deletions pkg/test/framework/components/echo/kube/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ import (
"istio.io/istio/pkg/test/util/retry"
)

const (
appContainerName = "app"
)

var _ echo.Workload = &workload{}

type workloadConfig struct {
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/pilot/mirror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"math"
"strings"
"testing"
"time"

"github.com/hashicorp/go-multierror"
"k8s.io/apimachinery/pkg/util/rand"
Expand Down Expand Up @@ -155,9 +156,10 @@ func runMirrorTest(t *testing.T, options mirrorTestOptions) {
if expected == nil {
expected = apps.C
}

return verifyTrafficMirror(apps.B, expected, c, testID)
}, echo.DefaultCallRetryOptions()...)
return retry.UntilSuccess(func() error {
return verifyTrafficMirror(apps.B, expected, c, testID)
}, []retry.Option{retry.Timeout(20 * time.Second), retry.BackoffDelay(10 * time.Millisecond), retry.Converge(2)}...)
}, []retry.Option{retry.Timeout(60 * time.Second), retry.BackoffDelay(10 * time.Millisecond), retry.Converge(2)}...)
})
}
})
Expand Down

0 comments on commit d3b1687

Please sign in to comment.