From ac5c0b07c149af509224bb034cc123738e7fb08b Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 6 Nov 2024 00:09:32 -0800 Subject: [PATCH 01/24] add 4.1 and 6.9 to matrix --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8ad772ffc..d4fbcb372 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -435,10 +435,12 @@ pipeline { values '3.0', // latest 3.0.x Apache Cassandra� '3.11', // latest 3.11.x Apache Cassandra� '4.0', // latest 4.0.x Apache Cassandra� - '5.0-beta1', // Development Apache Cassandra� + '4.1', + '5.0', // Development Apache Cassandra� 'dse-5.1.35', // latest 5.1.x DataStax Enterprise 'dse-6.7.17', // latest 6.7.x DataStax Enterprise 'dse-6.8.30' // 6.8 current DataStax Enterprise + 'dse-6.9.3' } axis { name 'DOTNET_VERSION' From f985c6f5b6aa5af59f8f82400e1942e4ca65f0e2 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 6 Nov 2024 00:11:22 -0800 Subject: [PATCH 02/24] , --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d4fbcb372..2ea25052b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -439,7 +439,7 @@ pipeline { '5.0', // Development Apache Cassandra� 'dse-5.1.35', // latest 5.1.x DataStax Enterprise 'dse-6.7.17', // latest 6.7.x DataStax Enterprise - 'dse-6.8.30' // 6.8 current DataStax Enterprise + 'dse-6.8.30', // 6.8 current DataStax Enterprise 'dse-6.9.3' } axis { From c77a8cab9d0b4fa37ea2d96edbf3a17d07880749 Mon Sep 17 00:00:00 2001 From: janehe Date: Fri, 8 Nov 2024 16:11:10 -0800 Subject: [PATCH 03/24] fix yaml --- .../TestClusterManagement/CcmBridge.cs | 40 +++++++++++++++++++ .../TestClusterManager.cs | 5 ++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs index dde5d86fa..8bd3b5a2e 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs @@ -18,6 +18,7 @@ using System.Collections.Generic; using System.IO; using System.Net.Sockets; +using System.Text.RegularExpressions; using System.Threading; using Cassandra.IntegrationTests.TestBase; using Cassandra.Tests; @@ -294,6 +295,7 @@ public void UpdateConfig(params string[] configs) { return; } + FixYaml(configs); foreach (var c in configs) { ExecuteCcm(string.Format("updateconf \"{0}\"", c)); @@ -311,12 +313,50 @@ public void UpdateDseConfig(params string[] configs) { return; } + FixYaml(configs); foreach (var c in configs) { ExecuteCcm(string.Format("updatedseconf \"{0}\"", c)); } } + + private static void FixYaml(string[] yamlToFix) + { + // in-place fix + if (TestClusterManager.CheckCassandraVersion(false, System.Version.Parse("4.1"), Comparison.GreaterThanOrEqualsTo)) + { + // Fix the yaml options that turned obsolete since 4.1.0 + for (int i = 0; i < yamlToFix.Length; i++) + { + string line = yamlToFix[i]; + var keyValueParts = line.Split(':'); + + var key = keyValueParts[0]; + var value = keyValueParts[1]; + + var matchMs = Regex.Match(key, @"^(\w+)_in_ms$"); + if (matchMs.Success) + { + yamlToFix[i] = $"{matchMs.Groups[1].Value}:{value}ms"; + } + + var matchKb = Regex.Match(key, @"^(\w+)_in_kb$"); + if (matchKb.Success) + { + yamlToFix[i] = $"{matchKb.Groups[1].Value}:{value}KiB"; + } + + var matchEnable = Regex.Match(key, @"enable_(\w+)$"); + if (matchEnable.Success) + { + yamlToFix[i] = $"{matchEnable.Groups[1].Value}_enabled:{value}"; + } + } + } + } + + public void SetNodeWorkloads(int nodeId, string[] workloads) { if (!TestClusterManager.IsDse) diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 662a3cfdd..4ee7c4e05 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -29,6 +29,7 @@ public static class TestClusterManager public const string DefaultKeyspaceName = "test_cluster_keyspace"; private static ICcmProcessExecuter _executor; + private static readonly Version Version1Dot0 = new Version(1, 0); private static readonly Version Version2Dot0 = new Version(2, 0); private static readonly Version Version2Dot1 = new Version(2, 1); private static readonly Version Version2Dot2 = new Version(2, 2); @@ -44,6 +45,8 @@ public static class TestClusterManager private static readonly Version Version5Dot1 = new Version(5, 1); private static readonly Version Version6Dot0 = new Version(6, 0); private static readonly Version Version6Dot7 = new Version(6, 7); + private static readonly Version Version6Dot8 = new Version(6, 8); + private static readonly Version Version6Dot9 = new Version(6, 9); /// /// Gets the Cassandra version used for this test run @@ -70,7 +73,7 @@ public static Version CassandraVersion // C* 3.0 return Version3Dot0; } - if (dseVersion < Version6Dot0) + if (dseVersion <= Version6Dot9) { // C* 3.11 return Version3Dot11; From 059bbcd190db0b34c4b4a903db6bb611a2cddbb2 Mon Sep 17 00:00:00 2001 From: janehe Date: Fri, 8 Nov 2024 16:42:00 -0800 Subject: [PATCH 04/24] fix some update config didn't get through ccmbridge.updateconfig --- .../Core/UdfTests.cs | 7 +--- .../TestClusterManagement/CcmBridge.cs | 8 ++++ .../TestClusterManagement/CcmCluster.cs | 12 ++---- .../TestClusterManager.cs | 40 ++++++++++++++++++- 4 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/Cassandra.IntegrationTests/Core/UdfTests.cs b/src/Cassandra.IntegrationTests/Core/UdfTests.cs index c14cb094b..92b0e2704 100644 --- a/src/Cassandra.IntegrationTests/Core/UdfTests.cs +++ b/src/Cassandra.IntegrationTests/Core/UdfTests.cs @@ -51,12 +51,7 @@ public void TestFixtureSetup() return; } _testCluster = TestClusterManager.GetTestCluster(1, 0, false, DefaultMaxClusterCreateRetries, false, false); - var cassandraYaml = "enable_user_defined_functions: true"; - if (TestClusterManager.CheckCassandraVersion(true, Version.Parse("5.0"), Comparison.GreaterThanOrEqualsTo)) - { - cassandraYaml = "user_defined_functions_enabled: true"; - } - _testCluster.UpdateConfig(cassandraYaml); + _testCluster.UpdateConfig("enable_user_defined_functions:true"); _testCluster.Start(1); using (var cluster = ClusterBuilder().AddContactPoint(_testCluster.InitialContactPoint).Build()) { diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs index 8bd3b5a2e..42e408a4f 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Net.Sockets; using System.Text.RegularExpressions; using System.Threading; @@ -320,6 +321,13 @@ public void UpdateDseConfig(params string[] configs) } } + public void UpdateConfig(int nodeId, params string[] yamlChanges) + { + if (yamlChanges == null) return; + FixYaml(yamlChanges); + var joinedChanges = string.Join(" ", yamlChanges.Select(s => $"\"{s}\"")); + ExecuteCcm($"node{nodeId} updateconf {joinedChanges}"); + } private static void FixYaml(string[] yamlToFix) { diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmCluster.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmCluster.cs index 087e60ef4..b15e095c5 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmCluster.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmCluster.cs @@ -214,23 +214,17 @@ public void BootstrapNode(int nodeIdToStart, string dataCenterName, bool start = public void UpdateDseConfig(params string[] yamlChanges) { - if (yamlChanges == null) return; - var joinedChanges = string.Join(" ", yamlChanges.Select(s => $"\"{s}\"")); - _ccm.ExecuteCcm($"updatedseconf {joinedChanges}"); + _ccm.UpdateDseConfig(yamlChanges); } public void UpdateConfig(params string[] yamlChanges) { - if (yamlChanges == null) return; - var joinedChanges = string.Join(" ", yamlChanges.Select(s => $"\"{s}\"")); - _ccm.ExecuteCcm($"updateconf {joinedChanges}"); + _ccm.UpdateConfig(yamlChanges); } public void UpdateConfig(int nodeId, params string[] yamlChanges) { - if (yamlChanges == null) return; - var joinedChanges = string.Join(" ", yamlChanges.Select(s => $"\"{s}\"")); - _ccm.ExecuteCcm($"node{nodeId} updateconf {joinedChanges}"); + _ccm.UpdateConfig(nodeId, yamlChanges); } } } diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 4ee7c4e05..72b51520f 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -102,6 +102,35 @@ public static string DsePath get { return Environment.GetEnvironmentVariable("DSE_PATH"); } } + public enum BackendTypes + { + Hcd, + Dse, + Cassandra + } + + /// + /// "hcd", "dse", or "cassandra" (default) + /// + public static BackendTypes BackendType + { + get + { + string distribution = Environment.GetEnvironmentVariable("CCM_DISTRIBUTION") ?? "cassandra"; + switch (distribution) + { + case "hcd": + return BackendTypes.Hcd; + case "dse": + return BackendTypes.Dse; + case "cassandra": + return BackendTypes.Cassandra; + default: + throw new TestInfrastructureException("Unknown CCM_DISTRIBUTION value: " + distribution); + } + } + } + public static string InitialContactPoint { get { return IpPrefix + "1"; } @@ -109,7 +138,14 @@ public static string InitialContactPoint public static string DseVersionString { - get { return Environment.GetEnvironmentVariable("DSE_VERSION") ?? "6.7.7"; } + get + { + if (BackendType != BackendTypes.Dse) + { + throw new TestInfrastructureException("DSE_VERSION is only available when using DSE backend"); + } + return Environment.GetEnvironmentVariable("CASSANDRA_VERSION") ?? "6.7.7"; + } } public static string CassandraVersionString @@ -119,7 +155,7 @@ public static string CassandraVersionString public static bool IsDse { - get { return Environment.GetEnvironmentVariable("DSE_VERSION") != null; } + get { return BackendType == BackendTypes.Dse; } } public static Version DseVersion From 49e812290bc3a66c4cb26056da2c7d8bad55c80a Mon Sep 17 00:00:00 2001 From: janehe Date: Fri, 8 Nov 2024 17:40:26 -0800 Subject: [PATCH 05/24] add hcd --- Jenkinsfile | 17 +++++++++++++-- .../TestClusterManagement/CcmBridge.cs | 8 +++++++ .../TestClusterManager.cs | 21 ++++++++++++------- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2ea25052b..369250f1c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -129,13 +129,25 @@ CCM_CASSANDRA_VERSION=${DSE_FIXED_VERSION} # maintain for backwards compatibilit CCM_VERSION=${DSE_FIXED_VERSION} CCM_SERVER_TYPE=dse DSE_VERSION=${DSE_FIXED_VERSION} -CCM_IS_DSE=true +CCM_DISTRIBUTION=dse +CASSANDRA_VERSION=${DSE_FIXED_VERSION} CCM_BRANCH=${DSE_FIXED_VERSION} DSE_BRANCH=${DSE_FIXED_VERSION} JDK=1.8 ENVIRONMENT_EOF ''' } + + if (env.SERVER_VERSION.split('-')[0] == 'hcd') { + env.HCD_FIXED_VERSION = env.SERVER_VERSION.split('-')[1] + sh label: 'Update environment for HCD', script: '''#!/bin/bash -le + cat >> ${HOME}/environment.txt << ENVIRONMENT_EOF +CCM_PATH=${HOME}/ccm +CCM_CASSANDRA_VERSION=${HCD_FIXED_VERSION} # maintain for backwards compatibility +CASSANDRA_VERSION=${HCD_FIXED_VERSION} +CCM_DISTRIBUTION=hcd +ENVIRONMENT_EOF + } if (env.SERVER_VERSION == env.SERVER_VERSION_SNI && env.DOTNET_VERSION != 'mono') { sh label: 'Update environment for SNI proxy tests', script: '''#!/bin/bash -le @@ -440,7 +452,8 @@ pipeline { 'dse-5.1.35', // latest 5.1.x DataStax Enterprise 'dse-6.7.17', // latest 6.7.x DataStax Enterprise 'dse-6.8.30', // 6.8 current DataStax Enterprise - 'dse-6.9.3' + 'dse-6.9.3', + 'hcd-1.0.0' } axis { name 'DOTNET_VERSION' diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs index 42e408a4f..f6e5638e9 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs @@ -73,6 +73,11 @@ public void Create(bool useSsl) ExecuteCcm(string.Format( "create {0} --dse -v {1} {2}", Name, Version, sslParams)); } + else if(TestClusterManager.BackendType == TestClusterManager.BackendTypes.Hcd) + { + ExecuteCcm(string.Format( + "create {0} --hcd -v {1} {2}", Name, Version, sslParams)); + } else { ExecuteCcm(string.Format( @@ -268,6 +273,9 @@ public ProcessOutput BootstrapNode(int n, string dc, bool start = true) if (TestClusterManager.IsDse) { cmd += " --dse"; + }else if (TestClusterManager.BackendType == TestClusterManager.BackendTypes.Hcd) + { + cmd += " --hcd"; } var output = ExecuteCcm(string.Format(cmd, n, IpPrefix, n, 7000 + 100 * n, dc != null ? "-d " + dc : null)); diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 72b51520f..1717cdf00 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -81,7 +81,10 @@ public static Version CassandraVersion // C* 4.0 return Version4Dot0; } - + if (IsHcd) + { + return Version4Dot0; + } return new Version(TestClusterManager.CassandraVersionString.Split('-')[0]); } } @@ -140,7 +143,7 @@ public static string DseVersionString { get { - if (BackendType != BackendTypes.Dse) + if (!IsDse) { throw new TestInfrastructureException("DSE_VERSION is only available when using DSE backend"); } @@ -157,6 +160,11 @@ public static bool IsDse { get { return BackendType == BackendTypes.Dse; } } + + public static bool IsHcd + { + get { return BackendType == BackendTypes.Hcd; } + } public static Version DseVersion { @@ -200,15 +208,14 @@ public static bool CheckDseVersion(Version version, Comparison comparison) public static bool CheckCassandraVersion(bool requiresOss, Version version, Comparison comparison) { - if (requiresOss && TestClusterManager.IsDse) + if (requiresOss && TestClusterManager.BackendType != BackendTypes.Cassandra) { return false; } - var runningVersion = TestClusterManager.IsDse ? TestClusterManager.DseVersion : TestClusterManager.CassandraVersion; - var expectedVersion = TestClusterManager.IsDse ? TestClusterManager.GetDseVersionFromCassandraVersion(version) : version; - - return TestDseVersion.VersionMatch(expectedVersion, runningVersion, comparison); + var runningVersion = TestClusterManager.CassandraVersion; + var expectedVersion = version; + return TestCassandraVersion.VersionMatch(expectedVersion, runningVersion, comparison); } /// From eb9741bcdba68af59e2ce8fb941c97ec3f3d5c7a Mon Sep 17 00:00:00 2001 From: janehe Date: Sat, 9 Nov 2024 21:33:58 -0800 Subject: [PATCH 06/24] add ''' --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 369250f1c..17b11dd7b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -147,6 +147,7 @@ CCM_CASSANDRA_VERSION=${HCD_FIXED_VERSION} # maintain for backwards compatibilit CASSANDRA_VERSION=${HCD_FIXED_VERSION} CCM_DISTRIBUTION=hcd ENVIRONMENT_EOF + ''' } if (env.SERVER_VERSION == env.SERVER_VERSION_SNI && env.DOTNET_VERSION != 'mono') { From 6e10968cb12a7c6ec972c56795da6ddc5913c486 Mon Sep 17 00:00:00 2001 From: janehe Date: Sat, 9 Nov 2024 21:53:23 -0800 Subject: [PATCH 07/24] BackendType --- .../TestClusterManagement/CcmBridge.cs | 4 ++-- .../TestClusterManagement/TestClusterManager.cs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs index f6e5638e9..8ea5cdcbf 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs @@ -73,7 +73,7 @@ public void Create(bool useSsl) ExecuteCcm(string.Format( "create {0} --dse -v {1} {2}", Name, Version, sslParams)); } - else if(TestClusterManager.BackendType == TestClusterManager.BackendTypes.Hcd) + else if(TestClusterManager.CurrentBackendType == TestClusterManager.BackendType.Hcd) { ExecuteCcm(string.Format( "create {0} --hcd -v {1} {2}", Name, Version, sslParams)); @@ -273,7 +273,7 @@ public ProcessOutput BootstrapNode(int n, string dc, bool start = true) if (TestClusterManager.IsDse) { cmd += " --dse"; - }else if (TestClusterManager.BackendType == TestClusterManager.BackendTypes.Hcd) + }else if (TestClusterManager.CurrentBackendType == TestClusterManager.BackendType.Hcd) { cmd += " --hcd"; } diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 1717cdf00..078a0627d 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -105,7 +105,7 @@ public static string DsePath get { return Environment.GetEnvironmentVariable("DSE_PATH"); } } - public enum BackendTypes + public enum BackendType { Hcd, Dse, @@ -115,7 +115,7 @@ public enum BackendTypes /// /// "hcd", "dse", or "cassandra" (default) /// - public static BackendTypes BackendType + public static BackendType CurrentBackendType { get { @@ -123,11 +123,11 @@ public static BackendTypes BackendType switch (distribution) { case "hcd": - return BackendTypes.Hcd; + return BackendType.Hcd; case "dse": - return BackendTypes.Dse; + return BackendType.Dse; case "cassandra": - return BackendTypes.Cassandra; + return BackendType.Cassandra; default: throw new TestInfrastructureException("Unknown CCM_DISTRIBUTION value: " + distribution); } @@ -158,12 +158,12 @@ public static string CassandraVersionString public static bool IsDse { - get { return BackendType == BackendTypes.Dse; } + get { return CurrentBackendType == BackendType.Dse; } } public static bool IsHcd { - get { return BackendType == BackendTypes.Hcd; } + get { return CurrentBackendType == BackendType.Hcd; } } public static Version DseVersion @@ -208,7 +208,7 @@ public static bool CheckDseVersion(Version version, Comparison comparison) public static bool CheckCassandraVersion(bool requiresOss, Version version, Comparison comparison) { - if (requiresOss && TestClusterManager.BackendType != BackendTypes.Cassandra) + if (requiresOss && TestClusterManager.CurrentBackendType != BackendType.Cassandra) { return false; } From 69b9eb3b658cd709880b8fc16a4b4ddca1b15e27 Mon Sep 17 00:00:00 2001 From: janehe Date: Sat, 9 Nov 2024 23:22:18 -0800 Subject: [PATCH 08/24] fix compact storage --- .../Core/ParameterizedStatementsTests.cs | 16 +++++++++++----- .../Core/SchemaMetadataTests.cs | 13 ++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs b/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs index b3d8c586d..549f41183 100644 --- a/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs +++ b/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs @@ -50,7 +50,9 @@ protected override string[] SetupQueries } }; - if (TestClusterManager.CheckCassandraVersion(false, new Version(4, 0), Comparison.LessThan)) + // 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))) { setupQueries.Add($"CREATE TABLE {TableCompactStorage} (key blob PRIMARY KEY, bar int, baz uuid)" + $" WITH COMPACT STORAGE"); @@ -547,9 +549,11 @@ 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(false, 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) { - Assert.Ignore("COMPACT STORAGE is only supported by C* versions prior to 4.0"); + Assert.Ignore("COMPACT STORAGE is not supported by DSE 6.0 / C* 4.0"); return; } @@ -568,9 +572,11 @@ 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(false, 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) { - Assert.Ignore("COMPACT STORAGE is only supported by C* versions prior to 4.0"); + Assert.Ignore("COMPACT STORAGE is not supported by DSE 6.0 / C* 4.0"); return; } diff --git a/src/Cassandra.IntegrationTests/Core/SchemaMetadataTests.cs b/src/Cassandra.IntegrationTests/Core/SchemaMetadataTests.cs index 35b1f6e8f..89accff5f 100644 --- a/src/Cassandra.IntegrationTests/Core/SchemaMetadataTests.cs +++ b/src/Cassandra.IntegrationTests/Core/SchemaMetadataTests.cs @@ -34,11 +34,8 @@ public SchemaMetadataTests() : base(() => { string[] cassandraYaml = null; - if (TestClusterManager.CheckCassandraVersion(true, new Version(5, 0), Comparison.GreaterThanOrEqualsTo)) - { - cassandraYaml = new[] { "materialized_views_enabled: true" }; - } - else if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.GreaterThanOrEqualsTo)) + if (TestClusterManager.CheckCassandraVersion(true, new Version(4, 0), Comparison.GreaterThanOrEqualsTo) || + TestClusterManager.IsHcd) { cassandraYaml = new[] { "enable_materialized_views: true" }; } @@ -664,11 +661,13 @@ public void RaiseErrorOnInvalidMultipleSecondaryIndexTest(bool metadataSync) [Test, TestCase(true), TestCase(false), TestCassandraVersion(3, 0)] public void ColumnClusteringOrderReversedTest(bool metadataSync) { - if (TestClusterManager.CheckCassandraVersion(false, 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))) { - Assert.Ignore("Compact table test designed for C* 3.0"); + Assert.Ignore("COMPACT STORAGE is not supported by DSE 6.0 / C* 4.0"); return; } + var keyspaceName = TestUtils.GetUniqueKeyspaceName(); var tableName = TestUtils.GetUniqueTableName().ToLower(); var cluster = GetNewTemporaryCluster(builder => builder.WithMetadataSyncOptions(new MetadataSyncOptions().SetMetadataSyncEnabled(metadataSync))); From 3b05e38585eddfa3739e25c4607a33ae2bbb98a9 Mon Sep 17 00:00:00 2001 From: janehe Date: Mon, 11 Nov 2024 11:28:46 -0800 Subject: [PATCH 09/24] Fix null values in UDF and UDA fields --- src/Cassandra.IntegrationTests/Core/UdfTests.cs | 2 +- src/Cassandra/SchemaParser.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Cassandra.IntegrationTests/Core/UdfTests.cs b/src/Cassandra.IntegrationTests/Core/UdfTests.cs index 92b0e2704..212759177 100644 --- a/src/Cassandra.IntegrationTests/Core/UdfTests.cs +++ b/src/Cassandra.IntegrationTests/Core/UdfTests.cs @@ -154,7 +154,7 @@ public void GetFunction_Should_Retrieve_Metadata_Of_Cql_Function_Without_Paramet Assert.AreEqual(false, func.CalledOnNullInput); Assert.False(func.Monotonic); Assert.False(func.Deterministic); - Assert.AreEqual(func.MonotonicOn, new string[0]); + Assert.AreEqual(new string[0], func.MonotonicOn); } [Test, TestCase(true), TestCase(false), TestCassandraVersion(2, 2)] diff --git a/src/Cassandra/SchemaParser.cs b/src/Cassandra/SchemaParser.cs index 6d2fd5b3b..3bf44235c 100644 --- a/src/Cassandra/SchemaParser.cs +++ b/src/Cassandra/SchemaParser.cs @@ -840,8 +840,7 @@ public override Task GetAggregateAsync(string keyspaceName, s StateFunction = row.GetValue("state_func"), FinalFunction = row.GetValue("final_func"), InitialCondition = row.GetValue("initcond"), - Deterministic = row.GetColumn("deterministic") != null && - row.GetValue("deterministic"), + Deterministic = row.GetValue>("deterministic").GetValueOrDefault(false), Signature = argumentTypes, StateType = tasks[0].Result, ReturnType = tasks[1].Result, @@ -893,10 +892,14 @@ public override Task GetFunctionAsync(string keyspaceName, str if (row.GetColumn("deterministic") != null) { - // DSE 6.0+ - result.Deterministic = row.GetValue("deterministic"); - result.Monotonic = row.GetValue("monotonic"); + // DSE 6.0+ or HCD + result.Deterministic = row.GetValue>("deterministic").GetValueOrDefault(false); + result.Monotonic = row.GetValue>("monotonic").GetValueOrDefault(false); result.MonotonicOn = row.GetValue("monotonic_on"); + if (result.MonotonicOn is null) + { + result.MonotonicOn = new string[0]; + } } return result; From 7eaff90f96b786e725e33821fcef19460d112071 Mon Sep 17 00:00:00 2001 From: janehe Date: Mon, 11 Nov 2024 14:30:41 -0800 Subject: [PATCH 10/24] short hand of nullable type --- src/Cassandra/SchemaParser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cassandra/SchemaParser.cs b/src/Cassandra/SchemaParser.cs index 3bf44235c..92bf3e356 100644 --- a/src/Cassandra/SchemaParser.cs +++ b/src/Cassandra/SchemaParser.cs @@ -840,7 +840,7 @@ public override Task GetAggregateAsync(string keyspaceName, s StateFunction = row.GetValue("state_func"), FinalFunction = row.GetValue("final_func"), InitialCondition = row.GetValue("initcond"), - Deterministic = row.GetValue>("deterministic").GetValueOrDefault(false), + Deterministic = row.GetColumn("deterministic") != null && row.GetValue("deterministic").GetValueOrDefault(false), Signature = argumentTypes, StateType = tasks[0].Result, ReturnType = tasks[1].Result, @@ -893,8 +893,8 @@ public override Task GetFunctionAsync(string keyspaceName, str if (row.GetColumn("deterministic") != null) { // DSE 6.0+ or HCD - result.Deterministic = row.GetValue>("deterministic").GetValueOrDefault(false); - result.Monotonic = row.GetValue>("monotonic").GetValueOrDefault(false); + result.Deterministic = row.GetValue("deterministic").GetValueOrDefault(false); + result.Monotonic = row.GetValue("monotonic").GetValueOrDefault(false); result.MonotonicOn = row.GetValue("monotonic_on"); if (result.MonotonicOn is null) { From eca06aa4aae30450f4b5eb71c966d272fc4fcca8 Mon Sep 17 00:00:00 2001 From: janehe Date: Mon, 18 Nov 2024 12:06:27 -0800 Subject: [PATCH 11/24] ccm updateconfig merge to one line update Jenkinsfile.scheduled --- Jenkinsfile | 16 ++---- Jenkinsfile.scheduled | 56 +++++++++++++------ .../TestClusterManagement/CcmBridge.cs | 12 ++-- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 17b11dd7b..0cb333b58 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -445,16 +445,12 @@ pipeline { axes { axis { name 'SERVER_VERSION' - values '3.0', // latest 3.0.x Apache Cassandra� - '3.11', // latest 3.11.x Apache Cassandra� - '4.0', // latest 4.0.x Apache Cassandra� - '4.1', + values '3.11', // latest 3.11.x Apache Cassandra� + '4.1', // latest 4.x Apache Cassandra� '5.0', // Development Apache Cassandra� 'dse-5.1.35', // latest 5.1.x DataStax Enterprise - 'dse-6.7.17', // latest 6.7.x DataStax Enterprise - 'dse-6.8.30', // 6.8 current DataStax Enterprise - 'dse-6.9.3', - 'hcd-1.0.0' + 'dse-6.9.3', // latest DataStax Enterprise + 'hcd-1.0.0' // Hyper-Converged Database } axis { name 'DOTNET_VERSION' @@ -469,7 +465,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '3.0', '5.0-beta1', 'dse-5.1.35', 'dse-6.8.30' + values '3.0', '5.0', 'dse-5.1.35' } } exclude { @@ -479,7 +475,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values 'dse-6.7.17', '3.11' + values '3.11' } } } diff --git a/Jenkinsfile.scheduled b/Jenkinsfile.scheduled index 32c3d582c..581bd4f49 100644 --- a/Jenkinsfile.scheduled +++ b/Jenkinsfile.scheduled @@ -128,13 +128,26 @@ CCM_CASSANDRA_VERSION=${DSE_FIXED_VERSION} # maintain for backwards compatibilit CCM_VERSION=${DSE_FIXED_VERSION} CCM_SERVER_TYPE=dse DSE_VERSION=${DSE_FIXED_VERSION} -CCM_IS_DSE=true +CCM_DISTRIBUTION=dse +CASSANDRA_VERSION=${DSE_FIXED_VERSION} CCM_BRANCH=${DSE_FIXED_VERSION} DSE_BRANCH=${DSE_FIXED_VERSION} JDK=1.8 ENVIRONMENT_EOF ''' } + + if (env.SERVER_VERSION.split('-')[0] == 'hcd') { + env.HCD_FIXED_VERSION = env.SERVER_VERSION.split('-')[1] + sh label: 'Update environment for HCD', script: '''#!/bin/bash -le + cat >> ${HOME}/environment.txt << ENVIRONMENT_EOF +CCM_PATH=${HOME}/ccm +CCM_CASSANDRA_VERSION=${HCD_FIXED_VERSION} # maintain for backwards compatibility +CASSANDRA_VERSION=${HCD_FIXED_VERSION} +CCM_DISTRIBUTION=hcd +ENVIRONMENT_EOF + ''' + } if (env.SERVER_VERSION == env.SERVER_VERSION_SNI && env.DOTNET_VERSION != 'mono') { sh label: 'Update environment for SNI proxy tests', script: '''#!/bin/bash -le @@ -465,12 +478,15 @@ pipeline { '2.2', // Legacy Apache Cassandra� '3.0', // Previous Apache Cassandra� '3.11', // latest 3.11.x Apache Cassandra� - '4.0', // latest 4.0.x Apache Cassandra� - '5.0-beta1', // Development Apache Cassandra� + '4.0', // Previous 4.0.x Apache Cassandra� + '4.1', // Latest 4.1.x Apache Cassandra� + '5.0', // Development Apache Cassandra� 'dse-5.1.35', // Legacy DataStax Enterprise 'dse-6.0.18', // Previous DataStax Enterprise - 'dse-6.7.17', // Current DataStax Enterprise - 'dse-6.8.30' // Current DataStax Enterprise + 'dse-6.7.17', // Previous DataStax Enterprise + 'dse-6.8.30', // Previous DataStax Enterprise + 'dse-6.9.3', // Latest DataStax Enterprise + 'hcd-1.0.0' // Hyper-Converged Database } axis { name 'DOTNET_VERSION' @@ -495,7 +511,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '2.1', '2.2', '3.0', '5.0-beta1', 'dse-5.1.35', 'dse-6.0.18' + values '2.1', '2.2', '3.0', '5.0', 'dse-5.1.35', 'dse-6.0.18' } } exclude { @@ -593,8 +609,9 @@ pipeline { values '2.1', // Legacy Apache Cassandra� '2.2', // Legacy Apache Cassandra� '3.11', // latest 3.11.x Apache Cassandra� - '4.0' // latest 4.0.x Apache Cassandra� - '5.0-beta1' // Development Apache Cassandra� + '4.0', // latest 4.0.x Apache Cassandra� + '4.1', // latest 4.1.x Apache Cassandra� + '5.0' // Development Apache Cassandra� } axis { name 'DOTNET_VERSION' @@ -629,7 +646,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '2.1', '2.2', '5.0-beta1' + values '2.1', '2.2', '5.0' } } } @@ -707,13 +724,17 @@ pipeline { name 'SERVER_VERSION' values '2.1', // Legacy Apache Cassandra� '2.2', // Legacy Apache Cassandra� + '3.0', // Previous Apache Cassandra� '3.11', // latest 3.11.x Apache Cassandra� - '4.0', // latest 4.0.x Apache Cassandra� - '5.0-beta1', // latest 4.0.x Apache Cassandra� + '4.0', // Previous 4.0.x Apache Cassandra� + '4.1', // Latest 4.1.x Apache Cassandra� + '5.0', // Development Apache Cassandra� 'dse-5.1.35', // Legacy DataStax Enterprise 'dse-6.0.18', // Previous DataStax Enterprise - 'dse-6.7.17', // Current DataStax Enterprise - 'dse-6.8.30' // Current DataStax Enterprise + 'dse-6.7.17', // Previous DataStax Enterprise + 'dse-6.8.30', // Previous DataStax Enterprise + 'dse-6.9.3', // Latest DataStax Enterprise + 'hcd-1.0.0' // Hyper-Converged Database } axis { name 'DOTNET_VERSION' @@ -728,7 +749,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '2.1', '2.2', 'dse-6.0.18', 'dse-5.1.35', '5.0-beta1' + values '2.1', '2.2', 'dse-6.0.18', 'dse-5.1.35', '5.0' } } exclude { @@ -817,8 +838,9 @@ pipeline { values '2.1', // Legacy Apache Cassandra� '2.2', // Legacy Apache Cassandra� '3.11', // latest 3.11.x Apache Cassandra� - '4.0' // latest 4.0.x Apache Cassandra� - '5.0-beta1' // Development Apache Cassandra� + '4.0', // latest 4.0.x Apache Cassandra� + '4.1', // latest 4.1.x Apache Cassandra� + '5.0' // Development Apache Cassandra� } axis { name 'DOTNET_VERSION' @@ -833,7 +855,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '2.1', '5.0-beta1' + values '2.1', '5.0' } } exclude { diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs index 8ea5cdcbf..446659267 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/CcmBridge.cs @@ -305,10 +305,8 @@ public void UpdateConfig(params string[] configs) return; } FixYaml(configs); - foreach (var c in configs) - { - ExecuteCcm(string.Format("updateconf \"{0}\"", c)); - } + var joinedConfigs = string.Join(" ", configs.Select(s => $"\"{s}\"")); + ExecuteCcm($"updateconf {joinedConfigs}"); } public void UpdateDseConfig(params string[] configs) @@ -323,10 +321,8 @@ public void UpdateDseConfig(params string[] configs) return; } FixYaml(configs); - foreach (var c in configs) - { - ExecuteCcm(string.Format("updatedseconf \"{0}\"", c)); - } + var joinedConfigs = string.Join(" ", configs.Select(s => $"\"{s}\"")); + ExecuteCcm($"updatedseconf {joinedConfigs}"); } public void UpdateConfig(int nodeId, params string[] yamlChanges) From 8346a005f130b81d2c64754f2beb11575a32e617 Mon Sep 17 00:00:00 2001 From: janehe Date: Mon, 18 Nov 2024 12:20:44 -0800 Subject: [PATCH 12/24] Remain backward compatibility to DSE_VERSION --- .../TestClusterManager.cs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 078a0627d..90f64b5c7 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -113,12 +113,17 @@ public enum BackendType } /// - /// "hcd", "dse", or "cassandra" (default) + /// "hcd", "dse", or "cassandra" (default), based on CCM_DISTRIBUTION + /// if there's env var DSE_VERSION, ignore CCM_DISTRIBUTION /// public static BackendType CurrentBackendType { get { + if ( Environment.GetEnvironmentVariable("DSE_VERSION") != null ) + { + return BackendType.Dse; + } string distribution = Environment.GetEnvironmentVariable("CCM_DISTRIBUTION") ?? "cassandra"; switch (distribution) { @@ -147,13 +152,27 @@ public static string DseVersionString { throw new TestInfrastructureException("DSE_VERSION is only available when using DSE backend"); } + if (Environment.GetEnvironmentVariable("DSE_VERSION") != null) + { + return Environment.GetEnvironmentVariable("DSE_VERSION"); + } return Environment.GetEnvironmentVariable("CASSANDRA_VERSION") ?? "6.7.7"; } } + /// + /// Use DSE_VERSION if it's set, otherwise use CASSANDRA_VERSION + /// public static string CassandraVersionString { - get { return Environment.GetEnvironmentVariable("CASSANDRA_VERSION") ?? "3.11.2"; } + get + { + if (Environment.GetEnvironmentVariable("DSE_VERSION") != null) + { + return Environment.GetEnvironmentVariable("DSE_VERSION"); + } + return Environment.GetEnvironmentVariable("CASSANDRA_VERSION") ?? "3.11.2"; + } } public static bool IsDse From fd61e10afcb7e57da5d23634eef88ae2e464bfc4 Mon Sep 17 00:00:00 2001 From: janehe Date: Mon, 18 Nov 2024 16:22:51 -0800 Subject: [PATCH 13/24] delete unused versions --- .../TestClusterManagement/TestClusterManager.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 90f64b5c7..c777cdecf 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -28,8 +28,7 @@ public static class TestClusterManager { public const string DefaultKeyspaceName = "test_cluster_keyspace"; private static ICcmProcessExecuter _executor; - - private static readonly Version Version1Dot0 = new Version(1, 0); + private static readonly Version Version2Dot0 = new Version(2, 0); private static readonly Version Version2Dot1 = new Version(2, 1); private static readonly Version Version2Dot2 = new Version(2, 2); @@ -44,8 +43,6 @@ public static class TestClusterManager private static readonly Version Version5Dot0 = new Version(5, 0); private static readonly Version Version5Dot1 = new Version(5, 1); private static readonly Version Version6Dot0 = new Version(6, 0); - private static readonly Version Version6Dot7 = new Version(6, 7); - private static readonly Version Version6Dot8 = new Version(6, 8); private static readonly Version Version6Dot9 = new Version(6, 9); /// From 8b25d96db1b5310a2513fbc24c408ed923828a4a Mon Sep 17 00:00:00 2001 From: janehe Date: Tue, 19 Nov 2024 21:57:02 -0800 Subject: [PATCH 14/24] refactor to only map DSE version to Cassandra version. --- ...tDseVersion.cs => TestCassandraVersion.cs} | 68 ++++++++----------- .../TestClusterManager.cs | 37 +++------- 2 files changed, 39 insertions(+), 66 deletions(-) rename src/Cassandra.IntegrationTests/TestBase/{TestDseVersion.cs => TestCassandraVersion.cs} (77%) diff --git a/src/Cassandra.IntegrationTests/TestBase/TestDseVersion.cs b/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs similarity index 77% rename from src/Cassandra.IntegrationTests/TestBase/TestDseVersion.cs rename to src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs index 17ac665b7..ef861049c 100644 --- a/src/Cassandra.IntegrationTests/TestBase/TestDseVersion.cs +++ b/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs @@ -24,7 +24,7 @@ namespace Cassandra.IntegrationTests.TestBase /// /// An attribute that filters the test to execute according to the current DSE version. /// - public class TestDseVersion : NUnitAttribute, IApplyToTest + public class TestCassandraVersion : NUnitAttribute, IApplyToTest { public int Major { get; set; } @@ -37,35 +37,35 @@ public class TestDseVersion : NUnitAttribute, IApplyToTest private bool IsOssRequired { get; set; } /// - /// Creates an instance of an attribute that filters the test to execute according to the current DSE version + /// Creates an instance of an attribute that filters the test to execute according to the current Cassandra version /// being used. /// /// Major version /// Minor version /// - /// Determines if the DSE version required should be "greater or equals to" = 1, + /// Determines if the Cassandra version required should be "greater or equals to" = 1, /// "equals to" = 0, "less than or equal to " = -1 /// /// Whether OSS C* is required. - public TestDseVersion(int major, int minor, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) + public TestCassandraVersion(int major, int minor, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) : this(major, minor, 0, comparison, isOssRequired) { } /// - /// Creates an instance of an attribute that filters the test to execute according to the current DSE version + /// Creates an instance of an attribute that filters the test to execute according to the current Cassandra version /// being used. /// /// Major version /// Minor version /// Build version /// - /// Determines if the DSE version required should be "greater or equals to" = 1, + /// Determines if the Cassandra version required should be "greater or equals to" = 1, /// "equals to" = 0, "less than or equal to " = -1 /// /// Whether OSS C* is required. - public TestDseVersion(int major, int minor, int build, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) + public TestCassandraVersion(int major, int minor, int build, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) { Major = major; Minor = minor; @@ -73,24 +73,16 @@ public TestDseVersion(int major, int minor, int build, Comparison comparison = C Comparison = comparison; IsOssRequired = isOssRequired; } - - /// - /// Gets the DSE version that should be used to compare against the running version. - /// - protected virtual Version GetExpectedServerVersion() - { - return new Version(Major, Minor, Build); - } - + protected virtual bool IsDseRequired() { - return true; + return false; } public void ApplyToTest(NUnit.Framework.Internal.Test test) { - var expectedVersion = GetExpectedServerVersion(); - if (!TestDseVersion.VersionMatch(expectedVersion, IsDseRequired(), IsOssRequired, Comparison, out var msg)) + var expectedVersion = new Version(Major, Minor, Build); + if (!TestCassandraVersion.VersionMatch(expectedVersion, IsDseRequired(), IsOssRequired, Comparison, out var msg)) { test.RunState = RunState.Ignored; var message = msg; @@ -103,7 +95,7 @@ public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool if (TestClusterManager.IsDse && requiresOss) { message = string.Format("Test designed to run with OSS {0} v{1} (executing DSE {2})", - TestDseVersion.GetComparisonText(comparison), + TestCassandraVersion.GetComparisonText(comparison), expectedVersion, TestClusterManager.DseVersion); return false; @@ -111,16 +103,24 @@ public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool if (!TestClusterManager.IsDse && requiresDse) { - message = $"Test designed to run with DSE {TestDseVersion.GetComparisonText(comparison)} " + + message = $"Test designed to run with DSE {TestCassandraVersion.GetComparisonText(comparison)} " + $"v{expectedVersion} (executing OSS {TestClusterManager.CassandraVersion})"; return false; } - var executingVersion = TestClusterManager.IsDse ? TestClusterManager.DseVersion : TestClusterManager.CassandraVersion; - if (!TestDseVersion.VersionMatch(expectedVersion, executingVersion, comparison)) + var executingVersion = requiresDse ? TestClusterManager.DseVersion : TestClusterManager.CassandraVersion; + if (!TestCassandraVersion.VersionMatch(expectedVersion, executingVersion, comparison)) { - message = - $"Test designed to run with DSE {TestDseVersion.GetComparisonText(comparison)} v{expectedVersion} (executing {executingVersion})"; + if (requiresDse) + { + message = + $"Test designed to run with DSE {TestCassandraVersion.GetComparisonText(comparison)} v{expectedVersion} (executing {executingVersion})"; + } + else + { + message = + $"Test designed to run with Cassandra {TestCassandraVersion.GetComparisonText(comparison)} v{expectedVersion} (executing {executingVersion})"; + } return false; } @@ -130,7 +130,7 @@ public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool requiresOss, Comparison comparison) { - return TestDseVersion.VersionMatch(expectedVersion, requiresDse, requiresOss, comparison, out _); + return TestCassandraVersion.VersionMatch(expectedVersion, requiresDse, requiresOss, comparison, out _); } public static bool VersionMatch(Version expectedVersion, Version executingVersion, Comparison comparison) @@ -195,27 +195,19 @@ private static string GetComparisonText(Comparison comparison) /// /// An attribute that filters the test to execute according to the current Cassandra version of the DSE version. /// - public class TestCassandraVersion : TestDseVersion + public class TestDseVersion : TestCassandraVersion { - protected override Version GetExpectedServerVersion() - { - var version = new Version(Major, Minor, Build); - return TestClusterManager.IsDse - ? TestClusterManager.GetDseVersionFromCassandraVersion(version) - : version; - } - protected override bool IsDseRequired() { - return false; + return true; } - public TestCassandraVersion( + public TestDseVersion( int major, int minor, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) : base(major, minor, comparison, isOssRequired) { } - public TestCassandraVersion(int major, int minor, int build, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) : base(major, minor, build, comparison, isOssRequired) + public TestDseVersion(int major, int minor, int build, Comparison comparison = Comparison.GreaterThanOrEqualsTo, bool isOssRequired = false) : base(major, minor, build, comparison, isOssRequired) { } } diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index c777cdecf..6321cb01b 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -184,7 +184,14 @@ public static bool IsHcd public static Version DseVersion { - get { return IsDse ? new Version(DseVersionString.Split('-')[0]) : TestClusterManager.GetDseVersionFromCassandraVersion(new Version(CassandraVersionString.Split('-')[0])); } + get + { + if (!IsDse) + { + throw new TestInfrastructureException("DseVersion is only available when using DSE backend"); + } + return new Version(DseVersionString.Split('-')[0]); + } } public static bool CcmUseWsl => bool.Parse(Environment.GetEnvironmentVariable("CCM_USE_WSL") ?? "false"); @@ -270,33 +277,7 @@ public static ICcmProcessExecuter Executor return TestClusterManager._executor; } } - - public static Version GetDseVersionFromCassandraVersion(Version cassandraVersion) - { - if (cassandraVersion < Version2Dot1) - { - // C* 2.0 => DSE 4.6 - return Version4Dot6; - } - if (cassandraVersion < Version2Dot2) - { - // C* 2.1 => DSE 4.8 - return Version4Dot8; - } - if (cassandraVersion < Version3Dot1) - { - // C* 3.0 => DSE 5.0 - return Version5Dot0; - } - if (cassandraVersion < Version3Dot12) - { - // C* 3.11 => DSE 5.1 - return Version5Dot1; - } - // DSE 6.0 - return Version6Dot0; - } - + private static ITestCluster CreateNewNoRetry(int nodeLength, TestClusterOptions options, bool startCluster) { TryRemove(); From 42e80d00ea869a272a1058958011a220d53e0849 Mon Sep 17 00:00:00 2001 From: janehe Date: Tue, 19 Nov 2024 23:22:21 -0800 Subject: [PATCH 15/24] revert fix for DSP-24606 --- src/Cassandra.IntegrationTests/Core/UdfTests.cs | 6 ++++++ .../TestBase/TestCassandraVersion.cs | 2 +- .../TestClusterManagement/TestClusterManager.cs | 6 ------ src/Cassandra/SchemaParser.cs | 13 +++++-------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Cassandra.IntegrationTests/Core/UdfTests.cs b/src/Cassandra.IntegrationTests/Core/UdfTests.cs index 212759177..3dc772933 100644 --- a/src/Cassandra.IntegrationTests/Core/UdfTests.cs +++ b/src/Cassandra.IntegrationTests/Core/UdfTests.cs @@ -50,6 +50,12 @@ public void TestFixtureSetup() { return; } + + if (TestClusterManager.IsHcd) + { + Assert.Ignore("Skipping UDF tests on HCD due to DSP-24606. See CSHARP-1020."); + return; + } _testCluster = TestClusterManager.GetTestCluster(1, 0, false, DefaultMaxClusterCreateRetries, false, false); _testCluster.UpdateConfig("enable_user_defined_functions:true"); _testCluster.Start(1); diff --git a/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs b/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs index ef861049c..877e78de0 100644 --- a/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs +++ b/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs @@ -104,7 +104,7 @@ public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool if (!TestClusterManager.IsDse && requiresDse) { message = $"Test designed to run with DSE {TestCassandraVersion.GetComparisonText(comparison)} " + - $"v{expectedVersion} (executing OSS {TestClusterManager.CassandraVersion})"; + $"v{expectedVersion} (executing {TestClusterManager.CassandraVersion})"; return false; } diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 6321cb01b..dccf8d175 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -31,18 +31,12 @@ public static class TestClusterManager private static readonly Version Version2Dot0 = new Version(2, 0); private static readonly Version Version2Dot1 = new Version(2, 1); - private static readonly Version Version2Dot2 = new Version(2, 2); private static readonly Version Version3Dot0 = new Version(3, 0); - private static readonly Version Version3Dot1 = new Version(3, 1); private static readonly Version Version3Dot11 = new Version(3, 11); - private static readonly Version Version3Dot12 = new Version(3, 12); private static readonly Version Version4Dot0 = new Version(4, 0); - private static readonly Version Version4Dot6 = new Version(4, 6); private static readonly Version Version4Dot7 = new Version(4, 7); - private static readonly Version Version4Dot8 = new Version(4, 8); private static readonly Version Version5Dot0 = new Version(5, 0); private static readonly Version Version5Dot1 = new Version(5, 1); - private static readonly Version Version6Dot0 = new Version(6, 0); private static readonly Version Version6Dot9 = new Version(6, 9); /// diff --git a/src/Cassandra/SchemaParser.cs b/src/Cassandra/SchemaParser.cs index 92bf3e356..6d2fd5b3b 100644 --- a/src/Cassandra/SchemaParser.cs +++ b/src/Cassandra/SchemaParser.cs @@ -840,7 +840,8 @@ public override Task GetAggregateAsync(string keyspaceName, s StateFunction = row.GetValue("state_func"), FinalFunction = row.GetValue("final_func"), InitialCondition = row.GetValue("initcond"), - Deterministic = row.GetColumn("deterministic") != null && row.GetValue("deterministic").GetValueOrDefault(false), + Deterministic = row.GetColumn("deterministic") != null && + row.GetValue("deterministic"), Signature = argumentTypes, StateType = tasks[0].Result, ReturnType = tasks[1].Result, @@ -892,14 +893,10 @@ public override Task GetFunctionAsync(string keyspaceName, str if (row.GetColumn("deterministic") != null) { - // DSE 6.0+ or HCD - result.Deterministic = row.GetValue("deterministic").GetValueOrDefault(false); - result.Monotonic = row.GetValue("monotonic").GetValueOrDefault(false); + // DSE 6.0+ + result.Deterministic = row.GetValue("deterministic"); + result.Monotonic = row.GetValue("monotonic"); result.MonotonicOn = row.GetValue("monotonic_on"); - if (result.MonotonicOn is null) - { - result.MonotonicOn = new string[0]; - } } return result; From 7638e82db597d5a4f8685855ce85117264d2c8f6 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 20 Nov 2024 10:04:20 -0800 Subject: [PATCH 16/24] add 6.7.17 --- Jenkinsfile | 1 + .../TestClusterManagement/TestClusterManager.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0cb333b58..d6e972c1e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -449,6 +449,7 @@ pipeline { '4.1', // latest 4.x Apache Cassandra� '5.0', // Development Apache Cassandra� 'dse-5.1.35', // latest 5.1.x DataStax Enterprise + 'dse-6.7.17', // latest 6.7.x DataStax Enterprise 'dse-6.9.3', // latest DataStax Enterprise 'hcd-1.0.0' // Hyper-Converged Database } diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index dccf8d175..292229c34 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -38,6 +38,7 @@ public static class TestClusterManager private static readonly Version Version5Dot0 = new Version(5, 0); private static readonly Version Version5Dot1 = new Version(5, 1); private static readonly Version Version6Dot9 = new Version(6, 9); + private static readonly Version Version6Dot10 = new Version(6, 10); /// /// Gets the Cassandra version used for this test run @@ -64,7 +65,7 @@ public static Version CassandraVersion // C* 3.0 return Version3Dot0; } - if (dseVersion <= Version6Dot9) + if (dseVersion < Version6Dot10) { // C* 3.11 return Version3Dot11; From 1b51a9ff51d14d151adc383667077f14ee82237a Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 20 Nov 2024 19:04:14 -0800 Subject: [PATCH 17/24] adding back all versions --- Jenkinsfile | 12 ++++++++---- src/Cassandra.IntegrationTests/Core/PagingTests.cs | 2 +- .../Core/ParameterizedStatementsTests.cs | 4 ++-- .../Core/PreparedStatementsTests.cs | 4 ++-- .../Core/TypeSerializersTests.cs | 2 +- .../TestBase/TestCassandraVersion.cs | 9 +++++++-- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d6e972c1e..1300f83aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -445,13 +445,17 @@ pipeline { axes { axis { name 'SERVER_VERSION' - values '3.11', // latest 3.11.x Apache Cassandra� - '4.1', // latest 4.x Apache Cassandra� + values '3.0', // latest 3.0.x Apache Cassandra� + '3.11', // latest 3.11.x Apache Cassandra� + '4.0', // latest 4.0.x Apache Cassandra� + '4.1', '5.0', // Development Apache Cassandra� + '5.1', 'dse-5.1.35', // latest 5.1.x DataStax Enterprise 'dse-6.7.17', // latest 6.7.x DataStax Enterprise - 'dse-6.9.3', // latest DataStax Enterprise - 'hcd-1.0.0' // Hyper-Converged Database + 'dse-6.8.30', // 6.8 current DataStax Enterprise + 'dse-6.9.3', + 'hcd-1.0.0' } axis { name 'DOTNET_VERSION' diff --git a/src/Cassandra.IntegrationTests/Core/PagingTests.cs b/src/Cassandra.IntegrationTests/Core/PagingTests.cs index f62108e29..2bdf05a8e 100644 --- a/src/Cassandra.IntegrationTests/Core/PagingTests.cs +++ b/src/Cassandra.IntegrationTests/Core/PagingTests.cs @@ -126,7 +126,7 @@ public void Should_PagingOnBoundStatement_When_ReceivedNumberOfRowsIsOne() } [Test] - [TestCassandraVersion(4, 0)] + [TestBothServersVersion(4, 0, 6, 0)] public void Should_PagingOnBoundStatement_When_NewResultMetadataIsSet() { if (Session.Cluster.Metadata.ControlConnection.Serializer.CurrentProtocolVersion < ProtocolVersion.V5) diff --git a/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs b/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs index 549f41183..665c43e1b 100644 --- a/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs +++ b/src/Cassandra.IntegrationTests/Core/ParameterizedStatementsTests.cs @@ -519,7 +519,7 @@ public void SimpleStatement_Dictionary_Parameters_CaseInsensitivity_ExcessOfPara } [Test] - [TestCassandraVersion(4, 0)] + [TestBothServersVersion(4, 0, 6, 0)] public void SimpleStatement_With_Keyspace_Defined_On_Protocol_Greater_Than_4() { if (Session.Cluster.Metadata.ControlConnection.Serializer.CurrentProtocolVersion < ProtocolVersion.V5) @@ -537,7 +537,7 @@ public void SimpleStatement_With_Keyspace_Defined_On_Protocol_Greater_Than_4() } [Test] - [TestCassandraVersion(4, 0, Comparison.LessThan)] + [TestBothServersVersion(4, 0, 5,1, Comparison.LessThan)] public void SimpleStatement_With_Keyspace_Defined_On_Lower_Protocol_Versions() { // It should fail as the keyspace from the session will be used diff --git a/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs b/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs index 659ecf4da..c1a2995fe 100644 --- a/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs +++ b/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs @@ -898,7 +898,7 @@ public void Session_Prepare_With_Keyspace_Defined_On_Protocol_V4() } [Test] - [TestCassandraVersion(4, 0, Comparison.LessThan)] + [TestBothServersVersion(4, 0, 5,1, Comparison.LessThan)] public void Session_Prepare_With_Keyspace_Defined_On_Previuos_Cassandra_Versions() { TestKeyspaceInPrepareNotSupported(false); @@ -1111,7 +1111,7 @@ public void BatchStatement_With_Keyspace_Defined_On_Protocol_Greater_Than_4() } [Test] - [TestCassandraVersion(4, 0, Comparison.LessThan)] + [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()) diff --git a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs index a003c13fb..830cefc8c 100644 --- a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs +++ b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs @@ -235,7 +235,7 @@ public void Should_Use_Custom_TypeSerializers() } } - [Test, TestCassandraVersion(4, 0, Comparison.LessThan)] + [Test, TestBothServersVersion(4, 0, 5,1, Comparison.LessThan)] public void DynamicCompositeTypeTest() { string uniqueTableName = TestUtils.GetUniqueTableName(); diff --git a/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs b/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs index 877e78de0..46db8b158 100644 --- a/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs +++ b/src/Cassandra.IntegrationTests/TestBase/TestCassandraVersion.cs @@ -81,14 +81,19 @@ protected virtual bool IsDseRequired() public void ApplyToTest(NUnit.Framework.Internal.Test test) { - var expectedVersion = new Version(Major, Minor, Build); - if (!TestCassandraVersion.VersionMatch(expectedVersion, IsDseRequired(), IsOssRequired, Comparison, out var msg)) + if (!Applies(out string msg)) { test.RunState = RunState.Ignored; var message = msg; test.Properties.Set("_SKIPREASON", message); } } + + public bool Applies(out string msg) + { + var expectedVersion = new Version(Major, Minor, Build); + return TestDseVersion.VersionMatch(expectedVersion, IsDseRequired(), IsOssRequired, Comparison, out msg); + } public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool requiresOss, Comparison comparison, out string message) { From 1232d7fe4aa9da09fffae0efcfab4caac9174dcc Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 20 Nov 2024 20:20:02 -0800 Subject: [PATCH 18/24] Vector tests do not run with DSE --- Jenkinsfile | 1 - .../Core/TypeSerializersTests.cs | 12 ++++++------ .../Linq/LinqRealClusterTests.cs | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1300f83aa..bb6c56d5f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -450,7 +450,6 @@ pipeline { '4.0', // latest 4.0.x Apache Cassandra� '4.1', '5.0', // Development Apache Cassandra� - '5.1', 'dse-5.1.35', // latest 5.1.x DataStax Enterprise 'dse-6.7.17', // latest 6.7.x DataStax Enterprise 'dse-6.8.30', // 6.8 current DataStax Enterprise diff --git a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs index 830cefc8c..3e9146b72 100644 --- a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs +++ b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs @@ -371,7 +371,7 @@ private static IEnumerable VectorTestCaseData() }; } - [Test, TestBothServersVersion(5, 0, 6, 9), TestCaseSource(nameof(VectorTestCaseData))] + [Test, TestCassandraVersion(5, 0), TestCaseSource(nameof(VectorTestCaseData))] public void VectorSimpleStatementTest(string cqlSubType, Func elementGeneratorFn, Action assertFn) { SetupVectorUdtSchema(); @@ -392,7 +392,7 @@ public void VectorSimpleStatementTest(string cqlSubType, Func elementGener vectorSimpleStmtTestFn((i, v) => new SimpleStatement(new Dictionary { { "idx", i }, { "vec", v } }, $"INSERT INTO {tableName} (i, j) VALUES (:idx, :vec)")); } - [Test, TestBothServersVersion(5, 0, 6, 9), TestCaseSource(nameof(VectorTestCaseData))] + [Test, TestCassandraVersion(5, 0), TestCaseSource(nameof(VectorTestCaseData))] public void VectorSimpleStatementTestComplex(string cqlSubType, Func elementGeneratorFn, Action assertFn) { SetupVectorUdtSchema(); @@ -429,7 +429,7 @@ public void VectorSimpleStatementTestComplex(string cqlSubType, Func eleme $"INSERT INTO {tableNameComplex} (i, k, l) VALUES (:idx, :vec, :vecc)")); } - [Test, TestBothServersVersion(5, 0, 6, 9), TestCaseSource(nameof(VectorTestCaseData))] + [Test, TestCassandraVersion(5, 0), TestCaseSource(nameof(VectorTestCaseData))] public void VectorPreparedStatementTest(string cqlSubType, Func elementGeneratorFn, Action assertFn) { SetupVectorUdtSchema(); @@ -453,7 +453,7 @@ public void VectorPreparedStatementTest(string cqlSubType, Func elementGen vectorPreparedStmtTestFn($"INSERT INTO {tableName} (i, j) VALUES (:idx, :vec)", (i, v, ps) => ps.Bind(new { idx = i, vec = v })); } - [Test, TestBothServersVersion(5, 0, 6, 9), TestCaseSource(nameof(VectorTestCaseData))] + [Test, TestCassandraVersion(5, 0), TestCaseSource(nameof(VectorTestCaseData))] public void VectorPreparedStatementTestComplex(string cqlSubType, Func elementGeneratorFn, Action assertFn) { SetupVectorUdtSchema(); @@ -498,7 +498,7 @@ public void VectorPreparedStatementTestComplex(string cqlSubType, Func ele )); } - [Test, TestBothServersVersion(5, 0, 6, 9), TestCaseSource(nameof(VectorTestCaseData))] + [Test, TestCassandraVersion(5, 0), TestCaseSource(nameof(VectorTestCaseData))] public void VectorTestCollectionConversion(string cqlSubType, Func elementGeneratorFn, Action assertFn) { SetupVectorUdtSchema(); @@ -534,7 +534,7 @@ public void VectorTestCollectionConversion(string cqlSubType, Func element vectorPreparedStmtTestFn($"INSERT INTO {tableName} (i, j) VALUES (:idx, :vec)", (i, v, ps) => ps.Bind(new { idx = i, vec = v })); } - [Test, TestBothServersVersion(5, 0, 6, 9), TestCaseSource(nameof(VectorTestCaseData))] + [Test, TestCassandraVersion(5, 0), TestCaseSource(nameof(VectorTestCaseData))] public void VectorTestCollectionConversionComplex(string cqlSubType, Func elementGeneratorFn, Action assertFn) { SetupVectorUdtSchema(); diff --git a/src/Cassandra.IntegrationTests/Linq/LinqRealClusterTests.cs b/src/Cassandra.IntegrationTests/Linq/LinqRealClusterTests.cs index 7348d1a2d..264202b7a 100644 --- a/src/Cassandra.IntegrationTests/Linq/LinqRealClusterTests.cs +++ b/src/Cassandra.IntegrationTests/Linq/LinqRealClusterTests.cs @@ -407,7 +407,7 @@ public void CreateTable_With_Vectors() Assert.Throws(() => table.Create()); } - [Test, TestBothServersVersion(5, 0, 6, 9)] + [Test, TestCassandraVersion(5, 0)] [TestCase(true)] [TestCase(false)] public void LinqWhere_WithVectors(bool withMapConfig) From 966a77c5922f5ccfdd8ca959c0861d6d2bceba89 Mon Sep 17 00:00:00 2001 From: janehe Date: Thu, 21 Nov 2024 00:01:00 -0800 Subject: [PATCH 19/24] What if we map 6.x to 4.0 --- .../TestClusterManagement/TestClusterManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 292229c34..9753a2ab6 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -37,6 +37,7 @@ public static class TestClusterManager private static readonly Version Version4Dot7 = new Version(4, 7); private static readonly Version Version5Dot0 = new Version(5, 0); private static readonly Version Version5Dot1 = new Version(5, 1); + private static readonly Version Version6Dot0 = new Version(6, 0); private static readonly Version Version6Dot9 = new Version(6, 9); private static readonly Version Version6Dot10 = new Version(6, 10); @@ -65,7 +66,7 @@ public static Version CassandraVersion // C* 3.0 return Version3Dot0; } - if (dseVersion < Version6Dot10) + if (dseVersion < Version6Dot0) { // C* 3.11 return Version3Dot11; From 6c58320056cbc77075c2e68e8b46bf5898800a25 Mon Sep 17 00:00:00 2001 From: janehe Date: Thu, 21 Nov 2024 09:20:06 -0800 Subject: [PATCH 20/24] tests count should be the same --- .../Core/PreparedStatementsTests.cs | 8 ++++---- .../Core/TypeSerializersTests.cs | 15 +++++++++++++++ .../TestClusterManagement/TestClusterManager.cs | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs b/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs index c1a2995fe..ae4762c7f 100644 --- a/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs +++ b/src/Cassandra.IntegrationTests/Core/PreparedStatementsTests.cs @@ -825,7 +825,7 @@ public void Bound_TinyInt_Tests() [TestCase(true)] [TestCase(false)] - [TestCassandraVersion(4, 0)] + [TestBothServersVersion(4,0,5,1)] public void Session_Prepare_With_Keyspace_Defined_On_Protocol_Greater_Than_4(bool usePayload) { if (Session.Cluster.Metadata.ControlConnection.Serializer.CurrentProtocolVersion < ProtocolVersion.V5) @@ -858,7 +858,7 @@ public void Session_Prepare_With_Keyspace_Defined_On_Protocol_Greater_Than_4(boo [TestCase(true)] [TestCase(false)] - [TestCassandraVersion(4, 0)] + [TestBothServersVersion(4,0,5,1)] public async Task Session_PrepareAsync_With_Keyspace_Defined_On_Protocol_Greater_Than_4(bool usePayload) { if (Session.Cluster.Metadata.ControlConnection.Serializer.CurrentProtocolVersion < ProtocolVersion.V5) @@ -891,7 +891,7 @@ await TestHelper.TimesLimit(async () => } [Test] - [TestCassandraVersion(4, 0)] + [TestBothServersVersion(4,0,5,1)] public void Session_Prepare_With_Keyspace_Defined_On_Protocol_V4() { TestKeyspaceInPrepareNotSupported(true); @@ -1085,7 +1085,7 @@ public void Batch_PreparedStatements_NotSupportedInC1_2() } [Test] - [TestCassandraVersion(4, 0)] + [TestBothServersVersion(4,0,5,1)] public void BatchStatement_With_Keyspace_Defined_On_Protocol_Greater_Than_4() { using (var cluster = ClusterBuilder().AddContactPoint(TestClusterManager.InitialContactPoint).Build()) diff --git a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs index 3e9146b72..c49134c0c 100644 --- a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs +++ b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs @@ -596,6 +596,21 @@ public void VectorTestCollectionConversionComplex(string cqlSubType, Func )); } + // [Test] + // [TestDseVersion(6, 9)] + // public void VectorFloatTest() + // { + // var tableName = TestUtils.GetUniqueTableName(); + // Session.Execute($"CREATE TABLE {tableName} (i int PRIMARY KEY, j vector"); + // + // var vector = new CqlVector(1.1f, 2.2f, 3.3f); + // + // Session.Execute(new SimpleStatement($"INSERT INTO {tableName} (i, j, k) VALUES (1, ?, ?)", vector, new CqlVector>(vectorList[0], vectorList[1], vectorList[2]))); + // var rs = Session.Execute($"SELECT * FROM {tableName} WHERE i = 1"); + // AssertSimpleVectorTest(vector, rs, Assert.AreEqual); + // AssertComplexVectorTest(vectorList, rs, Assert.AreEqual); + // } + private void AssertSimpleVectorTest(CqlVector expected, RowSet rs, Action assertFn) { var rowList = rs.ToList(); diff --git a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs index 9753a2ab6..08502d525 100644 --- a/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs +++ b/src/Cassandra.IntegrationTests/TestClusterManagement/TestClusterManager.cs @@ -66,7 +66,7 @@ public static Version CassandraVersion // C* 3.0 return Version3Dot0; } - if (dseVersion < Version6Dot0) + if (dseVersion < Version6Dot10) { // C* 3.11 return Version3Dot11; From 1417a70e045654dd248e3f3d83c08b8eeb67d049 Mon Sep 17 00:00:00 2001 From: janehe Date: Thu, 21 Nov 2024 09:32:33 -0800 Subject: [PATCH 21/24] VectorFloatTest --- .../Core/TypeSerializersTests.cs | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs index c49134c0c..2210b101a 100644 --- a/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs +++ b/src/Cassandra.IntegrationTests/Core/TypeSerializersTests.cs @@ -596,20 +596,33 @@ public void VectorTestCollectionConversionComplex(string cqlSubType, Func )); } - // [Test] - // [TestDseVersion(6, 9)] - // public void VectorFloatTest() - // { - // var tableName = TestUtils.GetUniqueTableName(); - // Session.Execute($"CREATE TABLE {tableName} (i int PRIMARY KEY, j vector"); - // - // var vector = new CqlVector(1.1f, 2.2f, 3.3f); - // - // Session.Execute(new SimpleStatement($"INSERT INTO {tableName} (i, j, k) VALUES (1, ?, ?)", vector, new CqlVector>(vectorList[0], vectorList[1], vectorList[2]))); - // var rs = Session.Execute($"SELECT * FROM {tableName} WHERE i = 1"); - // AssertSimpleVectorTest(vector, rs, Assert.AreEqual); - // AssertComplexVectorTest(vectorList, rs, Assert.AreEqual); - // } + [Test] + [TestDseVersion(6, 9)] + public void VectorFloatTest() + { + var tableName = TestUtils.GetUniqueTableName(); + Session.Execute($"CREATE TABLE {tableName} (i int PRIMARY KEY, j vector)"); + + var vector = new CqlVector(1.1f, 2.2f, 3.3f); + + // Simple insert and select + Session.Execute(new SimpleStatement($"INSERT INTO {tableName} (i, j) VALUES (1, ?)", vector)); + var rs = Session.Execute($"SELECT * FROM {tableName} WHERE i = 1"); + AssertSimpleVectorTest(vector, rs, Assert.AreEqual); + + // Prepared insert and select + var ps = Session.Prepare($"INSERT INTO {tableName} (i, j) VALUES (?, ?)"); + Session.Execute(ps.Bind(2, vector)); + rs = Session.Execute($"SELECT * FROM {tableName} WHERE i = 2"); + AssertSimpleVectorTest(vector, rs, Assert.AreEqual); + + // throw when length is not 3 + Assert.Throws(() => + { + var shortVector = new CqlVector(1.1f, 2.2f); + Session.Execute(new SimpleStatement($"INSERT INTO {tableName} (i, j) VALUES (3, ?)", shortVector)); + }); + } private void AssertSimpleVectorTest(CqlVector expected, RowSet rs, Action assertFn) { From 3fddfa43dd20dda9aeba0e5271100fa06aaa1eef Mon Sep 17 00:00:00 2001 From: janehe Date: Thu, 21 Nov 2024 11:33:22 -0800 Subject: [PATCH 22/24] decrease matrix --- Jenkinsfile | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bb6c56d5f..a17c7d2ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -445,16 +445,13 @@ pipeline { axes { axis { name 'SERVER_VERSION' - values '3.0', // latest 3.0.x Apache Cassandra� - '3.11', // latest 3.11.x Apache Cassandra� - '4.0', // latest 4.0.x Apache Cassandra� - '4.1', + values '3.11', // latest 3.11.x Apache Cassandra� + '4.1', // latest 4.x Apache Cassandra� '5.0', // Development Apache Cassandra� 'dse-5.1.35', // latest 5.1.x DataStax Enterprise 'dse-6.7.17', // latest 6.7.x DataStax Enterprise - 'dse-6.8.30', // 6.8 current DataStax Enterprise - 'dse-6.9.3', - 'hcd-1.0.0' + 'dse-6.9.3', // latest DataStax Enterprise + 'hcd-1.0.0' // Hyper-Converged Database } axis { name 'DOTNET_VERSION' @@ -465,11 +462,11 @@ pipeline { exclude { axis { name 'DOTNET_VERSION' - values 'mono', 'net8' + values 'mono' } axis { name 'SERVER_VERSION' - values '3.0', '5.0', 'dse-5.1.35' + values '4.1', 'dse-5.1.35', 'dse-6.8.30' } } exclude { @@ -479,7 +476,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '3.11' + values '5.0', 'dse-6.9.3', 'hcd-1.0.0' } } } From 729b23f0c1bdee17be3cd47c7ce6ddf812c049f5 Mon Sep 17 00:00:00 2001 From: janehe Date: Fri, 22 Nov 2024 07:47:44 -0800 Subject: [PATCH 23/24] trim matrix --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a17c7d2ae..38838ab86 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -449,7 +449,7 @@ pipeline { '4.1', // latest 4.x Apache Cassandra� '5.0', // Development Apache Cassandra� 'dse-5.1.35', // latest 5.1.x DataStax Enterprise - 'dse-6.7.17', // latest 6.7.x DataStax Enterprise + 'dse-6.8.30', // latest 6.7.x DataStax Enterprise 'dse-6.9.3', // latest DataStax Enterprise 'hcd-1.0.0' // Hyper-Converged Database } @@ -466,7 +466,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '4.1', 'dse-5.1.35', 'dse-6.8.30' + values '3.11', 4.1', 'dse-5.1.35', 'dse-6.8.30' } } exclude { @@ -476,7 +476,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '5.0', 'dse-6.9.3', 'hcd-1.0.0' + values '3.11', 5.0', 'dse-6.9.3', 'hcd-1.0.0' } } } From e6cda974dc5b37783dc942cdc4063badde061205 Mon Sep 17 00:00:00 2001 From: janehe Date: Fri, 22 Nov 2024 08:00:20 -0800 Subject: [PATCH 24/24] '' --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 38838ab86..4b9fc80e9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -466,7 +466,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '3.11', 4.1', 'dse-5.1.35', 'dse-6.8.30' + values '3.11', '4.1', 'dse-5.1.35', 'dse-6.8.30' } } exclude { @@ -476,7 +476,7 @@ pipeline { } axis { name 'SERVER_VERSION' - values '3.11', 5.0', 'dse-6.9.3', 'hcd-1.0.0' + values '3.11', '5.0', 'dse-6.9.3', 'hcd-1.0.0' } } }