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

Failing test(s): TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic + others #20003

Open
SarahFrench opened this issue Oct 24, 2024 · 9 comments

Comments

@SarahFrench
Copy link
Member

SarahFrench commented Oct 24, 2024

Impacted tests

  • TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic
  • TestAccSecurityCenterV2OrganizationBigQueryExportConfig_basic
  • TestAccSecurityCenterV2OrganizationBigQueryExportsConfig_basic
  • TestAccSecurityCenterOrganizationBigQueryExportConfig_basic
  • TestAccSecurityCenterProjectBigQueryExportConfig_basic

Affected Resource(s)

  • google_scc_v2_project_scc_big_query_export
  • google_scc_v2_organization_scc_big_query_export

Failure rates

  • 51% since 2024-08-29
  • 93% (53 failed out of last 57 runs) as of 2024-11-08 for TestAccSecurityCenterOrganizationBigQueryExportConfig_basic

Message(s)

------- Stdout: -------
=== RUN   TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic
=== PAUSE TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic
=== CONT  TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic
    testing_new.go:90: Error running post-test destroy, there may be dangling resources: exit status 1
        Error: Error when reading or editing Dataset: googleapi: Error 400: Dataset ci-test-project-nightly-ga:tf_test_fbn2dql0rc is still in use, resourceInUse
--- FAIL: TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic (210.52s)
FAIL

Nightly build test history

https://hashicorp.teamcity.com/test/2715200116441949818?currentProjectId=TerraformProviders_GoogleCloud_GOOGLE_NIGHTLYTESTS&expandTestHistoryChartSection=true&expandedTest=build%3A%28id%3A249228%29%2Cid%3A2000000012

b/375653701

@github-actions github-actions bot added forward/review In review; remove label to forward service/bigquery labels Oct 24, 2024
@SarahFrench SarahFrench removed the forward/review In review; remove label to forward label Oct 24, 2024
@SarahFrench SarahFrench added this to the Goals milestone Oct 24, 2024
@SarahFrench SarahFrench changed the title Failing test(s): TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic Failing test(s): TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic + others Oct 24, 2024
@wj-chen
Copy link

wj-chen commented Oct 24, 2024

Hi Sarah, do you have more details about the tests to show? We don't have access to the test history and I can't seem to find the test in the repo by searching by this name.

@SarahFrench
Copy link
Member Author

SarahFrench commented Oct 24, 2024

Here's are the tests in the code:

func TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic(t *testing.T) {

func TestAccSecurityCenterV2OrganizationBigQueryExportConfig_basic(t *testing.T) {

func TestAccSecurityCenterV2OrganizationBigQueryExportsConfig_basic(t *testing.T) {

I don't have more details about the tests to show, but I believe there is a Google-internal way that nightly test logs are shared with people from the service team. I don't know the details myself- it might be worth checking with the Google Terraform team.

@wj-chen
Copy link

wj-chen commented Oct 24, 2024

Thank you Sarah. I took a look and these tests should be about the google_scc_v2_organization_scc_big_query_export resource which is owned by the SCC team. The tests use google_bigquery_dataset in the setup and for some reasons are not cleaning it up consistently. Adding @roaks3 the terraform-team-oncall this week to help reroute the issue here and in our internal issue tracker.

@SarahFrench

This comment was marked as outdated.

@roaks3

This comment was marked as outdated.

@melinath
Copy link
Collaborator

melinath commented Nov 8, 2024

Added a couple more tests impacted by this issue.

@rileykarson
Copy link
Collaborator

@vijaykanthm: Do you happen to know the trigger for this error? Is this a lock on the resource from SCC that we need to wait to go away before deletions, are we failing to clean up a pointer/reference to the resource by abandoning the resource?

@vijaykanthm
Copy link

@vijaykanthm: Do you happen to know the trigger for this error? Is this a lock on the resource from SCC that we need to wait to go away before deletions, are we failing to clean up a pointer/reference to the resource by abandoning the resource?

I’m not entirely sure about the exact cause, as I don't have access to the TeamCity logs and I've learned that I won’t be able to access them. However, I believe the issue might be due to the dataset still being referenced or locked by SCC, which would prevent its deletion. We might need to add some additional wait time to ensure the lock is released before cleanup.

As I mentioned in our discussion, the reason I wanted to implement the cleanup function was to remove references to existing resources before test execution, in order to avoid this type of issue.

@rileykarson
Copy link
Collaborator

Yep! To clarify a bit more- we need to make sure we run generic/broad resource cleanups outside of individual tests so that we can ensure that they don't execute at the same time as other tests that may be using resources that could be affected. So a test can clean up its own resources under test at the end, but not those of other tests- and those other resources need to be cleaned up through a "sweeper". Not sure why they haven't been effective here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants