Skip to content

Commit

Permalink
ci: wait for the cluster to startup in tlstest (#57)
Browse files Browse the repository at this point in the history
This particular test seems to fail for this PR
dgraph-io/dgraph-private#48 pretty consistently.
While we have not completely migrated to use dgraphtest package yet,
this is a temporary solution to fix the test.
  • Loading branch information
mangalaman93 committed Mar 1, 2024
1 parent 3754e87 commit 356ae3d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tlstest/certrequest/certrequest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ package certrequest
import (
"context"
"fmt"
"strings"
"testing"
"time"

"github.com/spf13/viper"
"github.com/stretchr/testify/require"
Expand All @@ -32,7 +34,17 @@ func TestAccessWithCaCert(t *testing.T) {

dg, err := testutil.DgraphClientWithCerts(testutil.SockAddr, conf)
require.NoError(t, err, "Unable to get dgraph client: %v", err)
require.NoError(t, dg.Alter(context.Background(), &api.Operation{DropAll: true}))
for i := 0; i < 20; i++ {
err := dg.Alter(context.Background(), &api.Operation{DropAll: true})
if err == nil {
break
}
if strings.Contains(err.Error(), "first record does not look like a TLS handshake") {
// this is a transient error that happens when the server is still starting up
time.Sleep(time.Second)
continue
}
}
}

func TestCurlAccessWithCaCert(t *testing.T) {
Expand Down

0 comments on commit 356ae3d

Please sign in to comment.