Skip to content

Spanner IT test: adding a prefix to db to allow for concurrent runs #867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -39,7 +40,7 @@
public class SpannerSampleIT {
// The instance needs to exist for tests to pass.
private final String instanceId = System.getProperty("spanner.test.instance");
private final String databaseId = System.getProperty("spanner.sample.database");
private final String databaseId = formatForTest(System.getProperty("spanner.sample.database"));
DatabaseId dbId;
DatabaseAdminClient dbClient;
private long lastUpdateDataTimeInMillis;
Expand Down Expand Up @@ -116,4 +117,8 @@ public void testSample() throws Exception {
out = runSample("readonlytransaction");
assertThat(out.replaceAll("[\r\n]+", " ")).containsMatch("(Total Junk.*){2}");
}

private String formatForTest(String name) {
return name + "-" + UUID.randomUUID().toString().substring(0, 20);
}
}