Skip to content

Commit

Permalink
Move BQ external AWS dataset test to resource_bigquery_dataset_test
Browse files Browse the repository at this point in the history
  • Loading branch information
obada-ab committed Dec 13, 2024
1 parent 82b6996 commit 169be9d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
5 changes: 0 additions & 5 deletions mmv1/products/bigquery/Dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ examples:
dataset_id: 'example_dataset'
account_name: 'bqowner'
exclude_docs: true
- name: 'bigquery_dataset_external_reference_aws_test'
primary_resource_id: 'dataset'
vars:
dataset_id: 'example_dataset'
exclude_docs: true
- name: 'bigquery_dataset_external_reference_aws'
primary_resource_id: 'dataset'
vars:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,31 @@ func TestAccBigQueryDataset_bigqueryDatasetResourceTags_update(t *testing.T) {
})
}

func TestAccBigQueryDataset_bigqueryDatasetExternalReferenceAws(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccBigQueryDataset_bigqueryDatasetExternalReferenceAws(context),
},
{
ResourceName: "google_bigquery_dataset.dataset",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"labels", "terraform_labels"},
},
},
})
}

{{- if ne $.TargetVersionName "ga" }}
func TestAccBigQueryDataset_externalCatalogDatasetOptions_update(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -727,7 +752,7 @@ resource "google_bigquery_dataset" "access_test" {

access {
role = "READER"
user_by_email = "Sam@example.com"
user_by_email = "hashicorp.com"
condition {
title = "test-condition"
description = "Request after midnight of 2019-12-31"
Expand Down Expand Up @@ -977,3 +1002,19 @@ resource "google_bigquery_dataset" "dataset" {
}
`, context)
}

func testAccBigQueryDataset_bigqueryDatasetExternalReferenceAws(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_bigquery_dataset" "dataset" {
dataset_id = "dataset%{random_suffix}"
friendly_name = "test"
description = "This is a test description"
location = "aws-us-east-1"

external_dataset_reference {
external_source = "aws-glue://arn:aws:glue:us-east-1:772042918353:database/db_other_formats_external"
connection = "projects/bigquerytestdefault/locations/aws-us-east-1/connections/external_test-connection"
}
}
`, context)
}

0 comments on commit 169be9d

Please sign in to comment.