From 701b745a553d118cc865f009f57c38767b049d66 Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Tue, 8 Oct 2024 08:10:24 -0400 Subject: [PATCH] Make ScyllaSniProxyTest tests to wait before checking on events API (#359) calls ScyllaSniProxyTest tests creates a table and right away check of listener APIs. Since listener API is called asynchronously it can fail. --- .../java/com/datastax/driver/core/ScyllaSniProxyTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/driver-core/src/test/java/com/datastax/driver/core/ScyllaSniProxyTest.java b/driver-core/src/test/java/com/datastax/driver/core/ScyllaSniProxyTest.java index 84513ba7dfc..32c56c0d819 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/ScyllaSniProxyTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/ScyllaSniProxyTest.java @@ -69,6 +69,10 @@ public void onTableAdded(TableMetadata table) { // Sometimes (probably due to reconnection) both events can be read twice // assertingListener ensures we deal with the same keyspace and table + try { + Thread.sleep(1000); + } catch (InterruptedException ignored) { + } verify(listener, atLeast(1)).onTableAdded(any(TableMetadata.class)); verify(listener, atMost(2)).onTableAdded(any(TableMetadata.class)); verify(listener, atLeast(1)).onKeyspaceAdded(any(KeyspaceMetadata.class));