File tree Expand file tree Collapse file tree
google-cloud-spanner/src/main/java/com/google/cloud/spanner/testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727import java .util .ArrayList ;
2828import java .util .Arrays ;
2929import java .util .List ;
30+ import java .util .Random ;
3031import java .util .logging .Level ;
3132import java .util .logging .Logger ;
3233
@@ -41,6 +42,7 @@ public class RemoteSpannerHelper {
4142 private final Spanner client ;
4243 private final InstanceId instanceId ;
4344 private static int dbSeq ;
45+ private static int dbPrefix = new Random ().nextInt (Integer .MAX_VALUE );
4446 private final List <Database > dbs = new ArrayList <>();
4547
4648 private RemoteSpannerHelper (SpannerOptions options , InstanceId instanceId , Spanner client ) {
@@ -78,7 +80,7 @@ public Database createTestDatabase(String... statements) throws SpannerException
7880 * Returns a database id which is guaranteed to be unique within the context of this environment.
7981 */
8082 public String getUniqueDatabaseId () {
81- return String .format ("testdb_%04d" , dbSeq ++);
83+ return String .format ("testdb_%d_% 04d" , dbPrefix , dbSeq ++);
8284 }
8385
8486 /**
You can’t perform that action at this time.
0 commit comments