Skip to content

Commit 3e30e7b

Browse files
committed
added token conflict accord tests for single node
1 parent de2871a commit 3e30e7b

File tree

5 files changed

+91
-10
lines changed

5 files changed

+91
-10
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@
2424
import org.apache.cassandra.distributed.api.ConsistencyLevel;
2525
import org.apache.cassandra.service.consensus.TransactionalMode;
2626

27-
public class AccordInteropSingleNodeTokenConflictTest extends SingleNodeTokenConflictTest
27+
public class AccordInteropSingleNodeTokenConflictBase extends SingleNodeTokenConflictTest
2828
{
29-
public AccordInteropSingleNodeTokenConflictTest()
29+
public AccordInteropSingleNodeTokenConflictBase(TransactionalMode transactionalMode)
3030
{
31-
super(TransactionalMode.full);
31+
super(transactionalMode);
3232
}
3333

3434
@Override
35-
protected void preCheck(Property.StatefulBuilder builder)
35+
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
3636
{
37-
// if a failing seed is detected, populate here
38-
// Example: builder.withSeed(42L);
37+
AccordInteropSingleNodeTableWalkBase.addUncaughtExceptionsFilter(cluster);
3938
}
4039

4140
@Override
@@ -46,7 +45,7 @@ protected State createState(RandomSource rs, Cluster cluster)
4645

4746
private class AccordInteropState extends State
4847
{
49-
public AccordInteropState(RandomSource rs, Cluster cluster)
48+
AccordInteropState(RandomSource rs, Cluster cluster)
5049
{
5150
super(rs, cluster);
5251
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.cassandra.distributed.test.cql3;
20+
21+
import accord.utils.Property;
22+
import org.apache.cassandra.distributed.Cluster;
23+
import org.apache.cassandra.service.consensus.TransactionalMode;
24+
25+
public class FullAccordInteropSingleNodeTokenConflictTest extends AccordInteropSingleNodeTokenConflictBase
26+
{
27+
public FullAccordInteropSingleNodeTokenConflictTest()
28+
{
29+
super(TransactionalMode.full);
30+
}
31+
32+
@Override
33+
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
34+
{
35+
super.preCheck(cluster, builder);
36+
// if a failing seed is detected, populate here
37+
// Example: builder.withSeed(42L);
38+
// CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value
39+
// CQL_DEBUG_APPLY_OPERATOR = true;
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.cassandra.distributed.test.cql3;
20+
21+
import accord.utils.Property;
22+
import org.apache.cassandra.distributed.Cluster;
23+
import org.apache.cassandra.service.consensus.TransactionalMode;
24+
25+
public class MixedReadsAccordInteropSingleNodeTokenConflictTest extends AccordInteropSingleNodeTokenConflictBase
26+
{
27+
public MixedReadsAccordInteropSingleNodeTokenConflictTest()
28+
{
29+
super(TransactionalMode.mixed_reads);
30+
}
31+
32+
@Override
33+
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
34+
{
35+
super.preCheck(cluster, builder);
36+
// if a failing seed is detected, populate here
37+
// Example: builder.withSeed(42L);
38+
// CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value
39+
// CQL_DEBUG_APPLY_OPERATOR = true;
40+
}
41+
}

test/distributed/org/apache/cassandra/distributed/test/cql3/MultiNodeTokenConflictTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
public class MultiNodeTokenConflictTest extends SingleNodeTokenConflictTest
2929
{
3030
@Override
31-
protected void preCheck(Property.StatefulBuilder builder)
31+
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
3232
{
3333
// if a failing seed is detected, populate here
3434
// Example: builder.withSeed(42L);

test/distributed/org/apache/cassandra/distributed/test/cql3/SingleNodeTokenConflictTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public SingleNodeTokenConflictTest()
101101
this(null);
102102
}
103103

104-
protected void preCheck(Property.StatefulBuilder builder)
104+
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
105105
{
106106
// if a failing seed is detected, populate here
107107
// Example: builder.withSeed(42L);
@@ -264,7 +264,7 @@ public void test() throws IOException
264264
try (Cluster cluster = createCluster())
265265
{
266266
Property.StatefulBuilder statefulBuilder = stateful().withExamples(10);
267-
preCheck(statefulBuilder);
267+
preCheck(cluster, statefulBuilder);
268268
statefulBuilder.check(commands(() -> rs -> createState(rs, cluster))
269269
.add(StatefulASTBase::insert)
270270
.add(SingleNodeTokenConflictTest::pkEq)

0 commit comments

Comments
 (0)