| 1 |
#!groovy |
| 2 |
/* |
| 3 |
|
| 4 |
There are multiple combinations to test the python driver. |
| 5 |
|
| 6 |
Test Profiles: |
| 7 |
|
| 8 |
Full: Execute all unit and integration tests, including long tests. |
| 9 |
Standard: Execute unit and integration tests. |
| 10 |
Smoke Tests: Execute a small subset of tests. |
| 11 |
EVENT_LOOP: Execute a small subset of tests selected to test EVENT_LOOPs. |
| 12 |
|
| 13 |
Matrix Types: |
| 14 |
|
| 15 |
Full: All server versions, python runtimes tested with and without Cython. |
| 16 |
Cassandra: All cassandra server versions. |
| 17 |
Dse: All dse server versions. |
| 18 |
Smoke: CI-friendly configurations. Currently-supported Python version + modern Cassandra/DSE instances. |
| 19 |
We also avoid cython since it's tested as part of the nightlies |
| 20 |
|
| 21 |
Parameters: |
| 22 |
|
| 23 |
EVENT_LOOP: 'LIBEV' (Default), 'GEVENT', 'EVENTLET', 'ASYNCIO', 'ASYNCORE', 'TWISTED' |
| 24 |
CYTHON: Default, 'True', 'False' |
| 25 |
|
| 26 |
*/ |
| 27 |
|
| 28 |
@Library('dsdrivers-pipeline-lib@develop') |
| 29 |
import com.datastax.jenkins.drivers.python.Slack |
| 30 |
|
| 31 |
slack = new Slack() |
| 32 |
|
| 33 |
DEFAULT_CASSANDRA = ['3.0', '3.11', '4.0', '4.1', '5.0-beta1'] |
| 34 |
DEFAULT_DSE = ['dse-5.1.35', 'dse-6.8.30'] |
| 35 |
DEFAULT_RUNTIME = ['3.8.16', '3.9.16', '3.10.11', '3.11.3', '3.12.0'] |
| 36 |
DEFAULT_CYTHON = ["True", "False"] |
| 37 |
matrices = [ |
| 38 |
"FULL": [ |
| 39 |
"SERVER": DEFAULT_CASSANDRA + DEFAULT_DSE, |
| 40 |
"RUNTIME": DEFAULT_RUNTIME, |
| 41 |
"CYTHON": DEFAULT_CYTHON |
| 42 |
], |
| 43 |
"CASSANDRA": [ |
| 44 |
"SERVER": DEFAULT_CASSANDRA, |
| 45 |
"RUNTIME": DEFAULT_RUNTIME, |
| 46 |
"CYTHON": DEFAULT_CYTHON |
| 47 |
], |
| 48 |
"DSE": [ |
| 49 |
"SERVER": DEFAULT_DSE, |
| 50 |
"RUNTIME": DEFAULT_RUNTIME, |
| 51 |
"CYTHON": DEFAULT_CYTHON |
| 52 |
], |
| 53 |
"SMOKE": [ |
| 54 |
"SERVER": DEFAULT_CASSANDRA.takeRight(2) + DEFAULT_DSE.takeRight(1), |
| 55 |
"RUNTIME": DEFAULT_RUNTIME.take(1) + DEFAULT_RUNTIME.takeRight(1), |
| 56 |
"CYTHON": ["True"] |
| 57 |
] |
| 58 |
] |
| 59 |
|
| 60 |
def initializeSlackContext() { |
| 61 |
/* |
| 62 |
Based on git branch/commit, configure the build context and env vars. |
| 63 |
*/ |
| 64 |
|
| 65 |
def driver_display_name = 'Cassandra Python Driver' |
| 66 |
if (env.GIT_URL.contains('riptano/python-driver')) { |
| 67 |
driver_display_name = 'private ' + driver_display_name |
| 68 |
} else if (env.GIT_URL.contains('python-dse-driver')) { |
| 69 |
driver_display_name = 'DSE Python Driver' |
| 70 |
} |
| 71 |
env.DRIVER_DISPLAY_NAME = driver_display_name |
| 72 |
env.GIT_SHA = "${env.GIT_COMMIT.take(7)}" |
| 73 |
env.GITHUB_PROJECT_URL = "https://${GIT_URL.replaceFirst(/(git@|http:\/\/|https:\/\/)/, '').replace(':', '/').replace('.git', '')}" |
| 74 |
env.GITHUB_BRANCH_URL = "${env.GITHUB_PROJECT_URL}/tree/${env.BRANCH_NAME}" |
| 75 |
env.GITHUB_COMMIT_URL = "${env.GITHUB_PROJECT_URL}/commit/${env.GIT_COMMIT}" |
| 76 |
} |
| 77 |
|
| 78 |
def getBuildContext() { |
| 79 |
/* |
| 80 |
Based on schedule and parameters, configure the build context and env vars. |
| 81 |
*/ |
| 82 |
|
| 83 |
def PROFILE = "${params.PROFILE}" |
| 84 |
def EVENT_LOOP = "${params.EVENT_LOOP.toLowerCase()}" |
| 85 |
|
| 86 |
matrixType = params.MATRIX != "DEFAULT" ? params.MATRIX : "SMOKE" |
| 87 |
matrix = matrices[matrixType].clone() |
| 88 |
|
| 89 |
// Check if parameters were set explicitly |
| 90 |
if (params.CYTHON != "DEFAULT") { |
| 91 |
matrix["CYTHON"] = [params.CYTHON] |
| 92 |
} |
| 93 |
|
| 94 |
if (params.SERVER_VERSION != "DEFAULT") { |
| 95 |
matrix["SERVER"] = [params.SERVER_VERSION] |
| 96 |
} |
| 97 |
|
| 98 |
if (params.PYTHON_VERSION != "DEFAULT") { |
| 99 |
matrix["RUNTIME"] = [params.PYTHON_VERSION] |
| 100 |
} |
| 101 |
|
| 102 |
if (params.CI_SCHEDULE == "WEEKNIGHTS") { |
| 103 |
matrix["SERVER"] = params.CI_SCHEDULE_SERVER_VERSION.split(' ') |
| 104 |
matrix["RUNTIME"] = params.CI_SCHEDULE_PYTHON_VERSION.split(' ') |
| 105 |
} |
| 106 |
|
| 107 |
context = [ |
| 108 |
vars: [ |
| 109 |
"PROFILE=${PROFILE}", |
| 110 |
"EVENT_LOOP=${EVENT_LOOP}" |
| 111 |
], |
| 112 |
matrix: matrix |
| 113 |
] |
| 114 |
|
| 115 |
return context |
| 116 |
} |
| 117 |
|
| 118 |
def buildAndTest(context) { |
| 119 |
initializeEnvironment() |
| 120 |
installDriverAndCompileExtensions() |
| 121 |
|
| 122 |
try { |
| 123 |
executeTests() |
| 124 |
} finally { |
| 125 |
junit testResults: '*_results.xml' |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
def getMatrixBuilds(buildContext) { |
| 130 |
def tasks = [:] |
| 131 |
matrix = buildContext.matrix |
| 132 |
|
| 133 |
matrix["SERVER"].each { serverVersion -> |
| 134 |
matrix["RUNTIME"].each { runtimeVersion -> |
| 135 |
matrix["CYTHON"].each { cythonFlag -> |
| 136 |
def taskVars = [ |
| 137 |
"CASSANDRA_VERSION=${serverVersion}", |
| 138 |
"PYTHON_VERSION=${runtimeVersion}", |
| 139 |
"CYTHON_ENABLED=${cythonFlag}" |
| 140 |
] |
| 141 |
def cythonDesc = cythonFlag == "True" ? ", Cython": "" |
| 142 |
tasks["${serverVersion}, py${runtimeVersion}${cythonDesc}"] = { |
| 143 |
node("${OS_VERSION}") { |
| 144 |
scm_variables = checkout scm |
| 145 |
env.GIT_COMMIT = scm_variables.get('GIT_COMMIT') |
| 146 |
env.GIT_URL = scm_variables.get('GIT_URL') |
| 147 |
initializeSlackContext() |
| 148 |
|
| 149 |
if (env.BUILD_STATED_SLACK_NOTIFIED != 'true') { |
| 150 |
slack.notifyChannel() |
| 151 |
} |
| 152 |
|
| 153 |
withEnv(taskVars) { |
| 154 |
buildAndTest(context) |
| 155 |
} |
| 156 |
} |
| 157 |
} |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
return tasks |
| 162 |
} |
| 163 |
|
| 164 |
def initializeEnvironment() { |
| 165 |
sh label: 'Initialize the environment', script: '''#!/bin/bash -lex |
| 166 |
pyenv global ${PYTHON_VERSION} |
| 167 |
sudo apt-get install socat |
| 168 |
pip install --upgrade pip |
| 169 |
pip install -U setuptools |
| 170 |
|
| 171 |
# install a version of pyyaml<6.0 compatible with ccm-3.1.5 as of Aug 2023 |
| 172 |
# this works around the python-3.10+ compatibility problem as described in DSP-23524 |
| 173 |
pip install wheel |
| 174 |
pip install "Cython<3.0" "pyyaml<6.0" --no-build-isolation |
| 175 |
pip install ${HOME}/ccm |
| 176 |
''' |
| 177 |
|
| 178 |
// Determine if server version is Apache CassandraⓇ or DataStax Enterprise |
| 179 |
if (env.CASSANDRA_VERSION.split('-')[0] == 'dse') { |
| 180 |
if (env.PYTHON_VERSION =~ /3\.12\.\d+/) { |
| 181 |
echo "Cannot install DSE dependencies for Python 3.12.x; installing Apache CassandraⓇ requirements only. See PYTHON-1368 for more detail." |
| 182 |
sh label: 'Install Apache CassandraⓇ requirements', script: '''#!/bin/bash -lex |
| 183 |
pip install -r test-requirements.txt |
| 184 |
''' |
| 185 |
} |
| 186 |
else { |
| 187 |
sh label: 'Install DataStax Enterprise requirements', script: '''#!/bin/bash -lex |
| 188 |
pip install -r test-datastax-requirements.txt |
| 189 |
''' |
| 190 |
} |
| 191 |
} else { |
| 192 |
sh label: 'Install Apache CassandraⓇ requirements', script: '''#!/bin/bash -lex |
| 193 |
pip install -r test-requirements.txt |
| 194 |
''' |
| 195 |
|
| 196 |
sh label: 'Uninstall the geomet dependency since it is not required for Cassandra', script: '''#!/bin/bash -lex |
| 197 |
pip uninstall -y geomet |
| 198 |
''' |
| 199 |
} |
| 200 |
|
| 201 |
sh label: 'Install unit test modules', script: '''#!/bin/bash -lex |
| 202 |
pip install --no-deps nose-ignore-docstring nose-exclude |
| 203 |
pip install service_identity |
| 204 |
''' |
| 205 |
|
| 206 |
if (env.CYTHON_ENABLED == 'True') { |
| 207 |
sh label: 'Install cython modules', script: '''#!/bin/bash -lex |
| 208 |
pip install cython numpy |
| 209 |
''' |
| 210 |
} |
| 211 |
|
| 212 |
sh label: 'Download Apache CassandraⓇ or DataStax Enterprise', script: '''#!/bin/bash -lex |
| 213 |
. ${CCM_ENVIRONMENT_SHELL} ${CASSANDRA_VERSION} |
| 214 |
''' |
| 215 |
|
| 216 |
if (env.CASSANDRA_VERSION.split('-')[0] == 'dse') { |
| 217 |
env.DSE_FIXED_VERSION = env.CASSANDRA_VERSION.split('-')[1] |
| 218 |
sh label: 'Update environment for DataStax Enterprise', script: '''#!/bin/bash -le |
| 219 |
cat >> ${HOME}/environment.txt << ENVIRONMENT_EOF |
| 220 |
CCM_CASSANDRA_VERSION=${DSE_FIXED_VERSION} # maintain for backwards compatibility |
| 221 |
CCM_VERSION=${DSE_FIXED_VERSION} |
| 222 |
CCM_SERVER_TYPE=dse |
| 223 |
DSE_VERSION=${DSE_FIXED_VERSION} |
| 224 |
CCM_IS_DSE=true |
| 225 |
CCM_BRANCH=${DSE_FIXED_VERSION} |
| 226 |
DSE_BRANCH=${DSE_FIXED_VERSION} |
| 227 |
ENVIRONMENT_EOF |
| 228 |
''' |
| 229 |
} |
| 230 |
|
| 231 |
sh label: 'Display Python and environment information', script: '''#!/bin/bash -le |
| 232 |
# Load CCM environment variables |
| 233 |
set -o allexport |
| 234 |
. ${HOME}/environment.txt |
| 235 |
set +o allexport |
| 236 |
|
| 237 |
python --version |
| 238 |
pip --version |
| 239 |
pip freeze |
| 240 |
printenv | sort |
| 241 |
''' |
| 242 |
} |
| 243 |
|
| 244 |
def installDriverAndCompileExtensions() { |
| 245 |
if (env.CYTHON_ENABLED == 'True') { |
| 246 |
sh label: 'Install the driver and compile with C extensions with Cython', script: '''#!/bin/bash -lex |
| 247 |
python setup.py build_ext --inplace |
| 248 |
''' |
| 249 |
} else { |
| 250 |
sh label: 'Install the driver and compile with C extensions without Cython', script: '''#!/bin/bash -lex |
| 251 |
python setup.py build_ext --inplace --no-cython |
| 252 |
''' |
| 253 |
} |
| 254 |
} |
| 255 |
|
| 256 |
def executeStandardTests() { |
| 257 |
|
| 258 |
sh label: 'Execute unit tests', script: '''#!/bin/bash -lex |
| 259 |
# Load CCM environment variables |
| 260 |
set -o allexport |
| 261 |
. ${HOME}/environment.txt |
| 262 |
set +o allexport |
| 263 |
|
| 264 |
EVENT_LOOP=${EVENT_LOOP} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=unit_results.xml tests/unit/ || true |
| 265 |
EVENT_LOOP_MANAGER=eventlet VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=unit_eventlet_results.xml tests/unit/io/test_eventletreactor.py || true |
| 266 |
EVENT_LOOP_MANAGER=gevent VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=unit_gevent_results.xml tests/unit/io/test_geventreactor.py || true |
| 267 |
''' |
| 268 |
|
| 269 |
sh label: 'Execute Simulacron integration tests', script: '''#!/bin/bash -lex |
| 270 |
# Load CCM environment variables |
| 271 |
set -o allexport |
| 272 |
. ${HOME}/environment.txt |
| 273 |
set +o allexport |
| 274 |
|
| 275 |
. ${JABBA_SHELL} |
| 276 |
jabba use 1.8 |
| 277 |
|
| 278 |
SIMULACRON_JAR="${HOME}/simulacron.jar" |
| 279 |
SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP=${EVENT_LOOP} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --ignore=test_backpressure.py --junit-xml=simulacron_results.xml tests/integration/simulacron/ || true |
| 280 |
|
| 281 |
# Run backpressure tests separately to avoid memory issue |
| 282 |
SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP=${EVENT_LOOP} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --ignore=test_backpressure.py --junit-xml=simulacron_backpressure_1_results.xml tests/integration/simulacron/test_backpressure.py:TCPBackpressureTests.test_paused_connections || true |
| 283 |
SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP=${EVENT_LOOP} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --ignore=test_backpressure.py --junit-xml=simulacron_backpressure_2_results.xml tests/integration/simulacron/test_backpressure.py:TCPBackpressureTests.test_queued_requests_timeout || true |
| 284 |
SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP=${EVENT_LOOP} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --ignore=test_backpressure.py --junit-xml=simulacron_backpressure_3_results.xml tests/integration/simulacron/test_backpressure.py:TCPBackpressureTests.test_cluster_busy || true |
| 285 |
SIMULACRON_JAR=${SIMULACRON_JAR} EVENT_LOOP=${EVENT_LOOP} CASSANDRA_DIR=${CCM_INSTALL_DIR} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --ignore=test_backpressure.py --junit-xml=simulacron_backpressure_4_results.xml tests/integration/simulacron/test_backpressure.py:TCPBackpressureTests.test_node_busy || true |
| 286 |
''' |
| 287 |
|
| 288 |
sh label: 'Execute CQL engine integration tests', script: '''#!/bin/bash -lex |
| 289 |
# Load CCM environment variables |
| 290 |
set -o allexport |
| 291 |
. ${HOME}/environment.txt |
| 292 |
set +o allexport |
| 293 |
|
| 294 |
. ${JABBA_SHELL} |
| 295 |
jabba use 1.8 |
| 296 |
|
| 297 |
EVENT_LOOP=${EVENT_LOOP} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=cqle_results.xml tests/integration/cqlengine/ || true |
| 298 |
''' |
| 299 |
|
| 300 |
sh label: 'Execute Apache CassandraⓇ integration tests', script: '''#!/bin/bash -lex |
| 301 |
# Load CCM environment variables |
| 302 |
set -o allexport |
| 303 |
. ${HOME}/environment.txt |
| 304 |
set +o allexport |
| 305 |
|
| 306 |
. ${JABBA_SHELL} |
| 307 |
jabba use 1.8 |
| 308 |
|
| 309 |
EVENT_LOOP=${EVENT_LOOP} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=standard_results.xml tests/integration/standard/ || true |
| 310 |
''' |
| 311 |
|
| 312 |
if (env.CASSANDRA_VERSION.split('-')[0] == 'dse' && env.CASSANDRA_VERSION.split('-')[1] != '4.8') { |
| 313 |
if (env.PYTHON_VERSION =~ /3\.12\.\d+/) { |
| 314 |
echo "Cannot install DSE dependencies for Python 3.12.x. See PYTHON-1368 for more detail." |
| 315 |
} |
| 316 |
else { |
| 317 |
sh label: 'Execute DataStax Enterprise integration tests', script: '''#!/bin/bash -lex |
| 318 |
# Load CCM environment variable |
| 319 |
set -o allexport |
| 320 |
. ${HOME}/environment.txt |
| 321 |
set +o allexport |
| 322 |
|
| 323 |
. ${JABBA_SHELL} |
| 324 |
jabba use 1.8 |
| 325 |
|
| 326 |
EVENT_LOOP=${EVENT_LOOP} CASSANDRA_DIR=${CCM_INSTALL_DIR} DSE_VERSION=${DSE_VERSION} ADS_HOME="${HOME}/" VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=dse_results.xml tests/integration/advanced/ || true |
| 327 |
''' |
| 328 |
} |
| 329 |
} |
| 330 |
|
| 331 |
sh label: 'Execute DataStax Astra integration tests', script: '''#!/bin/bash -lex |
| 332 |
# Load CCM environment variable |
| 333 |
set -o allexport |
| 334 |
. ${HOME}/environment.txt |
| 335 |
set +o allexport |
| 336 |
|
| 337 |
. ${JABBA_SHELL} |
| 338 |
jabba use 1.8 |
| 339 |
|
| 340 |
EVENT_LOOP=${EVENT_LOOP} CLOUD_PROXY_PATH="${HOME}/proxy/" CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=advanced_results.xml tests/integration/cloud/ || true |
| 341 |
''' |
| 342 |
|
| 343 |
if (env.PROFILE == 'FULL') { |
| 344 |
sh label: 'Execute long running integration tests', script: '''#!/bin/bash -lex |
| 345 |
# Load CCM environment variable |
| 346 |
set -o allexport |
| 347 |
. ${HOME}/environment.txt |
| 348 |
set +o allexport |
| 349 |
|
| 350 |
. ${JABBA_SHELL} |
| 351 |
jabba use 1.8 |
| 352 |
|
| 353 |
EVENT_LOOP=${EVENT_LOOP} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --ignore=tests/integration/long/upgrade --junit-xml=long_results.xml tests/integration/long/ || true |
| 354 |
''' |
| 355 |
} |
| 356 |
} |
| 357 |
|
| 358 |
def executeDseSmokeTests() { |
| 359 |
sh label: 'Execute profile DataStax Enterprise smoke test integration tests', script: '''#!/bin/bash -lex |
| 360 |
# Load CCM environment variable |
| 361 |
set -o allexport |
| 362 |
. ${HOME}/environment.txt |
| 363 |
set +o allexport |
| 364 |
|
| 365 |
. ${JABBA_SHELL} |
| 366 |
jabba use 1.8 |
| 367 |
|
| 368 |
EVENT_LOOP=${EVENT_LOOP} CCM_ARGS="${CCM_ARGS}" CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} DSE_VERSION=${DSE_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=standard_results.xml tests/integration/standard/test_dse.py || true |
| 369 |
''' |
| 370 |
} |
| 371 |
|
| 372 |
def executeEventLoopTests() { |
| 373 |
sh label: 'Execute profile event loop manager integration tests', script: '''#!/bin/bash -lex |
| 374 |
# Load CCM environment variable |
| 375 |
set -o allexport |
| 376 |
. ${HOME}/environment.txt |
| 377 |
set +o allexport |
| 378 |
|
| 379 |
. ${JABBA_SHELL} |
| 380 |
jabba use 1.8 |
| 381 |
|
| 382 |
EVENT_LOOP_TESTS=( |
| 383 |
"tests/integration/standard/test_cluster.py" |
| 384 |
"tests/integration/standard/test_concurrent.py" |
| 385 |
"tests/integration/standard/test_connection.py" |
| 386 |
"tests/integration/standard/test_control_connection.py" |
| 387 |
"tests/integration/standard/test_metrics.py" |
| 388 |
"tests/integration/standard/test_query.py" |
| 389 |
"tests/integration/simulacron/test_endpoint.py" |
| 390 |
"tests/integration/long/test_ssl.py" |
| 391 |
) |
| 392 |
EVENT_LOOP=${EVENT_LOOP} CCM_ARGS="${CCM_ARGS}" DSE_VERSION=${DSE_VERSION} CASSANDRA_VERSION=${CCM_CASSANDRA_VERSION} MAPPED_CASSANDRA_VERSION=${MAPPED_CASSANDRA_VERSION} VERIFY_CYTHON=${CYTHON_ENABLED} JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS -Xss384k" pytest -s -v --log-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --junit-xml=standard_results.xml ${EVENT_LOOP_TESTS[@]} || true |
| 393 |
''' |
| 394 |
} |
| 395 |
|
| 396 |
def executeTests() { |
| 397 |
switch(env.PROFILE) { |
| 398 |
case 'DSE-SMOKE-TEST': |
| 399 |
executeDseSmokeTests() |
| 400 |
break |
| 401 |
case 'EVENT_LOOP': |
| 402 |
executeEventLoopTests() |
| 403 |
break |
| 404 |
default: |
| 405 |
executeStandardTests() |
| 406 |
break |
| 407 |
} |
| 408 |
} |
| 409 |
|
| 410 |
|
| 411 |
// TODO move this in the shared lib |
| 412 |
def getDriverMetricType() { |
| 413 |
metric_type = 'oss' |
| 414 |
if (env.GIT_URL.contains('riptano/python-driver')) { |
| 415 |
metric_type = 'oss-private' |
| 416 |
} else if (env.GIT_URL.contains('python-dse-driver')) { |
| 417 |
metric_type = 'dse' |
| 418 |
} |
| 419 |
return metric_type |
| 420 |
} |
| 421 |
|
| 422 |
def describeBuild(buildContext) { |
| 423 |
script { |
| 424 |
def runtimes = buildContext.matrix["RUNTIME"] |
| 425 |
def serverVersions = buildContext.matrix["SERVER"] |
| 426 |
def numBuilds = runtimes.size() * serverVersions.size() * buildContext.matrix["CYTHON"].size() |
| 427 |
currentBuild.displayName = "${env.PROFILE} (${env.EVENT_LOOP} | ${numBuilds} builds)" |
| 428 |
currentBuild.description = "${env.PROFILE} build testing servers (${serverVersions.join(', ')}) against Python (${runtimes.join(', ')}) using ${env.EVENT_LOOP} event loop manager" |
| 429 |
} |
| 430 |
} |
| 431 |
|
| 432 |
// branch pattern for cron |
| 433 |
def branchPatternCron() { |
| 434 |
~"(master)" |
| 435 |
} |
| 436 |
|
| 437 |
pipeline { |
| 438 |
agent none |
| 439 |
|
| 440 |
// Global pipeline timeout |
| 441 |
options { |
| 442 |
disableConcurrentBuilds() |
| 443 |
timeout(time: 10, unit: 'HOURS') // TODO timeout should be per build |
| 444 |
buildDiscarder(logRotator(artifactNumToKeepStr: '10', // Keep only the last 10 artifacts |
| 445 |
numToKeepStr: '50')) // Keep only the last 50 build records |
| 446 |
} |
| 447 |
|
| 448 |
parameters { |
| 449 |
choice( |
| 450 |
name: 'ADHOC_BUILD_TYPE', |
| 451 |
choices: ['BUILD', 'BUILD-AND-EXECUTE-TESTS'], |
| 452 |
description: '''<p>Perform a adhoc build operation</p> |
| 453 |
<table style="width:100%"> |
| 454 |
<col width="25%"> |
| 455 |
<col width="75%"> |
| 456 |
<tr> |
| 457 |
<th align="left">Choice</th> |
| 458 |
<th align="left">Description</th> |
| 459 |
</tr> |
| 460 |
<tr> |
| 461 |
<td><strong>BUILD</strong></td> |
| 462 |
<td>Performs a <b>Per-Commit</b> build</td> |
| 463 |
</tr> |
| 464 |
<tr> |
| 465 |
<td><strong>BUILD-AND-EXECUTE-TESTS</strong></td> |
| 466 |
<td>Performs a build and executes the integration and unit tests</td> |
| 467 |
</tr> |
| 468 |
</table>''') |
| 469 |
choice( |
| 470 |
name: 'PROFILE', |
| 471 |
choices: ['STANDARD', 'FULL', 'DSE-SMOKE-TEST', 'EVENT_LOOP'], |
| 472 |
description: '''<p>Profile to utilize for scheduled or adhoc builds</p> |
| 473 |
<table style="width:100%"> |
| 474 |
<col width="25%"> |
| 475 |
<col width="75%"> |
| 476 |
<tr> |
| 477 |
<th align="left">Choice</th> |
| 478 |
<th align="left">Description</th> |
| 479 |
</tr> |
| 480 |
<tr> |
| 481 |
<td><strong>STANDARD</strong></td> |
| 482 |
<td>Execute the standard tests for the driver</td> |
| 483 |
</tr> |
| 484 |
<tr> |
| 485 |
<td><strong>FULL</strong></td> |
| 486 |
<td>Execute all tests for the driver, including long tests.</td> |
| 487 |
</tr> |
| 488 |
<tr> |
| 489 |
<td><strong>DSE-SMOKE-TEST</strong></td> |
| 490 |
<td>Execute only the DataStax Enterprise smoke tests</td> |
| 491 |
</tr> |
| 492 |
<tr> |
| 493 |
<td><strong>EVENT_LOOP</strong></td> |
| 494 |
<td>Execute only the event loop tests for the specified event loop manager (see: <b>EVENT_LOOP</b>)</td> |
| 495 |
</tr> |
| 496 |
</table>''') |
| 497 |
choice( |
| 498 |
name: 'MATRIX', |
| 499 |
choices: ['DEFAULT', 'SMOKE', 'FULL', 'CASSANDRA', 'DSE'], |
| 500 |
description: '''<p>The matrix for the build.</p> |
| 501 |
<table style="width:100%"> |
| 502 |
<col width="25%"> |
| 503 |
<col width="75%"> |
| 504 |
<tr> |
| 505 |
<th align="left">Choice</th> |
| 506 |
<th align="left">Description</th> |
| 507 |
</tr> |
| 508 |
<tr> |
| 509 |
<td><strong>DEFAULT</strong></td> |
| 510 |
<td>Default to the build context.</td> |
| 511 |
</tr> |
| 512 |
<tr> |
| 513 |
<td><strong>SMOKE</strong></td> |
| 514 |
<td>Basic smoke tests for current Python runtimes + C*/DSE versions, no Cython</td> |
| 515 |
</tr> |
| 516 |
<tr> |
| 517 |
<td><strong>FULL</strong></td> |
| 518 |
<td>All server versions, python runtimes tested with and without Cython.</td> |
| 519 |
</tr> |
| 520 |
<tr> |
| 521 |
<td><strong>CASSANDRA</strong></td> |
| 522 |
<td>All cassandra server versions.</td> |
| 523 |
</tr> |
| 524 |
<tr> |
| 525 |
<td><strong>DSE</strong></td> |
| 526 |
<td>All dse server versions.</td> |
| 527 |
</tr> |
| 528 |
</table>''') |
| 529 |
choice( |
| 530 |
name: 'PYTHON_VERSION', |
| 531 |
choices: ['DEFAULT'] + DEFAULT_RUNTIME, |
| 532 |
description: 'Python runtime version. Default to the build context.') |
| 533 |
choice( |
| 534 |
name: 'SERVER_VERSION', |
| 535 |
choices: ['DEFAULT'] + DEFAULT_CASSANDRA + DEFAULT_DSE, |
| 536 |
description: '''Apache CassandraⓇ and DataStax Enterprise server version to use for adhoc <b>BUILD-AND-EXECUTE-TESTS</b> <strong>ONLY!</strong> |
| 537 |
<table style="width:100%"> |
| 538 |
<col width="15%"> |
| 539 |
<col width="85%"> |
| 540 |
<tr> |
| 541 |
<th align="left">Choice</th> |
| 542 |
<th align="left">Description</th> |
| 543 |
</tr> |
| 544 |
<tr> |
| 545 |
<td><strong>DEFAULT</strong></td> |
| 546 |
<td>Default to the build context.</td> |
| 547 |
</tr> |
| 548 |
<tr> |
| 549 |
<td><strong>3.0</strong></td> |
| 550 |
<td>Apache CassandraⓇ v3.0.x</td> |
| 551 |
</tr> |
| 552 |
<tr> |
| 553 |
<td><strong>3.11</strong></td> |
| 554 |
<td>Apache CassandraⓇ v3.11.x</td> |
| 555 |
</tr> |
| 556 |
<tr> |
| 557 |
<td><strong>4.0</strong></td> |
| 558 |
<td>Apache CassandraⓇ v4.0.x</td> |
| 559 |
</tr> |
| 560 |
<tr> |
| 561 |
<td><strong>5.0-beta1</strong></td> |
| 562 |
<td>Apache CassandraⓇ v5.0-beta1</td> |
| 563 |
</tr> |
| 564 |
<tr> |
| 565 |
<td><strong>dse-5.1.35</strong></td> |
| 566 |
<td>DataStax Enterprise v5.1.x</td> |
| 567 |
</tr> |
| 568 |
<tr> |
| 569 |
<td><strong>dse-6.8.30</strong></td> |
| 570 |
<td>DataStax Enterprise v6.8.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td> |
| 571 |
</tr> |
| 572 |
</table>''') |
| 573 |
choice( |
| 574 |
name: 'CYTHON', |
| 575 |
choices: ['DEFAULT'] + DEFAULT_CYTHON, |
| 576 |
description: '''<p>Flag to determine if Cython should be enabled</p> |
| 577 |
<table style="width:100%"> |
| 578 |
<col width="25%"> |
| 579 |
<col width="75%"> |
| 580 |
<tr> |
| 581 |
<th align="left">Choice</th> |
| 582 |
<th align="left">Description</th> |
| 583 |
</tr> |
| 584 |
<tr> |
| 585 |
<td><strong>Default</strong></td> |
| 586 |
<td>Default to the build context.</td> |
| 587 |
</tr> |
| 588 |
<tr> |
| 589 |
<td><strong>True</strong></td> |
| 590 |
<td>Enable Cython</td> |
| 591 |
</tr> |
| 592 |
<tr> |
| 593 |
<td><strong>False</strong></td> |
| 594 |
<td>Disable Cython</td> |
| 595 |
</tr> |
| 596 |
</table>''') |
| 597 |
choice( |
| 598 |
name: 'EVENT_LOOP', |
| 599 |
choices: ['LIBEV', 'GEVENT', 'EVENTLET', 'ASYNCIO', 'ASYNCORE', 'TWISTED'], |
| 600 |
description: '''<p>Event loop manager to utilize for scheduled or adhoc builds</p> |
| 601 |
<table style="width:100%"> |
| 602 |
<col width="25%"> |
| 603 |
<col width="75%"> |
| 604 |
<tr> |
| 605 |
<th align="left">Choice</th> |
| 606 |
<th align="left">Description</th> |
| 607 |
</tr> |
| 608 |
<tr> |
| 609 |
<td><strong>LIBEV</strong></td> |
| 610 |
<td>A full-featured and high-performance event loop that is loosely modeled after libevent, but without its limitations and bugs</td> |
| 611 |
</tr> |
| 612 |
<tr> |
| 613 |
<td><strong>GEVENT</strong></td> |
| 614 |
<td>A co-routine -based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libev or libuv event loop</td> |
| 615 |
</tr> |
| 616 |
<tr> |
| 617 |
<td><strong>EVENTLET</strong></td> |
| 618 |
<td>A concurrent networking library for Python that allows you to change how you run your code, not how you write it</td> |
| 619 |
</tr> |
| 620 |
<tr> |
| 621 |
<td><strong>ASYNCIO</strong></td> |
| 622 |
<td>A library to write concurrent code using the async/await syntax</td> |
| 623 |
</tr> |
| 624 |
<tr> |
| 625 |
<td><strong>ASYNCORE</strong></td> |
| 626 |
<td>A module provides the basic infrastructure for writing asynchronous socket service clients and servers</td> |
| 627 |
</tr> |
| 628 |
<tr> |
| 629 |
<td><strong>TWISTED</strong></td> |
| 630 |
<td>An event-driven networking engine written in Python and licensed under the open source MIT license</td> |
| 631 |
</tr> |
| 632 |
</table>''') |
| 633 |
choice( |
| 634 |
name: 'CI_SCHEDULE', |
| 635 |
choices: ['DO-NOT-CHANGE-THIS-SELECTION', 'WEEKNIGHTS', 'WEEKENDS'], |
| 636 |
description: 'CI testing schedule to execute periodically scheduled builds and tests of the driver (<strong>DO NOT CHANGE THIS SELECTION</strong>)') |
| 637 |
string( |
| 638 |
name: 'CI_SCHEDULE_PYTHON_VERSION', |
| 639 |
defaultValue: 'DO-NOT-CHANGE-THIS-SELECTION', |
| 640 |
description: 'CI testing python version to utilize for scheduled test runs of the driver (<strong>DO NOT CHANGE THIS SELECTION</strong>)') |
| 641 |
string( |
| 642 |
name: 'CI_SCHEDULE_SERVER_VERSION', |
| 643 |
defaultValue: 'DO-NOT-CHANGE-THIS-SELECTION', |
| 644 |
description: 'CI testing server version to utilize for scheduled test runs of the driver (<strong>DO NOT CHANGE THIS SELECTION</strong>)') |
| 645 |
} |
| 646 |
|
| 647 |
triggers { |
| 648 |
parameterizedCron(branchPatternCron().matcher(env.BRANCH_NAME).matches() ? """ |
| 649 |
# Every weeknight (Monday - Friday) around 4:00 AM |
| 650 |
# These schedules will run with and without Cython enabled for Python 3.8.16 and 3.12.0 |
| 651 |
H 4 * * 1-5 %CI_SCHEDULE=WEEKNIGHTS;EVENT_LOOP=LIBEV;CI_SCHEDULE_PYTHON_VERSION=3.8.16 3.12.0;CI_SCHEDULE_SERVER_VERSION=3.11 4.0 5.0-beta1 dse-5.1.35 dse-6.8.30 |
| 652 |
""" : "") |
| 653 |
} |
| 654 |
|
| 655 |
environment { |
| 656 |
OS_VERSION = 'ubuntu/bionic64/python-driver' |
| 657 |
CCM_ENVIRONMENT_SHELL = '/usr/local/bin/ccm_environment.sh' |
| 658 |
CCM_MAX_HEAP_SIZE = '1536M' |
| 659 |
JABBA_SHELL = '/usr/lib/jabba/jabba.sh' |
| 660 |
} |
| 661 |
|
| 662 |
stages { |
| 663 |
stage ('Build and Test') { |
| 664 |
when { |
| 665 |
beforeAgent true |
| 666 |
allOf { |
| 667 |
not { buildingTag() } |
| 668 |
} |
| 669 |
} |
| 670 |
|
| 671 |
steps { |
| 672 |
script { |
| 673 |
context = getBuildContext() |
| 674 |
withEnv(context.vars) { |
| 675 |
describeBuild(context) |
| 676 |
|
| 677 |
// build and test all builds |
| 678 |
parallel getMatrixBuilds(context) |
| 679 |
|
| 680 |
slack.notifyChannel(currentBuild.currentResult) |
| 681 |
} |
| 682 |
} |
| 683 |
} |
| 684 |
} |
| 685 |
|
| 686 |
} |
| 687 |
} |