Skip to content

Commit 81fcacd

Browse files
committed
Ensure CassandraIndexTest sets up properly when using SAI in the wake of CASSANDRA-20732
patch by Caleb Rackliffe; reviewed by Stefan Miklosovic for CASSANDRA-20740
1 parent f553ace commit 81fcacd

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@
2424
import java.util.stream.StreamSupport;
2525

2626
import com.google.common.base.Joiner;
27-
import com.google.common.collect.*;
27+
import com.google.common.collect.ImmutableMap;
28+
import com.google.common.collect.Iterators;
29+
import com.google.common.collect.Lists;
30+
import com.google.common.collect.Sets;
31+
import org.awaitility.Awaitility;
32+
import org.junit.BeforeClass;
2833
import org.junit.Test;
2934

3035
import org.apache.cassandra.Util;
@@ -42,9 +47,9 @@
4247
import org.apache.cassandra.schema.ColumnMetadata;
4348
import org.apache.cassandra.schema.SchemaConstants;
4449
import org.apache.cassandra.schema.TableMetadata;
50+
import org.apache.cassandra.service.StorageService;
4551
import org.apache.cassandra.utils.ByteBufferUtil;
4652
import org.apache.cassandra.utils.FBUtilities;
47-
import org.awaitility.Awaitility;
4853

4954
import static org.apache.cassandra.Util.throwAssert;
5055
import static org.junit.Assert.assertArrayEquals;
@@ -58,6 +63,12 @@
5863
*/
5964
public class CassandraIndexTest extends CQLTester
6065
{
66+
@BeforeClass
67+
public static void setup()
68+
{
69+
StorageService.instance.initServer(); // Ensure the node has advanced out of STARTING mode
70+
}
71+
6172
@Test
6273
public void indexOnRegularColumn() throws Throwable
6374
{

test/unit/org/apache/cassandra/index/sai/cql/EmptyStringLifecycleTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424
import org.apache.cassandra.cql3.UntypedResultSet;
2525
import org.apache.cassandra.index.sai.SAITester;
26+
import org.apache.cassandra.service.StorageService;
2627

2728
public class EmptyStringLifecycleTest extends SAITester
2829
{
2930
@BeforeClass
3031
public static void setup()
3132
{
32-
setUpClass();
33-
requireNetwork(); // Ensure the node has advanced out of STARTING mode
33+
StorageService.instance.initServer(); // Ensure the node has advanced out of STARTING mode
3434
}
3535

3636
@Test

test/unit/org/apache/cassandra/index/sai/functional/FailureTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
package org.apache.cassandra.index.sai.functional;
2222

23+
import org.assertj.core.api.Assertions;
2324
import org.junit.BeforeClass;
2425
import org.junit.Test;
2526

@@ -31,7 +32,7 @@
3132
import org.apache.cassandra.index.sai.utils.IndexTermType;
3233
import org.apache.cassandra.inject.Injection;
3334
import org.apache.cassandra.inject.Injections;
34-
import org.assertj.core.api.Assertions;
35+
import org.apache.cassandra.service.StorageService;
3536

3637
import static org.junit.Assert.assertEquals;
3738

@@ -40,8 +41,7 @@ public class FailureTest extends SAITester
4041
@BeforeClass
4142
public static void setup()
4243
{
43-
setUpClass();
44-
requireNetwork(); // Ensure the node has advanced out of STARTING mode
44+
StorageService.instance.initServer(); // Ensure the node has advanced out of STARTING mode
4545
}
4646

4747
@Test

test/unit/org/apache/cassandra/index/sai/virtual/IndexesSystemViewTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.cassandra.inject.Injections;
3030
import org.apache.cassandra.inject.InvokePointBuilder;
3131
import org.apache.cassandra.schema.SchemaConstants;
32+
import org.apache.cassandra.service.StorageService;
3233

3334
/**
3435
* Tests the virtual table exposing storage-attached column index metadata.
@@ -59,8 +60,7 @@ public static void setup()
5960
{
6061
VirtualKeyspaceRegistry.instance.register(new VirtualKeyspace(SchemaConstants.VIRTUAL_VIEWS, ImmutableList.of(new ColumnIndexesSystemView(SchemaConstants.VIRTUAL_VIEWS))));
6162

62-
setUpClass();
63-
requireNetwork(); // Ensure the node has advanced out of STARTING mode
63+
StorageService.instance.initServer(); // Ensure the node has advanced out of STARTING mode
6464
}
6565

6666
@Test

0 commit comments

Comments
 (0)