Merge pull request #12404 from hashicorp/tests-client-waits

tests: wait on client in a couple of tests
This commit is contained in:
Seth Hoenig
2022-03-30 15:23:47 -05:00
committed by GitHub
3 changed files with 12 additions and 1 deletions

View File

@@ -410,7 +410,7 @@ func buildPathSlice(path string, files []string) []string {
}
func TestDebug_CapturedFiles(t *testing.T) {
// ci.Parallel(t)
ci.Parallel(t)
srv, _, url := testServer(t, true, nil)
testutil.WaitForLeader(t, srv.Agent.RPC)
@@ -418,6 +418,7 @@ func TestDebug_CapturedFiles(t *testing.T) {
region := srv.Config.Region
serverName := fmt.Sprintf("%s.%s", serverNodeName, region)
clientID := srv.Agent.Client().NodeID()
testutil.WaitForClient(t, srv.Agent.Client().RPC, clientID, srv.Agent.Client().Region())
t.Logf("serverName: %s, clientID, %s", serverName, clientID)

View File

@@ -6,6 +6,7 @@ import (
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/ci"
"github.com/hashicorp/nomad/testutil"
"github.com/mitchellh/cli"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -17,6 +18,10 @@ func TestRecommendationListCommand_Run(t *testing.T) {
srv, client, url := testServer(t, true, nil)
defer srv.Shutdown()
testutil.WaitForLeader(t, srv.Agent.RPC)
clientID := srv.Agent.Client().NodeID()
testutil.WaitForClient(t, srv.Agent.Client().RPC, clientID, srv.Agent.Client().Region())
ui := cli.NewMockUi()
cmd := &RecommendationListCommand{Meta: Meta{Ui: ui}}

View File

@@ -17,6 +17,11 @@ func TestServiceDeleteCommand_Run(t *testing.T) {
srv, client, url := testServer(t, true, nil)
defer srv.Shutdown()
// Wait for server and client to start
testutil.WaitForLeader(t, srv.Agent.RPC)
clientID := srv.Agent.Client().NodeID()
testutil.WaitForClient(t, srv.Agent.Client().RPC, clientID, srv.Agent.Client().Region())
// Wait until our test node is ready.
testutil.WaitForResult(func() (bool, error) {
nodes, _, err := client.Nodes().List(nil)