Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add acceptance tests for how provider handles project arguments #11607

Conversation

SarahFrench
Copy link
Collaborator

@SarahFrench SarahFrench commented Sep 2, 2024

This PR adds acc tests to test how the provider handles the project argument, using the new datasources google_provider_config_plugin_framework and google_provider_config_sdk.

In the existing unit tests there is a test case in the TestFrameworkProvider_LoadAndValidateFramework_project test called "when project is an unknown value, the provider treats it as if it's unset and uses an environment variable instead".

I added a test case called "when project is unknown in the config, environment variables are used" in the new SDK and PF acc tests. However the test case is flakey and has different outcomes on different runs. Because of this I'm going to leave testing unknown handling to unit tests only.

Release Note Template for Downstream PRs (will be copied)


@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 12 files changed, 1472 insertions(+), 709 deletions(-))
google-beta provider: Diff ( 12 files changed, 1472 insertions(+), 709 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3883
Passed tests: 3469
Skipped tests: 410
Affected tests: 4

Click here to see the affected service packages

All service packages are affected

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate
  • TestAccComputeInstanceTemplate_withNamePrefix
  • TestAccProjectIamPolicy_invalidMembers
  • TestAccSdkProvider_project

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]
TestAccComputeInstanceTemplate_withNamePrefix[Debug log]
TestAccProjectIamPolicy_invalidMembers[Debug log]
$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccSdkProvider_project[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@SarahFrench
Copy link
Collaborator Author

SarahFrench commented Sep 2, 2024

TestAccFwProvider_project did run, but wasn't reported here. Look in gcs bucket for file

@SarahFrench
Copy link
Collaborator Author

This failure is weird, as I can get the original version of the acctest's checks to pass locally. I assume that there's a difference in the CI environment and my laptop that affects the data source being refreshed or not? I assume the plugin-framework version won't be as flaky as unknown handling is more explicit and less of "lucky timing" where a data source refreshes before you try to use its attributes in dependent resources

@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@SarahFrench SarahFrench force-pushed the mux-refactor-3-replace-project-tests branch from b86f569 to 83a0020 Compare September 4, 2024 17:46
@modular-magician

This comment has been minimized.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 12 files changed, 1492 insertions(+), 710 deletions(-))
google-beta provider: Diff ( 12 files changed, 1492 insertions(+), 710 deletions(-))

@modular-magician

This comment has been minimized.

@modular-magician

This comment has been minimized.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3907
Passed tests: 3494
Skipped tests: 410
Affected tests: 3

Click here to see the affected service packages

All service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate
  • TestAccComputeInstanceTemplate_withNamePrefix
  • TestAccSdkProvider_project

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]
TestAccComputeInstanceTemplate_withNamePrefix[Debug log]
$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccSdkProvider_project[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 12 files changed, 1492 insertions(+), 710 deletions(-))
google-beta provider: Diff ( 12 files changed, 1492 insertions(+), 710 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3804
Passed tests: 3393
Skipped tests: 410
Affected tests: 1

Click here to see the affected service packages

All service packages are affected

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccComputeInstanceTemplate_withNamePrefix

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Debug log]
$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@SarahFrench SarahFrench force-pushed the mux-refactor-3-replace-project-tests branch from 62ce0dd to d33c692 Compare September 5, 2024 11:06
@modular-magician

This comment has been minimized.

@modular-magician

This comment has been minimized.

@modular-magician

This comment has been minimized.

@@ -14,168 +14,6 @@ import (
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
)

func TestFrameworkProvider_LoadAndValidateFramework_project(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind adding this function back? Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added in f66e3ad

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah sorry, this is the go rewrite file - I'll push it back

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3996
Passed tests: 3584
Skipped tests: 409
Affected tests: 3

Click here to see the affected service packages

All service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate
  • TestAccComputeInstance_confidentialHyperDiskBootDisk
  • TestAccSdkProvider_project

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]
TestAccComputeInstance_confidentialHyperDiskBootDisk[Debug log]
$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccComputeInstance_confidentialHyperDiskBootDisk[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccSdkProvider_project[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

…unit-test level. Add comments to group test cases by type.
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 391 insertions(+))
google-beta provider: Diff ( 2 files changed, 391 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3998
Passed tests: 3587
Skipped tests: 409
Affected tests: 2

Click here to see the affected service packages

All service packages are affected

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate
  • TestAccFrameworkProviderBasePath_setInvalidBasePath

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccFrameworkProviderBasePath_setInvalidBasePath[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

Copy link
Member

@zli82016 zli82016 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 failed test looks like unrelated.

@SarahFrench
Copy link
Collaborator Author

I realised that I was confused before - once that latest push completes it's automation I'll merge the PR.

Thank you for the review & bearing with me on the weird Unknown behaviour!

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 391 insertions(+))
google-beta provider: Diff ( 2 files changed, 391 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4036
Passed tests: 3622
Skipped tests: 411
Affected tests: 3

Click here to see the affected service packages

All service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate
  • TestAccComputeInstance_confidentialHyperDiskBootDisk
  • TestAccFrameworkProviderBasePath_setInvalidBasePath

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]
TestAccComputeInstance_confidentialHyperDiskBootDisk[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccFrameworkProviderBasePath_setInvalidBasePath[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 391 insertions(+))
google-beta provider: Diff ( 2 files changed, 391 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4043
Passed tests: 3630
Skipped tests: 412
Affected tests: 1

Click here to see the affected service packages

All service packages are affected

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@SarahFrench
Copy link
Collaborator Author

That resolves the missing test, merging now!

@SarahFrench SarahFrench merged commit 0bfab18 into GoogleCloudPlatform:main Sep 16, 2024
10 checks passed
abd-goog pushed a commit to abd-goog/magic-modules that referenced this pull request Sep 23, 2024
niharika-98 pushed a commit to niharika-98/magic-modules that referenced this pull request Oct 7, 2024
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.

3 participants