Skip to content

Commit 745b853

Browse files
authored
test: unflake ITDmlReturningTest (googleapis#3695)
Fixes googleapis#3575 Fixes googleapis#3342 Fixes googleapis#3274 Fixes googleapis#3174 Fixes googleapis#3169 Fixes googleapis#3059 Fixes googleapis#3002
1 parent 9108ee4 commit 745b853

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITDmlReturningTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ private List<Struct> executeQuery(long expectedCount, String stmt) {
272272
List<Struct> rows = new ArrayList<>();
273273
final TransactionCallable<Void> callable =
274274
transaction -> {
275+
// Make sure we start with an empty list if the transaction is aborted and retried.
276+
rows.clear();
275277
ResultSet resultSet = transaction.executeQuery(Statement.of(stmt));
276278
// resultSet.next() returns false, when no more row exists.
277279
// So, number of times resultSet.next() returns true, is the number of rows
@@ -335,6 +337,7 @@ private List<Struct> executeQueryAsync(long expectedCount, String stmt) {
335337
List<Struct> rows = new ArrayList<>();
336338
final TransactionCallable<Void> callable =
337339
transaction -> {
340+
rows.clear();
338341
AsyncResultSet rs = transaction.executeQueryAsync(Statement.of(stmt));
339342
rs.setCallback(
340343
Executors.newSingleThreadExecutor(),

0 commit comments

Comments
 (0)