Skip to content

Commit 7132d5b

Browse files
author
Julien Ruaux
committed
test: Replaced Awaitility with Thread.sleep
1 parent c49b497 commit 7132d5b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@
393393
<artifactId>testng</artifactId>
394394
<scope>test</scope>
395395
</dependency>
396+
396397
</dependencies>
397398

398399
<build>

src/test/java/com/redis/trino/TestRediSearchConnectorSmokeTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.io.IOException;
1515
import java.util.List;
1616

17-
import org.awaitility.Awaitility;
1817
import org.testng.SkipException;
1918
import org.testng.annotations.AfterClass;
2019
import org.testng.annotations.Test;
@@ -40,23 +39,25 @@ public class TestRediSearchConnectorSmokeTest extends BaseConnectorSmokeTest {
4039

4140
private RediSearchServer redisearch;
4241

43-
private void populateBeers() throws IOException {
42+
private void populateBeers() throws IOException, InterruptedException {
4443
deleteBeers();
4544
Beers.populateIndex(redisearch.getTestContext().getConnection());
4645
}
4746

48-
private void createBeersIndex() {
47+
private void createBeersIndex() throws InterruptedException {
4948
deleteBeers();
5049
Beers.createIndex(redisearch.getTestContext().getConnection());
5150
}
5251

53-
private void deleteBeers() {
52+
private void deleteBeers() throws InterruptedException {
5453
try {
5554
redisearch.getTestContext().sync().ftDropindexDeleteDocs(Beers.INDEX);
5655
} catch (Exception e) {
5756
// ignore
5857
}
59-
Awaitility.await().until(() -> redisearch.getTestContext().sync().dbsize() == 0);
58+
while (redisearch.getTestContext().sync().dbsize() > 0) {
59+
Thread.sleep(10);
60+
}
6061
}
6162

6263
@Override
@@ -126,19 +127,19 @@ protected QueryRunner createQueryRunner() throws Exception {
126127
}
127128

128129
@Test
129-
public void testNonIndexedFields() throws IOException {
130+
public void testNonIndexedFields() throws IOException, InterruptedException {
130131
populateBeers();
131132
getQueryRunner().execute("select id, last_mod from beers");
132133
}
133134

134135
@Test
135-
public void testBuiltinFields() throws IOException {
136+
public void testBuiltinFields() throws IOException, InterruptedException {
136137
populateBeers();
137138
getQueryRunner().execute("select _id, _score from beers");
138139
}
139140

140141
@Test
141-
public void testCountEmptyIndex() throws IOException {
142+
public void testCountEmptyIndex() throws IOException, InterruptedException {
142143
createBeersIndex();
143144
assertQuery("SELECT count(*) FROM beers", "VALUES 0");
144145
}
@@ -165,7 +166,7 @@ public void testShowCreateTable() {
165166
}
166167

167168
@Test
168-
public void testInsertIndex() throws IOException {
169+
public void testInsertIndex() throws IOException, InterruptedException {
169170
createBeersIndex();
170171
assertUpdate("INSERT INTO beers (id, name) VALUES ('abc', 'mybeer')", 1);
171172
assertThat(query("SELECT id, name FROM beers")).matches("VALUES (VARCHAR 'abc', VARCHAR 'mybeer')");

0 commit comments

Comments
 (0)