Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ubuntu-24.04
strategy:
matrix:
scylla-version: [ENTERPRISE-RELEASE, OSS-RELEASE]
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'

- name: Setup Python 3
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Setup environment
run: |
pip3 install https://github.com/scylladb/scylla-ccm/archive/5392dd68748ee5e71f7fbad346667038437d2123.zip
CCM_PATH=$(which ccm)
sudo mkdir -p /usr/local/bin
sudo ln -sf ${CCM_PATH} /usr/local/bin/ccm

- name: Install get-version CLI
run: |
git clone https://github.com/scylladb-actions/get-version.git
cd get-version
go mod tidy
go build -o get-version

- name: Get scylla version
id: scylla-version
run: |
cd get-version
if [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RELEASE" ]]; then
echo "SCYLLA_VERSION=$(./get-version --source dockerhub-imagetag --repo scylladb/scylla-enterprise -filters "2024.1.LAST" | tr -d '\"')" >> $GITHUB_ENV
elif [[ "${{ matrix.scylla-version }}" == "OSS-RELEASE" ]]; then
echo "SCYLLA_VERSION=$(./get-version --source dockerhub-imagetag --repo scylladb/scylla -filters "6.1.LAST" | tr -d '\"')" >> $GITHUB_ENV
elif echo "${{ matrix.scylla-version }}" | grep -P '^[0-9\.]+'; then # If you want to run specific version do just that
echo "SCYLLA_VERSION=${{ matrix.scylla-version }}" >> $GITHUB_ENV
else
echo "Unknown scylla version name `${{ matrix.scylla-version }}`"
exit 1
fi

- name: Run integration tests on Scylla
run: SCYLLA_EXT_OPTS="--smp 2 --memory 4G" SIMULACRON_PATH=../../../../../ci/simulacron-standalone-0.12.0.jar dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -f net8 -l "console;verbosity=detailed" --filter "(FullyQualifiedName!~ClientWarningsTests & FullyQualifiedName!~CustomPayloadTests & FullyQualifiedName!~Connect_With_Ssl_Test & FullyQualifiedName!~Should_UpdateHosts_When_HostIpChanges & FullyQualifiedName!~Should_UseNewHostInQueryPlans_When_HostIsDecommissionedAndJoinsAgain & FullyQualifiedName!~Should_RemoveNodeMetricsAndDisposeMetricsContext_When_HostIsRemoved & FullyQualifiedName!~Virtual_Keyspaces_Are_Included & FullyQualifiedName!~Virtual_Table_Metadata_Test & FullyQualifiedName!~SessionAuthenticationTests & FullyQualifiedName!~TypeSerializersTests & FullyQualifiedName!~Custom_MetadataTest & FullyQualifiedName!~LinqWhere_WithVectors & FullyQualifiedName!~SimpleStatement_With_No_Compact_Enabled_Should_Reveal_Non_Schema_Columns & FullyQualifiedName!~SimpleStatement_With_No_Compact_Disabled_Should_Not_Reveal_Non_Schema_Columns & FullyQualifiedName!~ColumnClusteringOrderReversedTest & FullyQualifiedName!~GetMaterializedView_Should_Refresh_View_Metadata_Via_Events & FullyQualifiedName!~MaterializedView_Base_Table_Column_Addition & FullyQualifiedName!~MultipleSecondaryIndexTest & FullyQualifiedName!~RaiseErrorOnInvalidMultipleSecondaryIndexTest & FullyQualifiedName!~TableMetadataAllTypesTest & FullyQualifiedName!~TableMetadataClusteringOrderTest & FullyQualifiedName!~TableMetadataCollectionsSecondaryIndexTest & FullyQualifiedName!~TableMetadataCompositePartitionKeyTest & FullyQualifiedName!~TupleMetadataTest & FullyQualifiedName!~Udt_Case_Sensitive_Metadata_Test & FullyQualifiedName!~UdtMetadataTest & FullyQualifiedName!~Should_Retrieve_Table_Metadata & FullyQualifiedName!~CreateTable_With_Frozen_Key & FullyQualifiedName!~CreateTable_With_Frozen_Udt & FullyQualifiedName!~CreateTable_With_Frozen_Value & FullyQualifiedName!~Should_AllMetricsHaveValidValues_When_AllNodesAreUp & FullyQualifiedName!~SimpleStatement_Dictionary_Parameters_CaseInsensitivity_ExcessOfParams & FullyQualifiedName!~SimpleStatement_Dictionary_Parameters_CaseInsensitivity_NoOverload & FullyQualifiedName!~TokenAware_TransientReplication_NoHopsAndOnlyFullReplicas & FullyQualifiedName!~GetFunction_Should_Return_Most_Up_To_Date_Metadata_Via_Events & FullyQualifiedName!~LargeDataTests & FullyQualifiedName!~MetadataTests & FullyQualifiedName!~MultiThreadingTests & FullyQualifiedName!~PoolTests & FullyQualifiedName!~PrepareLongTests & FullyQualifiedName!~SpeculativeExecutionLongTests & FullyQualifiedName!~StressTests & FullyQualifiedName!~TransitionalAuthenticationTests & FullyQualifiedName!~ProxyAuthenticationTests & FullyQualifiedName!~SessionDseAuthenticationTests & FullyQualifiedName!~CloudIntegrationTests & FullyQualifiedName!~CoreGraphTests & FullyQualifiedName!~GraphTests & FullyQualifiedName!~InsightsIntegrationTests & FullyQualifiedName!~DateRangeTests & FullyQualifiedName!~FoundBugTests & FullyQualifiedName!~GeometryTests & FullyQualifiedName!~LoadBalancingPolicyTests & FullyQualifiedName!~ConsistencyTests & FullyQualifiedName!~LoadBalancingPolicyTests & FullyQualifiedName!~ReconnectionPolicyTests & FullyQualifiedName!~RetryPolicyTests)"
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

Binary file added ci/simulacron-standalone-0.12.0.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions src/Cassandra.IntegrationTests/Core/ClusterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ await TestGlobals.ConnectAndDispose(cluster, false, session =>
[Category(TestCategory.RealClusterLong)]
public async Task Should_Remove_Decommissioned_Node()
{
const int numberOfNodes = 2;
const int numberOfNodes = 3;
_realCluster = TestClusterManager.CreateNew(numberOfNodes);
var cluster = ClusterBuilder().AddContactPoint(_realCluster.InitialContactPoint).Build();

Expand All @@ -210,10 +210,10 @@ await TestGlobals.ConnectAndDispose(cluster, false, session =>
string decommisionedNode = null;
TestHelper.RetryAssert(() =>
{
decommisionedNode = _realCluster.ClusterIpPrefix + 2;
decommisionedNode = _realCluster.ClusterIpPrefix + 3;
Assert.False(TestUtils.IsNodeReachable(IPAddress.Parse(decommisionedNode)));
//New node should be part of the metadata
Assert.AreEqual(1, cluster.AllHosts().Count);
Assert.AreEqual(2, cluster.AllHosts().Count);
}, 100, 100);
var queried = false;
for (var i = 0; i < 10; i++)
Expand Down
24 changes: 11 additions & 13 deletions src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ protected override string[] SetupQueries
}
};

// COMPACT STORAGE is not supported by DSE 6.0 / C* 4.0.
if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.LessThan) ||
(TestClusterManager.IsDse && TestClusterManager.CheckDseVersion(new Version(6, 0), Comparison.LessThan)))
if (!TestClusterManager.IsScylla && TestClusterManager.CheckCassandraVersion(false, new Version(4, 0), Comparison.LessThan))
{
setupQueries.Add($"CREATE TABLE {TableCompactStorage} (key blob PRIMARY KEY, bar int, baz uuid)" +
$" WITH COMPACT STORAGE");
Expand Down Expand Up @@ -169,7 +167,7 @@ public void DateTimeOffset_Insert_Select_Test()
public void DateTime_Insert_Select_Test()
{
InsertSelectTest(new DateTime(2010, 4, 29, 19, 01, 02, 300, DateTimeKind.Utc), "timestamp_sample");
InsertSelectTest<DateTime?>(new DateTime(2005, 8, 5, 21, 01, 02, 300, DateTimeKind.Utc),
InsertSelectTest<DateTime?>(new DateTime(2005, 8, 5, 21, 01, 02, 300, DateTimeKind.Utc),
"timestamp_sample");
InsertSelectTest<DateTime?>(null, "timestamp_sample");
}
Expand Down Expand Up @@ -311,7 +309,7 @@ public void SimpleStatementNamedValuesNotSpecified()
var insertQuery = string.Format("INSERT INTO {0} (float_sample, text_sample, bigint_sample, id) VALUES (:MY_float, :my_TexT, :my_BIGint, :id)", AllTypesTableName);

Assert.Throws<InvalidQueryException>(() => Session.Execute(
new SimpleStatement(insertQuery,
new SimpleStatement(insertQuery,
new {id = Guid.NewGuid(), my_bigint = 1L })));
}

Expand Down Expand Up @@ -342,7 +340,7 @@ public void SimpleStatementTinyIntTests()
var values = new sbyte[] { sbyte.MinValue, -4, -3, 0, 1, 2, 126, sbyte.MaxValue };
foreach (var v in values)
{
var insert = new SimpleStatement("INSERT INTO tbl_tinyint_param (id, v, m) VALUES (?, ?, ?)",
var insert = new SimpleStatement("INSERT INTO tbl_tinyint_param (id, v, m) VALUES (?, ?, ?)",
Convert.ToInt32(v), v, new SortedDictionary<sbyte, string> { { v, v.ToString()} });
var select = new SimpleStatement("SELECT * FROM tbl_tinyint_param WHERE id = ?", Convert.ToInt32(v));
Session.Execute(insert);
Expand All @@ -358,7 +356,7 @@ public void SimpleStatementTinyIntTests()
public void SimpleStatementDateTests()
{
Session.Execute("CREATE TABLE tbl_date_param (id int PRIMARY KEY, v date, m map<date, text>)");
var values = new[] {
var values = new[] {
new LocalDate(2010, 4, 29),
new LocalDate(0, 3, 12),
new LocalDate(-10, 2, 4),
Expand Down Expand Up @@ -413,7 +411,7 @@ public void SimpleStatementTimeTests()

/// <summary>
/// Testing the usage of dictionary for named parameters.
///
///
/// @since 2.1.0
/// @jira_ticket CSHARP-406
/// @expected_result Replace the named parameters according to keys in dictionary
Expand All @@ -440,7 +438,7 @@ public void SimpleStatement_Dictionary_Parameters_CaseInsensitivity()

/// <summary>
/// Testing the usage of dictionary for named parameters, in such a case that the dictionary has more than one equal key (with different capital letters).
///
///
/// @since 2.1.0
/// @jira_ticket CSHARP-406
/// @expected_result The statement will use the first key in dictionary that match unregarding the case sensitivity
Expand Down Expand Up @@ -469,7 +467,7 @@ public void SimpleStatement_Dictionary_Parameters_CaseInsensitivity_NoOverload()

/// <summary>
/// Testing missing parameter in dictionary for named parameters.
///
///
/// @throws InvalidQueryException
///
/// @since 2.1.0
Expand All @@ -492,7 +490,7 @@ public void SimpleStatement_Dictionary_Parameters_CaseInsensitivity_MissingParam

/// <summary>
/// Testing the usage of dictionary for named parameters, in such a case that the dictionary has more keys than named parameters in statement.
///
///
/// @since 2.1.0
/// @jira_ticket CSHARP-406
/// @expected_result The statement will ignore the excess of parameters
Expand Down Expand Up @@ -549,7 +547,7 @@ public void SimpleStatement_With_Keyspace_Defined_On_Lower_Protocol_Versions()
[TestCassandraVersion(3, 11)]
public void SimpleStatement_With_No_Compact_Enabled_Should_Reveal_Non_Schema_Columns()
{
if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.GreaterThanOrEqualsTo) ||
if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.GreaterThanOrEqualsTo) ||
(TestClusterManager.IsDse && TestClusterManager.CheckDseVersion(new Version(6, 0), Comparison.GreaterThanOrEqualsTo)) ||
TestClusterManager.IsHcd)
{
Expand All @@ -572,7 +570,7 @@ public void SimpleStatement_With_No_Compact_Enabled_Should_Reveal_Non_Schema_Col
[TestCassandraVersion(3, 11)]
public void SimpleStatement_With_No_Compact_Disabled_Should_Not_Reveal_Non_Schema_Columns()
{
if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.GreaterThanOrEqualsTo) ||
if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.GreaterThanOrEqualsTo) ||
(TestClusterManager.IsDse && TestClusterManager.CheckDseVersion(new Version(6, 0), Comparison.GreaterThanOrEqualsTo)) ||
TestClusterManager.IsHcd)
{
Expand Down
54 changes: 40 additions & 14 deletions src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,35 @@ public class PreparedStatementsTests : SharedClusterTest
{
private readonly string _tableName = "tbl" + Guid.NewGuid().ToString("N").ToLower();
private const string AllTypesTableName = "all_types_table_prepared";
private readonly List<ICluster> _privateClusterInstances = new List<ICluster>();

protected override ICluster GetNewTemporaryCluster(Action<Builder> build = null)
{
var builder = ClusterBuilder()
.AddContactPoint(TestCluster.InitialContactPoint)
.WithSocketOptions(new SocketOptions().SetConnectTimeoutMillis(30000).SetReadTimeoutMillis(22000));
build?.Invoke(builder);
var cluster = builder.Build();
_privateClusterInstances.Add(cluster);
return cluster;
}

public override void TearDown()
{
foreach (var c in _privateClusterInstances)
{
try
{
c.Dispose();
}
catch
{
// ignored
}
}
_privateClusterInstances.Clear();
base.TearDown();
}

public PreparedStatementsTests() : base(3)
{
Expand Down Expand Up @@ -163,8 +192,8 @@ public void PreparedStatement_With_Changing_Schema()
{
byte[] originalResultMetadataId = null;
// Use 2 different clusters as the prepared statement cache should be different
using (var cluster1 = ClusterBuilder().AddContactPoint(TestClusterManager.InitialContactPoint).Build())
using (var cluster2 = ClusterBuilder().AddContactPoint(TestClusterManager.InitialContactPoint).Build())
using (var cluster1 = GetNewTemporaryCluster())
using (var cluster2 = GetNewTemporaryCluster())
{
var session1 = cluster1.Connect();
var session2 = cluster2.Connect();
Expand Down Expand Up @@ -906,13 +935,12 @@ public void Session_Prepare_With_Keyspace_Defined_On_Previuos_Cassandra_Versions

private void TestKeyspaceInPrepareNotSupported(bool specifyProtocol)
{
var builder = ClusterBuilder().AddContactPoint(TestClusterManager.InitialContactPoint);
if (specifyProtocol)
{
builder.WithMaxProtocolVersion(ProtocolVersion.V4);
}

using (var cluster = builder.Build())
using (var cluster = GetNewTemporaryCluster(builder => {
if (specifyProtocol)
{
builder.WithMaxProtocolVersion(ProtocolVersion.V4);
}
}))
{
var session = cluster.Connect(KeyspaceName);

Expand Down Expand Up @@ -1114,7 +1142,7 @@ public void BatchStatement_With_Keyspace_Defined_On_Protocol_Greater_Than_4()
[TestBothServersVersion(4, 0, 5,1, Comparison.LessThan)]
public void BatchStatement_With_Keyspace_Defined_On_Lower_Protocol_Versions()
{
using (var cluster = ClusterBuilder().AddContactPoint(TestClusterManager.InitialContactPoint).Build())
using (var cluster = GetNewTemporaryCluster())
{
var session = cluster.Connect("system");
var query = new SimpleStatement(
Expand Down Expand Up @@ -1150,10 +1178,8 @@ public void Should_FailFast_When_PreparedStatementIdChangesOnReprepare()
}

var tableName = TestUtils.GetUniqueTableName();
using (var cluster =
ClusterBuilder()
.AddContactPoint(TestClusterManager.InitialContactPoint)
.WithQueryTimeout(500000).Build())
using (var cluster =
GetNewTemporaryCluster(builder => builder.WithQueryTimeout(500000)))
{
var session = cluster.Connect();
session.Execute($"CREATE TABLE {KeyspaceName}.{tableName} (a int PRIMARY KEY, b int, c int)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SchemaAgreementTests : SharedClusterTest
{
private volatile bool _paused = false;

public SchemaAgreementTests() : base(2, false)
public SchemaAgreementTests() : base(3, false)
{
}

Expand Down
Loading