Skip to content

Commit

Permalink
Fix last flaky terratest
Browse files Browse the repository at this point in the history
* Do not fail immediately on 503
* Fixes k8gb-io#1345

Signed-off-by: Yury Tsarev <yury@upbound.io>
  • Loading branch information
ytsarev committed Dec 31, 2023
1 parent 572a192 commit f250677
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions terratest/utils/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
import (
"encoding/json"
"fmt"
"github.com/gruntwork-io/terratest/modules/retry"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/retry"

"github.com/AbsaOSS/gopkg/dns"
gopkgstr "github.com/AbsaOSS/gopkg/string"
"github.com/gruntwork-io/terratest/modules/helm"
Expand Down Expand Up @@ -432,8 +433,11 @@ func (i *Instance) HitTestApp() (result *TestAppResult) {
result = new(TestAppResult)
coreDNSIP := i.GetCoreDNSIP()
command := []string{"sh", "-c", fmt.Sprintf("wget -qO - %s", i.w.state.gslb.host)}
for t := 0; t < 3; t++ {
for t := 0; t < 60; t++ {
result.Body, err = RunBusyBoxCommand(i.w.t, i.w.k8sOptions, coreDNSIP, command)
if err != nil && strings.Contains(err.Error(), "503") {
continue
}
require.NoError(i.w.t, err, "busybox", command, result.Body)
if strings.HasPrefix(result.Body, "{") {
break
Expand Down

0 comments on commit f250677

Please sign in to comment.