From 67632703746120b9d423605d9c3c29c3ec8ef5d9 Mon Sep 17 00:00:00 2001 From: RRashmit Date: Thu, 24 Oct 2024 10:09:20 +0100 Subject: [PATCH] chore: integration test for health req --- .../grpc_management_plane_api_test.go | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/integration/grpc_management_plane_api_test.go b/test/integration/grpc_management_plane_api_test.go index 9ee12e604f..a852809aa1 100644 --- a/test/integration/grpc_management_plane_api_test.go +++ b/test/integration/grpc_management_plane_api_test.go @@ -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()