Skip to content

Commit

Permalink
TestRequest
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Sep 25, 2023
1 parent 96ace89 commit 47e165b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/pdctl/operator/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,24 @@ func TestForwardOperatorRequest(t *testing.T) {
re.NoError(err)
re.Contains(string(output), "null")
}

func TestRequest(t *testing.T) {
re := require.New(t)
for i := 0; i < 100; i++ {
ctx, cancel := context.WithCancel(context.Background())
cluster, err := tests.NewTestCluster(ctx, 1)
re.NoError(err)
re.NoError(cluster.RunInitialServers())
re.NotEmpty(cluster.WaitLeader())
server := cluster.GetLeaderServer()
re.NoError(server.BootstrapCluster())
backendEndpoints := server.GetAddr()

cmd := pdctlCmd.GetRootCmd()
args := []string{"-u", backendEndpoints, "operator", "check", "2"}
output, err := pdctl.ExecuteCommand(cmd, args...)
re.NoError(err)
re.Contains(string(output), "operator not found")
cancel()
}
}

0 comments on commit 47e165b

Please sign in to comment.