From fd63f5b9b5ed34bd3bdcd98cfd89a2337a26e8ac Mon Sep 17 00:00:00 2001 From: Alexandr Gorshenin Date: Sun, 8 Sep 2024 09:59:26 +0100 Subject: [PATCH] Fixed flaky QueryService test --- .../java/tech/ydb/query/TableExampleTest.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/query/src/test/java/tech/ydb/query/TableExampleTest.java b/query/src/test/java/tech/ydb/query/TableExampleTest.java index fbbb140e..e42e2431 100644 --- a/query/src/test/java/tech/ydb/query/TableExampleTest.java +++ b/query/src/test/java/tech/ydb/query/TableExampleTest.java @@ -3,7 +3,9 @@ import java.time.Instant; import java.time.LocalDate; import java.time.Month; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -316,13 +318,29 @@ public void step07_scanQueryWithParams() { "$seasonId", PrimitiveValue.newUint64(1) ); + final List episodeTitle = new ArrayList<>(); + final List seasonTitle = new ArrayList<>(); + final List seriesTitle = new ArrayList<>(); + retryCtx.supplyStatus(session -> { + episodeTitle.clear(); + seasonTitle.clear(); + seriesTitle.clear(); + ExecuteScanQuerySettings settings = ExecuteScanQuerySettings.newBuilder().build(); GrpcReadStream scan = session.executeScanQuery(query, params, settings); return scan.start(rs -> { - Assert.assertTrue(rs.next()); + while (rs.next()) { + episodeTitle.add(rs.getColumn("episode_title").getText()); + seasonTitle.add(rs.getColumn("season_title").getText()); + seriesTitle.add(rs.getColumn("series_title").getText()); + } }); }).join().expectSuccess("scan query problem"); + + Assert.assertEquals(14, episodeTitle.size()); + Assert.assertEquals(14, seasonTitle.size()); + Assert.assertEquals(14, seriesTitle.size()); } @Test