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 #1345

Signed-off-by: Yury Tsarev <[email protected]>
  • Loading branch information
ytsarev committed Dec 30, 2023
1 parent 572a192 commit dfa700d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion terratest/test/k8gb_failover_playground_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func TestFailoverPlayground(t *testing.T) {

t.Run("start podinfo again on eu cluster", func(t *testing.T) {
instanceEU.StartTestApp()
require.NoError(t, instanceEU.WaitForAppIsRunning())
err = instanceEU.WaitForAppIsRunning()
require.NoError(t, err)
actAndAssert(t.Name(), euGeoTag, euLocalTargets)
})
}
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 dfa700d

Please sign in to comment.