Skip to content

modify AzureMetadataRequestor. rewrite tests to mock HttpClient instead of using in-proc server (2)#2360

Merged
TimothyMothra merged 11 commits intodevelopfrom
tilee/fix_azureinstancemetadata_tests2
Aug 11, 2021
Merged

modify AzureMetadataRequestor. rewrite tests to mock HttpClient instead of using in-proc server (2)#2360
TimothyMothra merged 11 commits intodevelopfrom
tilee/fix_azureinstancemetadata_tests2

Conversation

@TimothyMothra
Copy link
Copy Markdown

@TimothyMothra TimothyMothra commented Aug 11, 2021

When switching to FrameworkReferences, discovered a problem with some tests for AzureInstanceMetadada (see full write up in #2357).

This PR superceedes #2358
This is a less invasive change that doesn't require changes to the call stack.

Changes

  • Replace local inproc server with HttpClient and mock HttpMessageHandler.
  • Remove test AzureImsResponseTooLargeStopsCollection. HttpClient correctly handles and parses the larger response.
  • Replace test AzureImsResponseTimesOut with AzureImsResponseHandlesException. Could not force a timeout in a test context. HttpClient throws an exception when timeout. I changed this test to throw an exception and verify that this is handled correctly.

Checklist

  • I ran Unit Tests locally.
  • CHANGELOG.md updated with one line description of the fix, and a link to the original issue if available.

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public surface reviewed

The PR will trigger build, unit tests, and functional tests automatically. Please follow these instructions to build and test locally.

Notes for authors:

  • FxCop and other analyzers will fail the build. To see these errors yourself, compile localy using the Release configuration.

Notes for reviewers:

  • We support comment build triggers
    • /AzurePipelines run will queue all builds
    • /AzurePipelines run <pipeline-name> will queue a specific build

@TimothyMothra TimothyMothra requested a review from reyang August 11, 2021 17:32
Copy link
Copy Markdown
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@TimothyMothra TimothyMothra merged commit fc166a1 into develop Aug 11, 2021
@TimothyMothra TimothyMothra deleted the tilee/fix_azureinstancemetadata_tests2 branch August 11, 2021 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AzureInstanceMetadata: replace tests

2 participants