Merged
Changes from 1 commit
Show all changes
28 commits
Select commit Hold shift + click to select a range
753dfce
feat: add backup support
olavloiteMar 13, 2020
c65f25a
fix: add interface changes to ignore
olavloiteMar 13, 2020
7e918ee
tests: fix failing test cases
olavloiteMar 13, 2020
ae90f2b
fix: auto throttle administrative requests
olavloiteMar 16, 2020
4e0ff10
fix: reduce request rate
olavloiteMar 16, 2020
6c73067
tests: increase timeout to allow ITs to pass
olavloiteMar 16, 2020
ead8c35
tests: parallelize ITs to speed up build
olavloiteMar 16, 2020
37d134b
tests: further tuning of ITs
olavloiteMar 16, 2020
9d165f0
tests: increase timeout to test restore op
olavloiteMar 16, 2020
370e26d
logging: add logging of backup and db ids
olavloiteMar 17, 2020
d6b0ae2
fix: simplify restore test to check IT
olavloiteMar 18, 2020
671b951
test: add checking metadata again
olavloiteMar 18, 2020
0ed523e
test: list operations
olavloiteMar 18, 2020
fe89140
test: only list backup operations
olavloiteMar 18, 2020
5b5da55
test: skip listBackupOperations
olavloiteMar 18, 2020
60d1e1f
fix: skip all list operations
olavloiteMar 18, 2020
76003bb
fix: remove custom test env for backups
olavloiteMar 18, 2020
203137a
fix: use polling future instead of initial future
olavloiteMar 18, 2020
bc8e71c
fix: disable get metadata because of timeouts
olavloiteMar 18, 2020
c10f127
fix: remove all metadata tests because of timeouts
olavloiteMar 18, 2020
970288b
fix: re-introduce custom timeout settings
olavloiteMar 18, 2020
b1e07e3
fix: re-introduce custom timeouts
olavloiteMar 18, 2020
5a4ff73
fix: fix invalid retry settings
olavloiteMar 18, 2020
4577acb
test: remove retry codes
olavloiteMar 18, 2020
898835b
test: set custom retry settings based on gapic config
olavloiteMar 18, 2020
26f8c55
fix: update copyright year
olavloiteMar 18, 2020
87c8511
fix: run code formatter
olavloiteMar 18, 2020
6676e66
fix: include working retry settings in default admin client
olavloiteMar 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
PrevPrevious commit
Next Next commit
test: set custom retry settings based on gapic config
  • Loading branch information
@olavloite
olavloite committedMar 18, 2020
commit 898835b1990e52398b74df65a5a1d23f6c0c6677
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.paging.Page;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.StatusCode;
import com.google.api.gax.rpc.StatusCode.Code;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.Timestamp;
import com.google.cloud.spanner.Backup;
Expand DownExpand Up@@ -93,15 +91,24 @@ public SpannerOptions spannerOptions() {
OperationTimedPollAlgorithm pollingAlgorithm =
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofHours(48L))
.setMaxRpcTimeout(Duration.ofHours(48L))
.setInitialRpcTimeout(Duration.ofSeconds(60L))
.setMaxRpcTimeout(Duration.ofSeconds(600L))
.setInitialRetryDelay(Duration.ofSeconds(20L))
.setMaxRetryDelay(Duration.ofSeconds(45L))
.setRetryDelayMultiplier(1.5)
.setRpcTimeoutMultiplier(1.5)
.setTotalTimeout(Duration.ofHours(48L))
.build());

RetrySettings retrySettings =
RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofHours(48L))
.setMaxRpcTimeout(Duration.ofHours(48L))
.setInitialRpcTimeout(Duration.ofSeconds(60L))
.setMaxRpcTimeout(Duration.ofSeconds(600L))
.setInitialRetryDelay(Duration.ofSeconds(20L))
.setMaxRetryDelay(Duration.ofSeconds(45L))
.setRetryDelayMultiplier(1.5)
.setRpcTimeoutMultiplier(1.5)
.setTotalTimeout(Duration.ofHours(48L))
.build();
builder
.getDatabaseAdminStubSettingsBuilder()
Expand DownExpand Up@@ -154,6 +161,8 @@ protected void initializeConfig()
super.initializeConfig();
}
};
// @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv();


@Rule public ExpectedException expectedException = ExpectedException.none();
private DatabaseAdminClient dbAdminClient;
Expand DownExpand Up@@ -302,13 +311,9 @@ public void testBackups() throws InterruptedException, ExecutionException {
expireTime);
backups.add(backupId1);
backups.add(backupId2);
// Wait to prevent the test from exceeding the limit of administrative requests.
Thread.sleep(60_000L);

// Execute metadata tests as part of this integration test to reduce total execution time.
testMetadata(op1, op2, backupId1, backupId2, db1, db2);
// Wait to prevent the test from exceeding the limit of administrative requests.
Thread.sleep(60_000L);

// Ensure both backups have been created before we proceed.
Backup backup1 = op1.get();
Expand DownExpand Up@@ -402,15 +407,6 @@ private void testMetadata(
Database db2)
throws InterruptedException, ExecutionException {

logger.info("Getting initial operation 1 status");
StatusCode status1 = op1.getInitialFuture().get().getErrorCode();
Code code1 = status1 == null ? Code.OK : status1.getCode();
assertThat(code1).isEqualTo(Code.OK);
logger.info("Getting initial operation 2 status");
StatusCode status2 = op2.getInitialFuture().get().getErrorCode();
Code code2 = status2 == null ? Code.OK : status2.getCode();
assertThat(code2).isEqualTo(Code.OK);

logger.info("Getting operation metadata 1");
CreateBackupMetadata metadata1 = op1.getMetadata().get();
logger.info("Getting operation metadata 2");
Expand Down