Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit 8d6d763

Browse files
committed
test: attempt to fix flaky test that throws NPE
1 parent 62a1812 commit 8d6d763

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,10 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
12151215
// Setup
12161216
Mockito.when(mockStub.createAppProfileCallable()).thenReturn(mockCreateAppProfileCallable);
12171217

1218+
Set<String> clusterIds = new HashSet<String>();
1219+
clusterIds.add("cluster-id-1");
1220+
clusterIds.add("cluster-id-2");
1221+
12181222
com.google.bigtable.admin.v2.CreateAppProfileRequest expectedRequest =
12191223
com.google.bigtable.admin.v2.CreateAppProfileRequest.newBuilder()
12201224
.setParent(NameUtil.formatInstanceName(PROJECT_ID, INSTANCE_ID))
@@ -1225,8 +1229,7 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
12251229
.setMultiClusterRoutingUseAny(
12261230
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
12271231
.newBuilder()
1228-
.addClusterIds("cluster-id-1")
1229-
.addClusterIds("cluster-id-2")
1232+
.addAllClusterIds(clusterIds)
12301233
.setRowAffinity(
12311234
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
12321235
.RowAffinity.newBuilder()
@@ -1239,8 +1242,7 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
12391242
.setDescription("my description")
12401243
.setMultiClusterRoutingUseAny(
12411244
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder()
1242-
.addClusterIds("cluster-id-1")
1243-
.addClusterIds("cluster-id-2")
1245+
.addAllClusterIds(clusterIds)
12441246
.setRowAffinity(
12451247
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
12461248
.RowAffinity.newBuilder()
@@ -1251,9 +1253,6 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
12511253
.thenReturn(ApiFutures.immediateFuture(expectedResponse));
12521254

12531255
// Execute
1254-
Set<String> clusterIds = new HashSet<String>();
1255-
clusterIds.add("cluster-id-1");
1256-
clusterIds.add("cluster-id-2");
12571256
AppProfile actualResult =
12581257
adminClient.createAppProfile(
12591258
CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID)

0 commit comments

Comments
 (0)