forked from googleapis/nodejs-pubsub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add autogenerated tests to prepare for a refactor PR (googleapi…
…s#1092) * snapshot tests for create cluster * change request to config * More snapshot tests * Refactor constants out * Add generated testcases for partial cluster update * Add header to constants file * Add script to regenerate snapshots Co-authored-by: Benjamin E. Coe <[email protected]>
- Loading branch information
1 parent
bdca7d1
commit 1a2e3fb
Showing
8 changed files
with
666 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,184 @@ | ||
// 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 | ||
// | ||
// https://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. | ||
|
||
exports[ | ||
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 1' | ||
] = { | ||
input: { | ||
id: 'my-cluster', | ||
options: { | ||
nodes: 2, | ||
location: 'us-central1-b', | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'partialUpdateCluster', | ||
reqOpts: { | ||
cluster: { | ||
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster', | ||
location: 'us-central1-b', | ||
serveNodes: 2, | ||
}, | ||
updateMask: { | ||
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'], | ||
}, | ||
}, | ||
gaxOpts: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 2' | ||
] = { | ||
input: { | ||
id: 'my-cluster', | ||
options: { | ||
nodes: 2, | ||
storage: 'ssd', | ||
location: 'us-central1-b', | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'partialUpdateCluster', | ||
reqOpts: { | ||
cluster: { | ||
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster', | ||
location: 'us-central1-b', | ||
serveNodes: 2, | ||
storage: 'ssd', | ||
}, | ||
updateMask: { | ||
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'], | ||
}, | ||
}, | ||
gaxOpts: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 3' | ||
] = { | ||
input: { | ||
id: 'my-cluster', | ||
options: { | ||
nodes: 2, | ||
key: 'kms-key-name', | ||
location: 'us-central1-b', | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'partialUpdateCluster', | ||
reqOpts: { | ||
cluster: { | ||
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster', | ||
location: 'us-central1-b', | ||
serveNodes: 2, | ||
key: 'kms-key-name', | ||
}, | ||
updateMask: { | ||
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'], | ||
}, | ||
}, | ||
gaxOpts: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 4' | ||
] = { | ||
input: { | ||
id: 'my-cluster', | ||
options: { | ||
nodes: 2, | ||
encryption: { | ||
kmsKeyName: 'kms-key-name', | ||
}, | ||
location: 'us-central1-b', | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'partialUpdateCluster', | ||
reqOpts: { | ||
cluster: { | ||
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster', | ||
location: 'us-central1-b', | ||
serveNodes: 2, | ||
encryption: { | ||
kmsKeyName: 'kms-key-name', | ||
}, | ||
}, | ||
updateMask: { | ||
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'], | ||
}, | ||
}, | ||
gaxOpts: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 5' | ||
] = { | ||
input: { | ||
id: 'my-cluster', | ||
options: { | ||
minServeNodes: 2, | ||
maxServeNodes: 3, | ||
cpuUtilizationPercent: 50, | ||
location: 'us-central1-b', | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'partialUpdateCluster', | ||
reqOpts: { | ||
cluster: { | ||
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster', | ||
location: 'us-central1-b', | ||
clusterConfig: { | ||
clusterAutoscalingConfig: { | ||
autoscalingTargets: { | ||
cpuUtilizationPercent: 50, | ||
}, | ||
autoscalingLimits: { | ||
minServeNodes: 2, | ||
maxServeNodes: 3, | ||
}, | ||
}, | ||
}, | ||
}, | ||
updateMask: { | ||
paths: [ | ||
'cluster_config.cluster_autoscaling_config.autoscaling_limits.min_serve_nodes', | ||
'cluster_config.cluster_autoscaling_config.autoscaling_limits.max_serve_nodes', | ||
'cluster_config.cluster_autoscaling_config.autoscaling_targets.cpu_utilization_percent', | ||
], | ||
}, | ||
}, | ||
gaxOpts: {}, | ||
}, | ||
}, | ||
}; |
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,211 @@ | ||
// 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 | ||
// | ||
// https://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. | ||
|
||
exports[ | ||
'Bigtable createInstance should provide the proper request options asynchronously 1' | ||
] = { | ||
input: { | ||
id: 'my-instance', | ||
options: { | ||
clusters: { | ||
nodes: 2, | ||
location: 'us-central1-b', | ||
id: 'my-cluster', | ||
}, | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'createInstance', | ||
reqOpts: { | ||
parent: 'projects/test-project', | ||
instanceId: 'my-instance', | ||
instance: { | ||
displayName: 'my-instance', | ||
}, | ||
clusters: { | ||
'my-cluster': { | ||
location: 'projects/test-project/locations/us-central1-b', | ||
serveNodes: 2, | ||
defaultStorageType: 0, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable createInstance should provide the proper request options asynchronously 2' | ||
] = { | ||
input: { | ||
id: 'my-instance', | ||
options: { | ||
clusters: { | ||
nodes: 2, | ||
storage: 'ssd', | ||
location: 'us-central1-b', | ||
id: 'my-cluster', | ||
}, | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'createInstance', | ||
reqOpts: { | ||
parent: 'projects/test-project', | ||
instanceId: 'my-instance', | ||
instance: { | ||
displayName: 'my-instance', | ||
}, | ||
clusters: { | ||
'my-cluster': { | ||
location: 'projects/test-project/locations/us-central1-b', | ||
serveNodes: 2, | ||
defaultStorageType: 1, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable createInstance should provide the proper request options asynchronously 3' | ||
] = { | ||
input: { | ||
id: 'my-instance', | ||
options: { | ||
clusters: { | ||
nodes: 2, | ||
key: 'kms-key-name', | ||
location: 'us-central1-b', | ||
id: 'my-cluster', | ||
}, | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'createInstance', | ||
reqOpts: { | ||
parent: 'projects/test-project', | ||
instanceId: 'my-instance', | ||
instance: { | ||
displayName: 'my-instance', | ||
}, | ||
clusters: { | ||
'my-cluster': { | ||
location: 'projects/test-project/locations/us-central1-b', | ||
serveNodes: 2, | ||
defaultStorageType: 0, | ||
encryptionConfig: { | ||
kmsKeyName: 'kms-key-name', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable createInstance should provide the proper request options asynchronously 4' | ||
] = { | ||
input: { | ||
id: 'my-instance', | ||
options: { | ||
clusters: { | ||
nodes: 2, | ||
encryption: { | ||
kmsKeyName: 'kms-key-name', | ||
}, | ||
location: 'us-central1-b', | ||
id: 'my-cluster', | ||
}, | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'createInstance', | ||
reqOpts: { | ||
parent: 'projects/test-project', | ||
instanceId: 'my-instance', | ||
instance: { | ||
displayName: 'my-instance', | ||
}, | ||
clusters: { | ||
'my-cluster': { | ||
location: 'projects/test-project/locations/us-central1-b', | ||
serveNodes: 2, | ||
defaultStorageType: 0, | ||
encryptionConfig: { | ||
kmsKeyName: 'kms-key-name', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
exports[ | ||
'Bigtable createInstance should provide the proper request options asynchronously 5' | ||
] = { | ||
input: { | ||
id: 'my-instance', | ||
options: { | ||
clusters: { | ||
minServeNodes: 2, | ||
maxServeNodes: 3, | ||
cpuUtilizationPercent: 50, | ||
location: 'us-central1-b', | ||
id: 'my-cluster', | ||
}, | ||
}, | ||
}, | ||
output: { | ||
config: { | ||
client: 'BigtableInstanceAdminClient', | ||
method: 'createInstance', | ||
reqOpts: { | ||
parent: 'projects/test-project', | ||
instanceId: 'my-instance', | ||
instance: { | ||
displayName: 'my-instance', | ||
}, | ||
clusters: { | ||
'my-cluster': { | ||
location: 'projects/test-project/locations/us-central1-b', | ||
clusterConfig: { | ||
clusterAutoscalingConfig: { | ||
autoscalingTargets: { | ||
cpuUtilizationPercent: 50, | ||
}, | ||
autoscalingLimits: { | ||
minServeNodes: 2, | ||
maxServeNodes: 3, | ||
}, | ||
}, | ||
}, | ||
defaultStorageType: 0, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.