-
Notifications
You must be signed in to change notification settings - Fork 242
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 #3364 from anhdle-sso/spannerinstance-unset-test
Add Spanner instance unset compute field test
- Loading branch information
Showing
4 changed files
with
416 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...ce-unset-compute-fields/_generated_object_spanneinstance-unset-compute-fields.golden.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,30 @@ | ||
apiVersion: spanner.cnrm.cloud.google.com/v1beta1 | ||
kind: SpannerInstance | ||
metadata: | ||
annotations: | ||
cnrm.cloud.google.com/management-conflict-prevention-policy: none | ||
cnrm.cloud.google.com/project-id: ${projectId} | ||
cnrm.cloud.google.com/state-into-spec: absent | ||
finalizers: | ||
- cnrm.cloud.google.com/finalizer | ||
- cnrm.cloud.google.com/deletion-defender | ||
generation: 3 | ||
labels: | ||
cnrm-test: "true" | ||
label-one: value-one | ||
name: spannerinstance-sample-${uniqueId} | ||
namespace: ${uniqueId} | ||
spec: | ||
config: regional-us-west1 | ||
displayName: New spanner Instance Sample | ||
numNodes: 2 | ||
resourceID: spannerinstance-sample-${uniqueId} | ||
status: | ||
conditions: | ||
- lastTransitionTime: "1970-01-01T00:00:00Z" | ||
message: The resource is up to date | ||
reason: UpToDate | ||
status: "True" | ||
type: Ready | ||
observedGeneration: 3 | ||
state: READY |
339 changes: 339 additions & 0 deletions
339
...ourcefixture/testdata/basic/spanner/v1beta1/spanneinstance-unset-compute-fields/_http.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,339 @@ | ||
GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${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-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"error": { | ||
"code": 404, | ||
"message": "Instance not found: projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"status": "NOT_FOUND" | ||
} | ||
} | ||
|
||
--- | ||
|
||
POST https://spanner.googleapis.com/v1/projects/${projectId}/instances?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 | ||
|
||
{ | ||
"instance": { | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"nodeCount": 2 | ||
}, | ||
"instanceId": "spannerinstance-sample-${uniqueId}" | ||
} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"metadata": { | ||
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata", | ||
"instance": { | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"replicaComputeCapacity": [ | ||
{ | ||
"nodeCount": 2, | ||
"replicaSelection": { | ||
"location": "us-west1" | ||
} | ||
} | ||
], | ||
"state": "READY" | ||
}, | ||
"startTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}" | ||
} | ||
|
||
--- | ||
|
||
GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}?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-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"done": true, | ||
"metadata": { | ||
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata", | ||
"endTime": "2024-04-01T12:34:56.123456Z", | ||
"expectedFulfillmentPeriod": "FULFILLMENT_PERIOD_NORMAL", | ||
"instance": { | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"startTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}", | ||
"response": { | ||
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.Instance", | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
} | ||
} | ||
|
||
--- | ||
|
||
GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${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-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
} | ||
|
||
--- | ||
|
||
PATCH https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${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 | ||
|
||
{ | ||
"fieldMask": "displayName", | ||
"instance": { | ||
"displayName": "New spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/%!s(\u003cnil\u003e)", | ||
"nodeCount": 2, | ||
"processingUnits": 2000 | ||
} | ||
} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"metadata": { | ||
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata", | ||
"instance": { | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"replicaComputeCapacity": [ | ||
{ | ||
"nodeCount": 2, | ||
"replicaSelection": { | ||
"location": "us-west1" | ||
} | ||
} | ||
], | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"startTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}" | ||
} | ||
|
||
--- | ||
|
||
GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}?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-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"done": true, | ||
"metadata": { | ||
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata", | ||
"endTime": "2024-04-01T12:34:56.123456Z", | ||
"expectedFulfillmentPeriod": "FULFILLMENT_PERIOD_NORMAL", | ||
"instance": { | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"startTime": "2024-04-01T12:34:56.123456Z" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}", | ||
"response": { | ||
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.Instance", | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
} | ||
} | ||
|
||
--- | ||
|
||
GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${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-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"config": "projects/${projectId}/instanceConfigs/regional-us-west1", | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"displayName": "Spanner Instance Sample", | ||
"labels": { | ||
"cnrm-test": "true", | ||
"label-one": "value-one", | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}", | ||
"nodeCount": 2, | ||
"processingUnits": 2000, | ||
"state": "READY", | ||
"updateTime": "2024-04-01T12:34:56.123456Z" | ||
} | ||
|
||
--- | ||
|
||
DELETE https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${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-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{} |
24 changes: 24 additions & 0 deletions
24
...rcefixture/testdata/basic/spanner/v1beta1/spanneinstance-unset-compute-fields/create.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,24 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: spanner.cnrm.cloud.google.com/v1beta1 | ||
kind: SpannerInstance | ||
metadata: | ||
labels: | ||
label-one: "value-one" | ||
name: spannerinstance-sample-${uniqueId} | ||
spec: | ||
config: regional-us-west1 | ||
displayName: Spanner Instance Sample | ||
numNodes: 2 |
Oops, something went wrong.