Skip to content

Commit 693380f

Browse files
committed
Fix sync it (#28588)
1 parent 20e11a6 commit 693380f

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class BigtableResourceManager implements ResourceManager {
9696
private final Set<String> cdcEnabledTables;
9797

9898
private boolean hasInstance;
99-
private Iterable<BigtableResourceManagerCluster> clusters;
99+
private List<BigtableResourceManagerCluster> clusters;
100100

101101
private final boolean usingStaticInstance;
102102

@@ -195,12 +195,12 @@ public String getInstanceId() {
195195
/**
196196
* Creates a Bigtable instance in which all clusters, nodes and tables will exist.
197197
*
198-
* @param clusters Collection of BigtableResourceManagerCluster objects to associate with the
199-
* given Bigtable instance.
198+
* @param clusters List of BigtableResourceManagerCluster objects to associate with the given
199+
* Bigtable instance.
200200
* @throws BigtableResourceManagerException if there is an error creating the instance in
201201
* Bigtable.
202202
*/
203-
public synchronized void createInstance(Iterable<BigtableResourceManagerCluster> clusters)
203+
public synchronized void createInstance(List<BigtableResourceManagerCluster> clusters)
204204
throws BigtableResourceManagerException {
205205

206206
// Check to see if instance already exists, and throw error if it does
@@ -559,7 +559,7 @@ public List<String> getClusterNames() {
559559
}
560560

561561
private Iterable<BigtableResourceManagerCluster> getClusters() {
562-
if (usingStaticInstance && this.clusters == null) {
562+
if (usingStaticInstance && this.clusters.isEmpty()) {
563563
try (BigtableInstanceAdminClient instanceAdminClient =
564564
bigtableResourceManagerClientFactory.bigtableInstanceAdminClient()) {
565565
List<BigtableResourceManagerCluster> managedClusters = new ArrayList<>();

it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import com.google.cloud.bigtable.admin.v2.models.StorageType;
2323
import java.time.format.DateTimeFormatter;
24+
import java.util.List;
2425
import java.util.regex.Pattern;
2526
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
2627

@@ -51,9 +52,9 @@ private BigtableResourceManagerUtils() {}
5152
* @param zone the zone/region that the cluster will be deployed to.
5253
* @param numNodes the number of nodes that the cluster will contain.
5354
* @param storageType the type of storage to configure the cluster with (SSD or HDD).
54-
* @return Collection containing a single BigtableResourceManagerCluster object.
55+
* @return List containing a single BigtableResourceManagerCluster object.
5556
*/
56-
static Iterable<BigtableResourceManagerCluster> generateDefaultClusters(
57+
static List<BigtableResourceManagerCluster> generateDefaultClusters(
5758
String baseString, String zone, int numNodes, StorageType storageType) {
5859

5960
String clusterId =

it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.io.IOException;
4141
import java.util.ArrayList;
4242
import java.util.HashMap;
43+
import java.util.List;
4344
import java.util.Map;
4445
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
4546
import org.junit.Before;
@@ -73,7 +74,7 @@ public class BigtableResourceManagerTest {
7374
private static final StorageType CLUSTER_STORAGE_TYPE = StorageType.SSD;
7475

7576
private BigtableResourceManager testManager;
76-
private Iterable<BigtableResourceManagerCluster> cluster;
77+
private List<BigtableResourceManagerCluster> cluster;
7778

7879
@Before
7980
public void setUp() throws IOException {

0 commit comments

Comments
 (0)