data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

[Health]: Test Case for Rest and GraphQL Requests to DAB during health check

Open sezal98 opened this issue 8 months ago • 2 comments

Why make this change?

Resolves #2662

What is this change?

  1. Created the HttpUtilities with HttpClient already instantiated and basic details filled from Startup.cs
  2. Using this httpClient, call the REST and GraphQL requests with relative URI
  3. Created a function in DatabaseObject to access mapping dict as it is an abstract class which was not allowed to be mocked.
  4. Test cases for both REST and GraphQL
  5. Rest Test case: Mock the client to return a 200 response when we receive a GET request with specific URI. Validate the error message from HttpUtilities should be null.
  6. GraphQL Test case: Mock the client to return a 200 response when we get a POST request with /graphql URI and content payload. Mock the Dabase Object with columns in the entity map to only return the db object when a certain entity is called for.

How was this tested?

  • [ ] Integration Tests
  • [x] Unit Tests

Sample Request(s)

Requests are running as expected. Test cases added for Rest and Graphql

sezal98 avatar Apr 28 '25 11:04 sezal98

/azp run

sezal98 avatar Apr 28 '25 11:04 sezal98

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 28 '25 11:04 azure-pipelines[bot]

/azp run

sezal98 avatar Apr 30 '25 15:04 sezal98

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 30 '25 15:04 azure-pipelines[bot]

/azp run

sezal98 avatar May 08 '25 07:05 sezal98

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 08 '25 07:05 azure-pipelines[bot]

/azp run

sezal98 avatar May 08 '25 07:05 sezal98

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 08 '25 07:05 azure-pipelines[bot]

/azp run

sezal98 avatar May 09 '25 09:05 sezal98

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 09 '25 09:05 azure-pipelines[bot]

/azp run

sezal98 avatar May 14 '25 09:05 sezal98

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 14 '25 09:05 azure-pipelines[bot]

/azp run

Aniruddh25 avatar May 14 '25 17:05 Aniruddh25

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 14 '25 17:05 azure-pipelines[bot]