Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7ef8e69
can create db
SiyaoIsHiding Dec 10, 2025
ee9ef83
simple statement astra IT seems to work.
SiyaoIsHiding Dec 12, 2025
6421428
can tear down
SiyaoIsHiding Dec 12, 2025
5e3efe0
can tear down
SiyaoIsHiding Dec 16, 2025
6dcc519
SimpleStatementIT works with both
SiyaoIsHiding Dec 16, 2025
68b2baf
creation of keyspace works. several tests work
SiyaoIsHiding Dec 19, 2025
fe98275
annotation?
SiyaoIsHiding Dec 19, 2025
1b96e90
in mid of refactoring so Astra extends CCM. Not working yet.
SiyaoIsHiding Dec 20, 2025
273fdc3
revert some changes
SiyaoIsHiding Dec 20, 2025
440d652
refactor so Astra extends CCM. Create keyspace for each test suite.
SiyaoIsHiding Jan 9, 2026
f981524
can use an existing DB
SiyaoIsHiding Jan 9, 2026
3acdff7
skip two tests
SiyaoIsHiding Jan 9, 2026
09d5fe4
Upgrade to the latest astra CLI version. skip some tests.
SiyaoIsHiding Jan 20, 2026
b3aa65e
drop all tables and udts between test suites. skip more tests.
SiyaoIsHiding Jan 22, 2026
7551470
run parallelable tests sequentially when running against Astra
SiyaoIsHiding Jan 23, 2026
5d0459e
green run
SiyaoIsHiding Jan 27, 2026
05e14bc
Jenkinsfile-astra
SiyaoIsHiding Jan 30, 2026
5733203
remove database ID
SiyaoIsHiding Jan 30, 2026
a48421c
remove cron
SiyaoIsHiding Jan 30, 2026
cc6ceaa
Update Jenkinsfile-astra
SiyaoIsHiding Feb 24, 2026
b9f5de7
add logging
SiyaoIsHiding Feb 24, 2026
f2493c3
fmt
SiyaoIsHiding Feb 24, 2026
de3e6f5
change to apache executor
SiyaoIsHiding Feb 25, 2026
fa48c84
CommandLine("/home/jenkins/.astra/cli/astra");
SiyaoIsHiding Feb 25, 2026
c8ae163
back to astra
SiyaoIsHiding Feb 25, 2026
286add3
toURI
SiyaoIsHiding Feb 25, 2026
5c22bfc
db delete --yes
SiyaoIsHiding Feb 27, 2026
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
179 changes: 179 additions & 0 deletions Jenkinsfile-astra
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
#!groovy
/*
* 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.
*/

def initializeEnvironment() {
env.DRIVER_DISPLAY_NAME = 'Java Driver for Apache Cassandra® - Astra Tests'
env.DRIVER_METRIC_TYPE = 'oss'

env.GIT_SHA = "${env.GIT_COMMIT.take(7)}"
env.GITHUB_PROJECT_URL = "https://${GIT_URL.replaceFirst(/(git@|http:\/\/|https:\/\/)/, '').replace(':', '/').replace('.git', '')}"
env.GITHUB_BRANCH_URL = "${GITHUB_PROJECT_URL}/tree/${env.BRANCH_NAME}"
env.GITHUB_COMMIT_URL = "${GITHUB_PROJECT_URL}/commit/${env.GIT_COMMIT}"

env.MAVEN_HOME = "${env.HOME}/.mvn/apache-maven-3.8.8"
env.PATH = "${env.MAVEN_HOME}/bin:/home/jenkins/.astra/cli:${env.PATH}"

env.JAVA_HOME = sh(label: 'Get JAVA_HOME',script: '''#!/bin/bash -le
. ${JABBA_SHELL}
jabba which 1.8''', returnStdout: true).trim()

sh label: 'Display Java and environment information',script: '''#!/bin/bash -le
. ${JABBA_SHELL}
jabba use 1.8

java -version
mvn -v
printenv | sort
astra help
'''
}

def buildDriver() {
sh label: 'Build driver', script: '''#!/bin/bash -le
. ${JABBA_SHELL}
jabba use 1.8

echo "Building with Java version 1.8"

mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true
'''
}

def executeAstraTests() {
withCredentials([
string(credentialsId: 'astra-integration-test-token', variable: 'ASTRA_TOKEN')
]) {
sh label: 'Execute Astra integration tests', script: '''#!/bin/bash -lex
. ${JABBA_SHELL}
jabba use 1.8

printenv | sort

mvn -B -V verify \
-DfailIfNoTests=false \
-Dmaven.test.failure.ignore=true \
-Dmaven.javadoc.skip=true \
-Dccm.distribution=Astra \
-Dastra.token=${ASTRA_TOKEN}
'''
}
}

def notifySlack(status = 'started') {
def color = 'good' // Green
if (status.equalsIgnoreCase('aborted')) {
color = '808080' // Grey
} else if (status.equalsIgnoreCase('unstable')) {
color = 'warning' // Orange
} else if (status.equalsIgnoreCase('failed')) {
color = 'danger' // Red
}

def message = """Build ${status} for ${env.DRIVER_DISPLAY_NAME}
<${env.GITHUB_BRANCH_URL}|${env.BRANCH_NAME}> - <${env.RUN_DISPLAY_URL}|#${env.BUILD_NUMBER}> - <${env.GITHUB_COMMIT_URL}|${env.GIT_SHA}>"""
if (!status.equalsIgnoreCase('Started')) {
message += """
${status} after ${currentBuild.durationString - ' and counting'}"""
}

slackSend color: "${color}",
channel: "#java-driver-dev-bots",
message: "${message}"
}

pipeline {
agent {
label 'ubuntu/jammy64/java-driver'
}

// Global pipeline timeout
options {
timeout(time: 2, unit: 'HOURS')
buildDiscarder(logRotator(artifactNumToKeepStr: '10', // Keep only the last 10 artifacts
numToKeepStr: '50')) // Keep only the last 50 build records
}

environment {
JABBA_SHELL = '/usr/lib/jabba/jabba.sh'
SERIAL_ITS_ARGUMENT = "-DskipSerialITs=${params.SKIP_SERIAL_ITS}"
ISOLATED_ITS_ARGUMENT = "-DskipIsolatedITs=${params.SKIP_ISOLATED_ITS}"
PARALLELIZABLE_ITS_ARGUMENT = "-DskipParallelizableITs=${params.SKIP_PARALLELIZABLE_ITS}"
INTEGRATION_TESTS_FILTER = "${params.INTEGRATION_TESTS_FILTER}"
}

stages {
stage('Initialize-Environment') {
steps {
initializeEnvironment()
notifySlack()
}
}

stage('Describe-Build') {
steps {
script {
currentBuild.displayName = "Astra Integration Tests"
currentBuild.description = "Running integration tests against DataStax Astra"
}
}
}

stage('Build-Driver') {
steps {
buildDriver()
}
}

stage('Execute-Astra-Tests') {
steps {
catchError {
executeAstraTests()
}
}
post {
always {
/*
* Empty results are possible
*
* - Build failures during mvn verify may exist so report may not be available
* - With boolean parameters to skip tests a failsafe report may not be available
*/
junit testResults: '**/target/surefire-reports/TEST-*.xml', allowEmptyResults: true
junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true
}
}
}
}

post {
aborted {
notifySlack('aborted')
}
success {
notifySlack('completed')
}
unstable {
notifySlack('unstable')
}
failure {
notifySlack('FAILED')
}
}
}
2 changes: 1 addition & 1 deletion Jenkinsfile-datastax
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ pipeline {
}

environment {
OS_VERSION = 'ubuntu/focal64/java-driver'
OS_VERSION = 'ubuntu/jammy64/java-driver'
JABBA_SHELL = '/usr/lib/jabba/jabba.sh'
CCM_ENVIRONMENT_SHELL = '/usr/local/bin/ccm_environment.sh'
SERIAL_ITS_ARGUMENT = "-DskipSerialITs=${params.SKIP_SERIAL_ITS}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -55,12 +56,22 @@ public class ReloadingKeyManagerFactoryTest {
private static final Logger logger =
LoggerFactory.getLogger(ReloadingKeyManagerFactoryTest.class);

static final Path CERT_BASE =
Paths.get(
ReloadingKeyManagerFactoryTest.class
.getResource(
String.format("/%s/certs/", ReloadingKeyManagerFactoryTest.class.getSimpleName()))
.getPath());
static final Path CERT_BASE;

static {
try {
CERT_BASE =
Paths.get(
ReloadingKeyManagerFactoryTest.class
.getResource(
String.format(
"/%s/certs/", ReloadingKeyManagerFactoryTest.class.getSimpleName()))
.toURI());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}

static final Path SERVER_KEYSTORE_PATH = CERT_BASE.resolve("server.keystore");
static final Path SERVER_TRUSTSTORE_PATH = CERT_BASE.resolve("server.truststore");

Expand Down
28 changes: 26 additions & 2 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<skipParallelizableITs>${skipITs}</skipParallelizableITs>
<skipSerialITs>${skipITs}</skipSerialITs>
<skipIsolatedITs>${skipITs}</skipIsolatedITs>
<!-- Default: run test classes in parallel for CCM/Cassandra -->
<astra.parallel.mode>classes</astra.parallel.mode>
<astra.thread.count>8</astra.thread.count>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -238,8 +241,10 @@
<configuration>
<jvm>${testing.jvm}/bin/java</jvm>
<groups>com.datastax.oss.driver.categories.ParallelizableTests</groups>
<parallel>classes</parallel>
<threadCountClasses>8</threadCountClasses>
<!-- When running against Astra, run test classes sequentially to avoid conflicts
in the shared keyspace. For CCM/Cassandra, run in parallel for speed. -->
<parallel>${astra.parallel.mode}</parallel>
<threadCountClasses>${astra.thread.count}</threadCountClasses>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-parallelized.xml</summaryFile>
<skipITs>${skipParallelizableITs}</skipITs>
<argLine>${blockhound.argline}</argLine>
Expand Down Expand Up @@ -335,4 +340,23 @@
</plugin>
</plugins>
</build>
<profiles>
<!-- When running against Astra, run test classes sequentially to avoid conflicts
in the shared keyspace. Astra uses a single shared database/keyspace for all tests,
so parallel execution causes race conditions when creating/dropping tables. -->
<profile>
<id>astra-sequential</id>
<activation>
<property>
<name>ccm.distribution</name>
<value>Astra</value>
</property>
</activation>
<properties>
<!-- Run test classes sequentially (one at a time) -->
<astra.parallel.mode>none</astra.parallel.mode>
<astra.thread.count>1</astra.thread.count>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
*/
package com.datastax.oss.driver.core;

import static com.datastax.oss.driver.api.testinfra.ccm.CcmBridge.isDistributionOf;
import static org.assertj.core.api.Assertions.assertThat;

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.metadata.EndPoint;
import com.datastax.oss.driver.api.core.metadata.Node;
import com.datastax.oss.driver.api.testinfra.requirement.BackendType;
import com.datastax.oss.driver.internal.core.context.InternalDriverContext;
import com.datastax.oss.protocol.internal.request.Query;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
Expand All @@ -30,6 +32,7 @@
import com.datastax.oss.simulacron.server.Server;
import java.util.concurrent.ExecutionException;
import org.junit.AfterClass;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;

Expand All @@ -41,6 +44,7 @@ public class PeersV2NodeRefreshIT {

@BeforeClass
public static void setup() {
Assume.assumeTrue("Skipping for Astra", !isDistributionOf(BackendType.ASTRA));
peersV2Server = Server.builder().withMultipleNodesPerIp(true).build();
cluster = peersV2Server.register(ClusterSpec.builder().withNodes(2));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.testinfra.ccm.CcmRule;
import com.datastax.oss.driver.api.testinfra.requirement.BackendRequirement;
import com.datastax.oss.driver.api.testinfra.requirement.BackendType;
import com.datastax.oss.driver.api.testinfra.session.SessionUtils;
import com.datastax.oss.driver.categories.ParallelizableTests;
import com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures;
Expand All @@ -40,6 +42,7 @@
import org.junit.experimental.categories.Category;

@Category(ParallelizableTests.class)
@BackendRequirement(type = BackendType.ASTRA, include = false)
public class DriverExecutionProfileCcmIT {

@ClassRule public static final CcmRule CCM_RULE = CcmRule.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.datastax.oss.driver.api.core.cql.SimpleStatementBuilder;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.core.metadata.token.Token;
import com.datastax.oss.driver.api.core.session.SessionBuilder;
import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
import com.datastax.oss.driver.api.testinfra.ccm.CcmRule;
import com.datastax.oss.driver.api.testinfra.ccm.SchemaChangeSynchronizer;
Expand Down Expand Up @@ -434,12 +435,9 @@ private static void verifyUnset(

@SuppressWarnings("unchecked")
private CqlSession sessionWithCustomCodec(CqlIntToStringCodec codec) {
return (CqlSession)
SessionUtils.baseBuilder()
.addContactEndPoints(ccmRule.getContactPoints())
.withKeyspace(sessionRule.keyspace())
.addTypeCodecs(codec)
.build();
SessionBuilder<?, CqlSession> builder =
SessionUtils.baseBuilder(ccmRule, sessionRule.keyspace());
return (CqlSession) builder.addTypeCodecs(codec).build();
}

private boolean supportsPerRequestKeyspace(CqlSession session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
import com.datastax.oss.driver.api.testinfra.ccm.CcmRule;
import com.datastax.oss.driver.api.testinfra.ccm.SchemaChangeSynchronizer;
import com.datastax.oss.driver.api.testinfra.requirement.BackendType;
import com.datastax.oss.driver.api.testinfra.session.SessionRule;
import com.datastax.oss.driver.api.testinfra.session.SessionUtils;
import com.datastax.oss.driver.categories.ParallelizableTests;
import com.datastax.oss.driver.internal.core.type.codec.IntCodec;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.function.UnaryOperator;
import org.junit.Assume;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down Expand Up @@ -108,6 +110,7 @@ private void should_extract_and_reuse(UnaryOperator<PagingState> transformation)

@Test
public void should_inject_in_simple_statement_with_custom_codecs() {
Assume.assumeFalse("Skipped for Astra", CCM_RULE.isDistributionOf(BackendType.ASTRA));
try (CqlSession session =
(CqlSession)
SessionUtils.baseBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
import com.datastax.oss.driver.api.core.metrics.DefaultSessionMetric;
import com.datastax.oss.driver.api.core.session.ProgrammaticArguments;
import com.datastax.oss.driver.api.core.session.SessionBuilder;
import com.datastax.oss.driver.api.testinfra.ccm.CcmBridge;
import com.datastax.oss.driver.api.testinfra.ccm.CustomCcmRule;
import com.datastax.oss.driver.api.testinfra.ccm.SchemaChangeSynchronizer;
import com.datastax.oss.driver.api.testinfra.requirement.BackendType;
import com.datastax.oss.driver.api.testinfra.session.SessionRule;
import com.datastax.oss.driver.api.testinfra.session.SessionUtils;
import com.datastax.oss.driver.categories.IsolatedTests;
Expand Down Expand Up @@ -59,6 +61,7 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import org.junit.AfterClass;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -177,6 +180,7 @@ protected DriverContext buildContext(

@BeforeClass
public static void setup() {
Assume.assumeTrue("Skipped for Astra", !CcmBridge.isDistributionOf(BackendType.ASTRA));
System.setProperty(
SessionUtils.SESSION_BUILDER_CLASS_PROPERTY, PreparedStatementCachingIT.class.getName());
}
Expand Down
Loading