From 9ed8cc36928c20981aaf7fa2ef54b955dae4db0b Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 26 Apr 2024 15:47:14 +0000 Subject: [PATCH] Fix the failing tests TestAccBigQueryJob_bigqueryJobCopy* (#10520) [upstream:a63881aee1ba6d956d3d79d2b7e70bf0fda64f02] Signed-off-by: Modular Magician --- .../resource_bigquery_job_generated_test.go | 18 ++++++++++++++---- website/docs/r/bigquery_job.html.markdown | 8 ++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/google/services/bigquery/resource_bigquery_job_generated_test.go b/google/services/bigquery/resource_bigquery_job_generated_test.go index 0ef144ca057..1e52c1a9514 100644 --- a/google/services/bigquery/resource_bigquery_job_generated_test.go +++ b/google/services/bigquery/resource_bigquery_job_generated_test.go @@ -490,9 +490,13 @@ func TestAccBigQueryJob_bigqueryJobCopyExample(t *testing.T) { func testAccBigQueryJob_bigqueryJobCopyExample(context map[string]interface{}) string { return acctest.Nprintf(` +locals { + count = 2 +} + resource "google_bigquery_table" "source" { deletion_protection = false - count = length(google_bigquery_dataset.source) + count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id table_id = "tf_test_job_copy%{random_suffix}_${count.index}_table" @@ -519,7 +523,7 @@ EOF } resource "google_bigquery_dataset" "source" { - count = 2 + count = local.count dataset_id = "tf_test_job_copy%{random_suffix}_${count.index}_dataset" friendly_name = "test" @@ -645,9 +649,13 @@ func TestAccBigQueryJob_bigqueryJobCopyTableReferenceExample(t *testing.T) { func testAccBigQueryJob_bigqueryJobCopyTableReferenceExample(context map[string]interface{}) string { return acctest.Nprintf(` +locals { + count = 2 +} + resource "google_bigquery_table" "source" { deletion_protection = false - count = length(google_bigquery_dataset.source) + count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id table_id = "tf_test_job_copy%{random_suffix}_${count.index}_table" @@ -671,10 +679,12 @@ resource "google_bigquery_table" "source" { } ] EOF + + depends_on = [google_bigquery_dataset.source] } resource "google_bigquery_dataset" "source" { - count = 2 + count = local.count dataset_id = "tf_test_job_copy%{random_suffix}_${count.index}_dataset" friendly_name = "test" diff --git a/website/docs/r/bigquery_job.html.markdown b/website/docs/r/bigquery_job.html.markdown index 9d5e5fa35fd..6ba6160afb7 100644 --- a/website/docs/r/bigquery_job.html.markdown +++ b/website/docs/r/bigquery_job.html.markdown @@ -304,9 +304,13 @@ resource "google_bigquery_job" "job" { ```hcl +locals { + count = 2 +} + resource "google_bigquery_table" "source" { deletion_protection = false - count = length(google_bigquery_dataset.source) + count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id table_id = "job_copy_${count.index}_table" @@ -333,7 +337,7 @@ EOF } resource "google_bigquery_dataset" "source" { - count = 2 + count = local.count dataset_id = "job_copy_${count.index}_dataset" friendly_name = "test"