Skip to content

Commit 5c462ae

Browse files
committed
fix: addresses PR comments
1 parent dc17892 commit 5c462ae

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceAdminClientImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ protected com.google.iam.v1.Policy toPb(Policy policy) {
4747
}
4848
}
4949

50-
static final String NOT_BOTH_NODE_COUNT_AND_PROCESSING_UNITS =
51-
"Only one of nodeCount and processingUnits can be set when creating a new instance";
5250
private static final PathTemplate PROJECT_NAME_TEMPLATE =
5351
PathTemplate.create("projects/{project}");
5452
private final DatabaseAdminClient dbClient;
@@ -100,7 +98,7 @@ public OperationFuture<Instance, CreateInstanceMetadata> createInstance(Instance
10098
throws SpannerException {
10199
Preconditions.checkArgument(
102100
instance.getNodeCount() == 0 || instance.getProcessingUnits() == 0,
103-
NOT_BOTH_NODE_COUNT_AND_PROCESSING_UNITS);
101+
"Only one of nodeCount and processingUnits can be set when creating a new instance");
104102
String projectName = PROJECT_NAME_TEMPLATE.instantiate("project", projectId);
105103
OperationFuture<com.google.spanner.admin.instance.v1.Instance, CreateInstanceMetadata>
106104
rawOperationFuture =

google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceInfo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ public abstract static class Builder {
7878
public abstract Builder setDisplayName(String displayName);
7979

8080
/**
81-
* Sets the number of nodes for the instance. Only one of processing units or node count must be
82-
* set when creating a new instance.
81+
* Sets the number of nodes for the instance. Exactly one of processing units or node count must
82+
* be set when creating a new instance.
8383
*/
8484
public abstract Builder setNodeCount(int nodeCount);
8585

8686
/**
87-
* Sets the number of processing units for the instance. Only one of processing units or node
87+
* Sets the number of processing units for the instance. Exactly one of processing units or node
8888
* count must be set when creating a new instance. Processing units must be between 1 and 999
8989
* (inclusive) when creating a new instance with node count = 0. Processing units from 1000 and
90-
* up must always be a multiple of 1000 (i.e. equal to an integer number of nodes).
90+
* up must always be a multiple of 1000 (that is equal to an integer number of nodes).
9191
*/
9292
public Builder setProcessingUnits(int processingUnits) {
9393
throw new UnsupportedOperationException("Unimplemented");

google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceAdminClientImplTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ public void testCreateInstanceWithBothNodeCountAndProcessingUnits() throws Excep
177177
} catch (IllegalArgumentException e) {
178178
assertTrue(
179179
e.getMessage()
180-
.contains(InstanceAdminClientImpl.NOT_BOTH_NODE_COUNT_AND_PROCESSING_UNITS));
180+
.contains(
181+
"Only one of nodeCount and processingUnits can be set when creating a new instance"));
181182
}
182183
}
183184

0 commit comments

Comments
 (0)