Skip to content

Commit 85979d4

Browse files
Added policyTags test for bigquery table schema customizediff func (#4844) (#9310)
The behavior here is correct but this is an edge case we could accidentally run into in the future. Signed-off-by: Modular Magician <[email protected]>
1 parent 3f55d93 commit 85979d4

File tree

2 files changed

+40
-14
lines changed

2 files changed

+40
-14
lines changed

.changelog/4844.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google/resource_bigquery_table_test.go

+37-14
Original file line numberDiff line numberDiff line change
@@ -916,20 +916,6 @@ func TestAccBigQueryDataTable_expandArray(t *testing.T) {
916916
})
917917
}
918918

919-
func TestUnitBigQueryDataTable_schemaIsChangable(t *testing.T) {
920-
t.Parallel()
921-
for _, testcase := range testUnitBigQueryDataTableIsChangableTestCases {
922-
testcase.check(t)
923-
testcaseNested := &testUnitBigQueryDataTableJSONChangeableTestCase{
924-
testcase.name + "Nested",
925-
fmt.Sprintf("[{\"name\": \"someValue\", \"type\" : \"INTEGER\", \"fields\" : %s }]", testcase.jsonOld),
926-
fmt.Sprintf("[{\"name\": \"someValue\", \"type\" : \"INT64\", \"fields\" : %s }]", testcase.jsonNew),
927-
testcase.changeable,
928-
}
929-
testcaseNested.check(t)
930-
}
931-
}
932-
933919
func TestAccBigQueryTable_allowDestroy(t *testing.T) {
934920
t.Parallel()
935921

@@ -1081,6 +1067,43 @@ var testUnitBigQueryDataTableIsChangableTestCases = []testUnitBigQueryDataTableJ
10811067
jsonNew: "[{\"name\": \"value3\", \"type\" : \"BOOLEAN\", \"mode\" : \"NULLABLE\", \"description\" : \"newVal\" }, {\"name\": \"value1\", \"type\" : \"INTEGER\", \"mode\" : \"NULLABLE\", \"description\" : \"someVal\" }]",
10821068
changeable: false,
10831069
},
1070+
{
1071+
name: "policyTags",
1072+
jsonOld: `[
1073+
{
1074+
"mode": "NULLABLE",
1075+
"name": "providerphone",
1076+
"policyTags": {
1077+
"names": ["projects/my-project/locations/us/taxonomies/12345678/policyTags/12345678"]
1078+
},
1079+
"type":"STRING"
1080+
}
1081+
]`,
1082+
jsonNew: `[
1083+
{
1084+
"name": "providerphone",
1085+
"type": "STRING",
1086+
"policyTags": {
1087+
"names": ["projects/my-project/locations/us/taxonomies/12345678/policyTags/12345678"]
1088+
}
1089+
}
1090+
]`,
1091+
changeable: true,
1092+
},
1093+
}
1094+
1095+
func TestUnitBigQueryDataTable_schemaIsChangable(t *testing.T) {
1096+
t.Parallel()
1097+
for _, testcase := range testUnitBigQueryDataTableIsChangableTestCases {
1098+
testcase.check(t)
1099+
testcaseNested := &testUnitBigQueryDataTableJSONChangeableTestCase{
1100+
testcase.name + "Nested",
1101+
fmt.Sprintf("[{\"name\": \"someValue\", \"type\" : \"INTEGER\", \"fields\" : %s }]", testcase.jsonOld),
1102+
fmt.Sprintf("[{\"name\": \"someValue\", \"type\" : \"INT64\", \"fields\" : %s }]", testcase.jsonNew),
1103+
testcase.changeable,
1104+
}
1105+
testcaseNested.check(t)
1106+
}
10841107
}
10851108

10861109
func testAccCheckBigQueryExtData(t *testing.T, expectedQuoteChar string) resource.TestCheckFunc {

0 commit comments

Comments
 (0)