Skip to content

Commit

Permalink
chore: integration test for health req
Browse files Browse the repository at this point in the history
  • Loading branch information
RRashmit committed Oct 24, 2024
1 parent 890567a commit 6763270
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/integration/grpc_management_plane_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,37 @@ func TestGrpc_FileWatcher(t *testing.T) {
verifyUpdateDataPlaneStatus(t)
}

func TestGrpc_DataplaneHealthRequest(t *testing.T) {
teardownTest := setupConnectionTest(t, true)
defer teardownTest(t)

verifyConnection(t)
assert.False(t, t.Failed())

request := `{
"message_meta": {
"message_id": "5d0fa83e-351c-4009-90cd-1f2acce2d184",
"correlation_id": "79794c1c-8e91-47c1-a92c-b9a0c3f1a263",
"timestamp": "2023-01-15T01:30:15.01Z"
},
"health_request": {}
}`

client := resty.New()
client.SetRetryCount(retryCount).SetRetryWaitTime(retryWaitTime).SetRetryMaxWaitTime(retryMaxWaitTime)

url := fmt.Sprintf("http://%s/api/v1/requests", mockManagementPlaneAPIAddress)
resp, err := client.R().EnableTrace().SetBody(request).Post(url)

require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode())

responses := getManagementPlaneResponses(t, 2)

assert.Equal(t, mpi.CommandResponse_COMMAND_STATUS_OK, responses[1].GetCommandResponse().GetStatus())
assert.Equal(t, "Successfully sent the health status update", responses[1].GetCommandResponse().GetMessage())
}

func performConfigApply(t *testing.T, nginxInstanceID string) {
t.Helper()

Expand Down

0 comments on commit 6763270

Please sign in to comment.