Skip to content

Commit

Permalink
added token conflict accord tests for single node
Browse files Browse the repository at this point in the history
  • Loading branch information
dcapwell committed Jan 31, 2025
1 parent de2871a commit 3e30e7b
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@
import org.apache.cassandra.distributed.api.ConsistencyLevel;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class AccordInteropSingleNodeTokenConflictTest extends SingleNodeTokenConflictTest
public class AccordInteropSingleNodeTokenConflictBase extends SingleNodeTokenConflictTest
{
public AccordInteropSingleNodeTokenConflictTest()
public AccordInteropSingleNodeTokenConflictBase(TransactionalMode transactionalMode)
{
super(TransactionalMode.full);
super(transactionalMode);
}

@Override
protected void preCheck(Property.StatefulBuilder builder)
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
AccordInteropSingleNodeTableWalkBase.addUncaughtExceptionsFilter(cluster);
}

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

private class AccordInteropState extends State
{
public AccordInteropState(RandomSource rs, Cluster cluster)
AccordInteropState(RandomSource rs, Cluster cluster)
{
super(rs, cluster);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.cassandra.distributed.test.cql3;

import accord.utils.Property;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class FullAccordInteropSingleNodeTokenConflictTest extends AccordInteropSingleNodeTokenConflictBase
{
public FullAccordInteropSingleNodeTokenConflictTest()
{
super(TransactionalMode.full);
}

@Override
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
super.preCheck(cluster, builder);
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
// CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value
// CQL_DEBUG_APPLY_OPERATOR = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.cassandra.distributed.test.cql3;

import accord.utils.Property;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.service.consensus.TransactionalMode;

public class MixedReadsAccordInteropSingleNodeTokenConflictTest extends AccordInteropSingleNodeTokenConflictBase
{
public MixedReadsAccordInteropSingleNodeTokenConflictTest()
{
super(TransactionalMode.mixed_reads);
}

@Override
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
super.preCheck(cluster, builder);
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
// CQL operations may have opertors such as +, -, and / (example 4 + 4), to "apply" them to get a constant value
// CQL_DEBUG_APPLY_OPERATOR = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class MultiNodeTokenConflictTest extends SingleNodeTokenConflictTest
{
@Override
protected void preCheck(Property.StatefulBuilder builder)
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public SingleNodeTokenConflictTest()
this(null);
}

protected void preCheck(Property.StatefulBuilder builder)
protected void preCheck(Cluster cluster, Property.StatefulBuilder builder)
{
// if a failing seed is detected, populate here
// Example: builder.withSeed(42L);
Expand Down Expand Up @@ -264,7 +264,7 @@ public void test() throws IOException
try (Cluster cluster = createCluster())
{
Property.StatefulBuilder statefulBuilder = stateful().withExamples(10);
preCheck(statefulBuilder);
preCheck(cluster, statefulBuilder);
statefulBuilder.check(commands(() -> rs -> createState(rs, cluster))
.add(StatefulASTBase::insert)
.add(SingleNodeTokenConflictTest::pkEq)
Expand Down

0 comments on commit 3e30e7b

Please sign in to comment.