Skip to content

Commit

Permalink
Fixed flaky QueryService test
Browse files Browse the repository at this point in the history
  • Loading branch information
alex268 committed Sep 8, 2024
1 parent 38869a6 commit fd63f5b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion query/src/test/java/tech/ydb/query/TableExampleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -316,13 +318,29 @@ public void step07_scanQueryWithParams() {
"$seasonId", PrimitiveValue.newUint64(1)
);

final List<String> episodeTitle = new ArrayList<>();
final List<String> seasonTitle = new ArrayList<>();
final List<String> seriesTitle = new ArrayList<>();

retryCtx.supplyStatus(session -> {
episodeTitle.clear();
seasonTitle.clear();
seriesTitle.clear();

ExecuteScanQuerySettings settings = ExecuteScanQuerySettings.newBuilder().build();
GrpcReadStream<ResultSetReader> 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
Expand Down

0 comments on commit fd63f5b

Please sign in to comment.