14
14
import java .io .IOException ;
15
15
import java .util .List ;
16
16
17
- import org .awaitility .Awaitility ;
18
17
import org .testng .SkipException ;
19
18
import org .testng .annotations .AfterClass ;
20
19
import org .testng .annotations .Test ;
@@ -40,23 +39,25 @@ public class TestRediSearchConnectorSmokeTest extends BaseConnectorSmokeTest {
40
39
41
40
private RediSearchServer redisearch ;
42
41
43
- private void populateBeers () throws IOException {
42
+ private void populateBeers () throws IOException , InterruptedException {
44
43
deleteBeers ();
45
44
Beers .populateIndex (redisearch .getTestContext ().getConnection ());
46
45
}
47
46
48
- private void createBeersIndex () {
47
+ private void createBeersIndex () throws InterruptedException {
49
48
deleteBeers ();
50
49
Beers .createIndex (redisearch .getTestContext ().getConnection ());
51
50
}
52
51
53
- private void deleteBeers () {
52
+ private void deleteBeers () throws InterruptedException {
54
53
try {
55
54
redisearch .getTestContext ().sync ().ftDropindexDeleteDocs (Beers .INDEX );
56
55
} catch (Exception e ) {
57
56
// ignore
58
57
}
59
- Awaitility .await ().until (() -> redisearch .getTestContext ().sync ().dbsize () == 0 );
58
+ while (redisearch .getTestContext ().sync ().dbsize () > 0 ) {
59
+ Thread .sleep (10 );
60
+ }
60
61
}
61
62
62
63
@ Override
@@ -126,19 +127,19 @@ protected QueryRunner createQueryRunner() throws Exception {
126
127
}
127
128
128
129
@ Test
129
- public void testNonIndexedFields () throws IOException {
130
+ public void testNonIndexedFields () throws IOException , InterruptedException {
130
131
populateBeers ();
131
132
getQueryRunner ().execute ("select id, last_mod from beers" );
132
133
}
133
134
134
135
@ Test
135
- public void testBuiltinFields () throws IOException {
136
+ public void testBuiltinFields () throws IOException , InterruptedException {
136
137
populateBeers ();
137
138
getQueryRunner ().execute ("select _id, _score from beers" );
138
139
}
139
140
140
141
@ Test
141
- public void testCountEmptyIndex () throws IOException {
142
+ public void testCountEmptyIndex () throws IOException , InterruptedException {
142
143
createBeersIndex ();
143
144
assertQuery ("SELECT count(*) FROM beers" , "VALUES 0" );
144
145
}
@@ -165,7 +166,7 @@ public void testShowCreateTable() {
165
166
}
166
167
167
168
@ Test
168
- public void testInsertIndex () throws IOException {
169
+ public void testInsertIndex () throws IOException , InterruptedException {
169
170
createBeersIndex ();
170
171
assertUpdate ("INSERT INTO beers (id, name) VALUES ('abc', 'mybeer')" , 1 );
171
172
assertThat (query ("SELECT id, name FROM beers" )).matches ("VALUES (VARCHAR 'abc', VARCHAR 'mybeer')" );
0 commit comments