-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3329 from xiaoweim/bqds_test_unset_fields
test:add a scenario test for unset fields in bigquerydataset
- Loading branch information
Showing
21 changed files
with
1,716 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,10 @@ func normalizeKRMObject(t *testing.T, u *unstructured.Unstructured, project test | |
visitor.replacePaths[".status.ipAddress"] = "10.1.2.3" | ||
visitor.replacePaths[".status.outboundPublicIpAddresses"] = []string{"6.6.6.6", "8.8.8.8"} | ||
|
||
// Specific to CloudKMS | ||
visitor.replacePaths[".primary.createTime"] = "2024-04-01T12:34:56.123456Z" | ||
visitor.replacePaths[".primary.generateTime"] = "2024-04-01T12:34:56.123456Z" | ||
|
||
// Specific to BigQuery | ||
visitor.replacePaths[".spec.access[].userByEmail"] = "[email protected]" | ||
|
||
|
26 changes: 26 additions & 0 deletions
26
tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/set_unset/_export5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 | ||
kind: BigQueryDataset | ||
metadata: | ||
annotations: | ||
cnrm.cloud.google.com/delete-contents-on-destroy: "false" | ||
labels: | ||
managed-by-cnrm: "true" | ||
name: bigquerydataset${uniqueId} | ||
spec: | ||
access: | ||
- role: OWNER | ||
specialGroup: projectOwners | ||
defaultCollation: und:ci | ||
defaultEncryptionConfiguration: | ||
kmsKeyRef: | ||
external: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} | ||
defaultPartitionExpirationMs: 3600000 | ||
defaultTableExpirationMs: 3600000 | ||
description: Fully Configured BigQuery Dataset | ||
friendlyName: bigquerydataset-fullyconfigured | ||
isCaseInsensitive: true | ||
location: US | ||
maxTimeTravelHours: "72" | ||
projectRef: | ||
external: ${projectId} | ||
resourceID: bigquerydataset${uniqueId} |
26 changes: 26 additions & 0 deletions
26
tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/set_unset/_export6.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 | ||
kind: BigQueryDataset | ||
metadata: | ||
annotations: | ||
cnrm.cloud.google.com/delete-contents-on-destroy: "false" | ||
labels: | ||
managed-by-cnrm: "true" | ||
name: bigquerydataset${uniqueId} | ||
spec: | ||
access: | ||
- role: OWNER | ||
specialGroup: projectOwners | ||
defaultCollation: und:ci | ||
defaultEncryptionConfiguration: | ||
kmsKeyRef: | ||
external: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} | ||
defaultPartitionExpirationMs: 3600000 | ||
defaultTableExpirationMs: 3600000 | ||
description: Fully Configured BigQuery Dataset unset | ||
friendlyName: bigquerydataset-fullyconfigured | ||
isCaseInsensitive: true | ||
location: US | ||
maxTimeTravelHours: "72" | ||
projectRef: | ||
external: ${projectId} | ||
resourceID: bigquerydataset${uniqueId} |
26 changes: 26 additions & 0 deletions
26
tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/set_unset/_export7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 | ||
kind: BigQueryDataset | ||
metadata: | ||
annotations: | ||
cnrm.cloud.google.com/delete-contents-on-destroy: "false" | ||
labels: | ||
managed-by-cnrm: "true" | ||
name: bigquerydataset${uniqueId} | ||
spec: | ||
access: | ||
- role: OWNER | ||
specialGroup: projectOwners | ||
defaultCollation: und:ci | ||
defaultEncryptionConfiguration: | ||
kmsKeyRef: | ||
external: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} | ||
defaultPartitionExpirationMs: 3600000 | ||
defaultTableExpirationMs: 3600000 | ||
description: Fully Configured BigQuery Dataset set | ||
friendlyName: bigquerydataset | ||
isCaseInsensitive: true | ||
location: US | ||
maxTimeTravelHours: "72" | ||
projectRef: | ||
external: ${projectId} | ||
resourceID: bigquerydataset${uniqueId} |
88 changes: 88 additions & 0 deletions
88
tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/set_unset/_http00.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
404 Not Found | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"error": { | ||
"code": 404, | ||
"message": "KeyRing projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId} not found.", | ||
"status": "NOT_FOUND" | ||
} | ||
} | ||
|
||
--- | ||
|
||
POST https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings?alt=json&keyRingId=kmskeyring-${uniqueId} | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}" | ||
} | ||
|
||
--- | ||
|
||
GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}" | ||
} | ||
|
||
--- | ||
|
||
GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}" | ||
} |
150 changes: 150 additions & 0 deletions
150
tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/set_unset/_http01.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
404 Not Found | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"error": { | ||
"code": 404, | ||
"message": "CryptoKey projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} not found.", | ||
"status": "NOT_FOUND" | ||
} | ||
} | ||
|
||
--- | ||
|
||
POST https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys?alt=json&cryptoKeyId=kmscryptokey-${uniqueId}&skipInitialVersionCreation=false | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
{ | ||
"labels": { | ||
"key-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"purpose": "ENCRYPT_DECRYPT" | ||
} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"destroyScheduledDuration": "2592000s", | ||
"labels": { | ||
"key-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}", | ||
"primary": { | ||
"algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"generateTime": "2024-04-01T12:34:56.123456Z", | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}/cryptoKeyVersions/1", | ||
"protectionLevel": "SOFTWARE", | ||
"state": "ENABLED" | ||
}, | ||
"purpose": "ENCRYPT_DECRYPT", | ||
"versionTemplate": { | ||
"algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", | ||
"protectionLevel": "SOFTWARE" | ||
} | ||
} | ||
|
||
--- | ||
|
||
GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"destroyScheduledDuration": "2592000s", | ||
"labels": { | ||
"key-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}", | ||
"primary": { | ||
"algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"generateTime": "2024-04-01T12:34:56.123456Z", | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}/cryptoKeyVersions/1", | ||
"protectionLevel": "SOFTWARE", | ||
"state": "ENABLED" | ||
}, | ||
"purpose": "ENCRYPT_DECRYPT", | ||
"versionTemplate": { | ||
"algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", | ||
"protectionLevel": "SOFTWARE" | ||
} | ||
} | ||
|
||
--- | ||
|
||
GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"destroyScheduledDuration": "2592000s", | ||
"labels": { | ||
"key-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}", | ||
"primary": { | ||
"algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"generateTime": "2024-04-01T12:34:56.123456Z", | ||
"name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}/cryptoKeyVersions/1", | ||
"protectionLevel": "SOFTWARE", | ||
"state": "ENABLED" | ||
}, | ||
"purpose": "ENCRYPT_DECRYPT", | ||
"versionTemplate": { | ||
"algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", | ||
"protectionLevel": "SOFTWARE" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/set_unset/_http02.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
POST https://serviceusage.googleapis.com/v1beta1/projects/${projectId}/services/bigquery.googleapis.com:generateServiceIdentity?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"done": true, | ||
"name": "operations/${operationID}", | ||
"response": { | ||
"@type": "type.googleapis.com/mockgcp.api.serviceusage.v1beta1.ServiceIdentity", | ||
"email": "bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com", | ||
"uniqueId": "12345678" | ||
} | ||
} |
Oops, something went wrong.