Skip to content

Commit

Permalink
added a check that the client is up
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkermichael committed Dec 5, 2023
1 parent ccabee4 commit 7fbb788
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions control-plane/helper/test/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/proto-public/pbresource"
"github.com/hashicorp/consul/sdk/testutil"
"github.com/hashicorp/consul/sdk/testutil/retry"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down Expand Up @@ -66,6 +67,13 @@ func TestServerWithMockConnMgrWatcher(t *testing.T, callback testutil.ServerConf
client, err := api.NewClient(consulConfig.APIClientConfig)
require.NoError(t, err)

// Check that we can reach the test client
timer := &retry.Timer{Timeout: 1 * time.Minute, Wait: 1 * time.Second}
retry.RunWith(timer, t, func(r *retry.R) {
_, err := client.Agent().Self()
require.NoError(r, err)
})

return &TestServerClient{
TestServer: consulServer,
APIClient: client,
Expand Down

0 comments on commit 7fbb788

Please sign in to comment.