Skip to content
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

fix: drop databases after sample tests #1401

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -61,30 +61,26 @@ public static void beforeClass() {
@AfterClass
public static void afterClass() {
for (String databaseId : idGenerator.getDatabaseIds()) {
System.out.println("Trying to drop " + databaseId);
try {
// If the database is not found, it is ignored (no exception is thrown)
databaseAdminClient.dropDatabase(instanceId, databaseId);
} catch (Exception e1) {
try {
databaseAdminClient.dropDatabase(multiRegionalInstanceId, databaseId);
} catch (Exception e2) {
System.out.println(
"Failed to drop database " + databaseId + " due to " + e2.getMessage()
+ ", skipping..."
);
}
databaseAdminClient.dropDatabase(multiRegionalInstanceId, databaseId);
} catch (Exception e) {
System.out.println(
"Failed to drop database " + databaseId + " due to " + e.getMessage() + ", skipping..."
);
}
}
for (String backupId : idGenerator.getBackupIds()) {
try {
// If the backup is not found, it is ignored (no exception is thrown)
databaseAdminClient.deleteBackup(instanceId, backupId);
} catch (Exception e1) {
try {
databaseAdminClient.deleteBackup(multiRegionalInstanceId, backupId);
} catch (Exception e2) {
System.out.println(
"Failed to delete backup " + backupId + " due to " + e2.getMessage() + ", skipping..."
);
}
databaseAdminClient.deleteBackup(multiRegionalInstanceId, backupId);
} catch (Exception e) {
System.out.println(
"Failed to delete backup " + backupId + " due to " + e.getMessage() + ", skipping..."
);
}
}
spanner.close();
Expand Down