Repository navigation
test(spanner): unflake java8-samples #14938
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
Changes from all commits
8dfb300
1bdec0a
a66c079
f36c4a6
f6f7b62
7cb54e2
3ca66d4
87c6446
7792238
1689b39
098490a
9694ac2
12a6720
238a9e3
0149750
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -444,7 +444,7 @@ public void cancel() throws Exception { | |||||||||
| assertThat(list).containsExactlyElementsIn(createExpectedRows()); | ||||||||||
| } catch (ExecutionException e) { | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
sakthivelmanii marked this conversation as resolved.
Resolved
Comment on lines
446
to
+447
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.CANCELLED); | ||||||||||
| assertThat(cancelledIndexes).contains(index); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -176,7 +176,7 @@ public void toListAsyncPropagatesError() { | |||||||||
| ExecutionException.class, | ||||||||||
| () -> rs.toListAsync(ignored -> new Object(), executor).get()); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
178
to
+179
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||
| assertThat(se.getMessage()).contains("invalid query"); | ||||||||||
| } | ||||||||||
|
|
@@ -505,7 +505,7 @@ public void callbackReturnsError() throws InterruptedException { | |||||||||
| }); | ||||||||||
| ExecutionException e = assertThrows(ExecutionException.class, () -> rs.getResult().get()); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
507
to
+508
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.UNKNOWN); | ||||||||||
| assertThat(se.getMessage()).contains("async test"); | ||||||||||
| assertThat(callbackCounter.get()).isEqualTo(1); | ||||||||||
|
|
@@ -535,7 +535,7 @@ public void callbackReturnsErrorWhileBufferIsFull_shouldStopProducer() throws Ex | |||||||||
| ExecutionException e = | ||||||||||
| assertThrows(ExecutionException.class, () -> result.get(30L, TimeUnit.SECONDS)); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
537
to
+538
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.UNKNOWN); | ||||||||||
| assertThat(se.getMessage()).contains("async test"); | ||||||||||
| // The producer should stop and release the underlying result set. | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -139,7 +139,7 @@ public void asyncRunnerInvalidUpdate() throws Exception { | |||||||||
| runner.runAsync(txn -> txn.executeUpdateAsync(INVALID_UPDATE_STATEMENT), executor); | ||||||||||
| ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get()); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
141
to
+142
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||
| assertThat(se.getMessage()).contains("invalid statement"); | ||||||||||
| } | ||||||||||
|
|
@@ -288,7 +288,7 @@ public void asyncRunnerCommitFails() throws Exception { | |||||||||
| executor); | ||||||||||
| ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get()); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
290
to
+291
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||
| assertThat(se.getMessage()).contains("mutation limit exceeded"); | ||||||||||
| } | ||||||||||
|
|
@@ -358,7 +358,7 @@ public void asyncRunnerInvalidBatchUpdate() throws Exception { | |||||||||
| executor); | ||||||||||
| ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get()); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
360
to
+361
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||
| assertThat(se.getMessage()).contains("invalid statement"); | ||||||||||
| } | ||||||||||
|
|
@@ -505,7 +505,7 @@ public void asyncRunnerWithBatchUpdateCommitFails() throws Exception { | |||||||||
| executor); | ||||||||||
| ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get()); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
507
to
+508
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||
| assertThat(se.getMessage()).contains("mutation limit exceeded"); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1628,7 +1628,7 @@ public void runAsyncWithException() throws Exception { | |||||||||
|
|
||||||||||
| ExecutionException e = assertThrows(ExecutionException.class, fut::get); | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
1630
to
+1631
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and to avoid redundant assertions, we can remove
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||
|
|
||||||||||
| executor.shutdown(); | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,7 +180,7 @@ protected boolean shouldCacheError(Exception e) { | |
| successCount++; | ||
| } catch (ExecutionException e) { | ||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||
| assertThat(((SpannerException) e.getCause()).getErrorCode()) | ||
| assertThat(SpannerExceptionFactory.asSpannerException(e.getCause()).getErrorCode()) | ||
|
Comment on lines
182
to
+183
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| .isEqualTo(ErrorCode.UNAVAILABLE); | ||
| failureCount++; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -67,6 +67,7 @@ | |||||||||
| import org.junit.experimental.categories.Category; | ||||||||||
| import org.junit.runner.RunWith; | ||||||||||
| import org.junit.runners.JUnit4; | ||||||||||
| import com.google.cloud.spanner.SpannerExceptionFactory; | ||||||||||
|
|
||||||||||
| /** Integration tests for asynchronous APIs. */ | ||||||||||
| @Category(ParallelIntegrationTest.class) | ||||||||||
|
|
@@ -269,7 +270,7 @@ public void tableNotFound() throws Exception { | |||||||||
| row.get(); | ||||||||||
| } catch (ExecutionException e) { | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
272
to
+273
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.NOT_FOUND); | ||||||||||
| assertThat(se.getMessage()).contains("BadTableName"); | ||||||||||
| } | ||||||||||
|
|
@@ -285,7 +286,7 @@ public void columnNotFound() throws Exception { | |||||||||
| row.get(); | ||||||||||
| } catch (ExecutionException e) { | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
288
to
+289
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.NOT_FOUND); | ||||||||||
| assertThat(se.getMessage()).contains("BadColumnName"); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,6 +57,7 @@ | |||||||||
| import org.junit.experimental.categories.Category; | ||||||||||
| import org.junit.runner.RunWith; | ||||||||||
| import org.junit.runners.JUnit4; | ||||||||||
| import com.google.cloud.spanner.SpannerExceptionFactory; | ||||||||||
|
|
||||||||||
| /** Integration tests for asynchronous APIs. */ | ||||||||||
| @Category(ParallelIntegrationTest.class) | ||||||||||
|
|
@@ -503,7 +504,7 @@ public void cancel() throws Exception { | |||||||||
| fail("missing expected exception"); | ||||||||||
| } catch (ExecutionException e) { | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
506
to
+507
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||
| assertThat(se.getErrorCode()).isEqualTo(ErrorCode.CANCELLED); | ||||||||||
| assertThat(values).containsExactly("v0"); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,8 @@ | |||||||||||
| import org.junit.experimental.categories.Category; | ||||||||||||
| import org.junit.runner.RunWith; | ||||||||||||
| import org.junit.runners.JUnit4; | ||||||||||||
| import com.google.cloud.spanner.SpannerExceptionFactory; | ||||||||||||
| import java.util.concurrent.ExecutionException; | ||||||||||||
|
|
||||||||||||
| @Category(ParallelIntegrationTest.class) | ||||||||||||
| @RunWith(JUnit4.class) | ||||||||||||
|
|
@@ -112,7 +114,7 @@ public void returnsTheVersionRetentionPeriodSetThroughGetDatabase() throws Excep | |||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @Test(expected = DatabaseNotFoundException.class) | ||||||||||||
| public void returnsAnErrorWhenAnInvalidVersionRetentionPeriodIsGiven() { | ||||||||||||
| public void returnsAnErrorWhenAnInvalidVersionRetentionPeriodIsGiven() throws Exception { | ||||||||||||
|
Comment on lines
116
to
+117
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||
| final String instanceId = testHelper.getInstanceId().getInstance(); | ||||||||||||
| final String databaseId = testHelper.getUniqueDatabaseId(); | ||||||||||||
| final String extraStatement = | ||||||||||||
|
|
@@ -121,8 +123,8 @@ public void returnsAnErrorWhenAnInvalidVersionRetentionPeriodIsGiven() { | |||||||||||
| try { | ||||||||||||
| createDatabase(instanceId, databaseId, extraStatement); | ||||||||||||
| fail("Expected invalid argument error when setting invalid version retention period"); | ||||||||||||
| } catch (Exception e) { | ||||||||||||
| SpannerException spannerException = (SpannerException) e.getCause(); | ||||||||||||
| } catch (ExecutionException e) { | ||||||||||||
| SpannerException spannerException = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||||
| assertThat(spannerException.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,6 +57,7 @@ | |||||||||
| import org.junit.runners.Parameterized; | ||||||||||
| import org.junit.runners.Parameterized.Parameter; | ||||||||||
| import org.junit.runners.Parameterized.Parameters; | ||||||||||
| import com.google.cloud.spanner.SpannerExceptionFactory; | ||||||||||
|
|
||||||||||
| @RunWith(Parameterized.class) | ||||||||||
| @Category(ParallelIntegrationTest.class) | ||||||||||
|
|
@@ -160,7 +161,7 @@ public void testInvalidInsert() throws InterruptedException { | |||||||||
| txn = manager.resetForRetryAsync(); | ||||||||||
| } catch (ExecutionException e) { | ||||||||||
| assertThat(e.getCause()).isInstanceOf(SpannerException.class); | ||||||||||
| SpannerException se = (SpannerException) e.getCause(); | ||||||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||||||
|
Comment on lines
163
to
+164
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assertion
Suggested change
|
||||||||||
| if (env.getTestHelper() | ||||||||||
| .getOptions() | ||||||||||
| .getSessionPoolOptions() | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.