Skip to content

Commit

Permalink
Update the error message to list the autoscaling configs.
Browse files Browse the repository at this point in the history
Update test suite accordingly.
  • Loading branch information
Mariatta committed Feb 24, 2022
1 parent 7b3e3bf commit a13ca4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions google/cloud/bigtable/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ def _validate_scaling_config(self):
and not self.cpu_utilization_percent
):
raise ValueError(
"Must specify either serve_nodes or all of the autoscaling configurations."
"Must specify either serve_nodes or all of the autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)
if self.serve_nodes and (
self.max_serve_nodes or self.min_serve_nodes or self.cpu_utilization_percent
):
raise ValueError(
"Cannot specify both serve_nodes and autoscaling configurations."
"Cannot specify both serve_nodes and autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)
if (
(
Expand All @@ -286,7 +286,7 @@ def _validate_scaling_config(self):
)
):
raise ValueError(
"All of autoscaling configurations must be specified at the same time."
"All of autoscaling configurations must be specified at the same time (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)

def __eq__(self, other):
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def test_cluster_update_w_both_manual_and_autoscaling():
cluster.update()
assert (
str(excinfo.value)
== "Cannot specify both serve_nodes and autoscaling configurations."
== "Cannot specify both serve_nodes and autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)


Expand Down Expand Up @@ -893,7 +893,7 @@ def test_create_cluster_with_both_manual_and_autoscaling():
cluster.create()
assert (
str(excinfo.value)
== "Cannot specify both serve_nodes and autoscaling configurations."
== "Cannot specify both serve_nodes and autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)


Expand Down Expand Up @@ -934,7 +934,7 @@ def test_create_cluster_with_partial_autoscaling_config():
cluster.create()
assert (
str(excinfo.value)
== "All of autoscaling configurations must be specified at the same time."
== "All of autoscaling configurations must be specified at the same time (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)


Expand All @@ -958,7 +958,7 @@ def test_create_cluster_with_no_scaling_config():
cluster.create()
assert (
str(excinfo.value)
== "Must specify either serve_nodes or all of the autoscaling configurations."
== "Must specify either serve_nodes or all of the autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
)


Expand Down

0 comments on commit a13ca4b

Please sign in to comment.