Skip to content

test: Add test helper for mocking out use of a network mirror as a provider source#38447

Merged
SarahFrench merged 7 commits intomainfrom
sarah/add-mock-network-mirror-test-helper
Apr 28, 2026
Merged

test: Add test helper for mocking out use of a network mirror as a provider source#38447
SarahFrench merged 7 commits intomainfrom
sarah/add-mock-network-mirror-test-helper

Conversation

@SarahFrench
Copy link
Copy Markdown
Member

@SarahFrench SarahFrench commented Apr 27, 2026

This PR follows some prep work done in #38446 and the test helper added here is intended to support work in #38395. In that PR I want to add some tests for scenarios where a provider is downloaded from a network mirror. This PR adds the necessary helper!

Note: this PR also adds another 'temporary' test case that uses this new provider source. This is necessary because otherwise we'll get complaints about the function being unused, and also it helps with review here. My plan is to remove both of the temporary test cases in #38395, where I will finally add meaningful tests that use the new mock provider sources I've made:

I've also updated some of the godoc comments on these and related helpers I've authored, as I realised they were imprecise/harder to parse without prior knowledge.

Target Release

1.16.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

SarahFrench and others added 4 commits April 27, 2026 12:30
…factoring `NewMockHTTPMirrorSource` to pull out reused logic.
…r, for tests that need to include use of a network mirror when downloading providers.
…roviderSourceUsingTestHttpServer`

This reduces repeated logic and hopefully makes it easier to understand.

Co-authored-by: Copilot <[email protected]>
@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Apr 27, 2026
@SarahFrench SarahFrench marked this pull request as ready for review April 27, 2026 13:15
@SarahFrench SarahFrench requested a review from a team as a code owner April 27, 2026 13:15
Comment thread internal/command/init_test.go Outdated
@SarahFrench SarahFrench marked this pull request as draft April 27, 2026 13:34
…d by the test setup before using an endpoint handler

Co-authored-by: Copilot <[email protected]>
Copy link
Copy Markdown
Member

@austinvalle austinvalle left a comment

Choose a reason for hiding this comment

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

LGTM 🎸 - the comments are much appreciated 😅

@SarahFrench SarahFrench merged commit 1edd518 into main Apr 28, 2026
13 checks passed
@SarahFrench SarahFrench deleted the sarah/add-mock-network-mirror-test-helper branch April 28, 2026 10:56
austinvalle pushed a commit that referenced this pull request Apr 28, 2026
…ovider source (#38447)

* refactor: Add `NewMockHTTPMirrorSource` test helper. This required refactoring `NewMockHTTPMirrorSource` to pull out reused logic.

* refactor: Move structs defining expected HTTP responses from a network mirror into `getproviders` package

* feat: Add `newHTTPMirrorProviderSourceUsingTestHttpServer` test helper, for tests that need to include use of a network mirror when downloading providers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants