Skip to content

Commit b17aab2

Browse files
Implement microbench test target type
1 parent fc0ee48 commit b17aab2

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

.build/run-tests.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ set -o pipefail
3030
[ "x${CASSANDRA_DIR}" != "x" ] || CASSANDRA_DIR="$(readlink -f $(dirname "$0")/..)"
3131
[ "x${DIST_DIR}" != "x" ] || DIST_DIR="${CASSANDRA_DIR}/build"
3232

33+
# target types
34+
TARGET_TYPES="build_dtest_jars stress-test fqltool-test microbench test-burn long-test cqlsh-test simulator-dtest test test-cdc test-compression test-oa test-system-keyspace-directory test-latest jvm-dtest jvm-dtest-upgrade jvm-dtest-novnode jvm-dtest-upgrade-novnode"
35+
3336
# pre-conditions
3437
command -v ant >/dev/null 2>&1 || { error 1 "ant needs to be installed"; }
3538
command -v git >/dev/null 2>&1 || { error 1 "git needs to be installed"; }
@@ -47,7 +50,7 @@ error() {
4750

4851
print_help() {
4952
echo "Usage: $0 [-a|-t|-c|-e|-i|-b|-s|-h]"
50-
echo " -a Test target type: test, test-compression, test-cdc, ..."
53+
echo " -a Test target type: ${TARGET_TYPES}"
5154
echo " -t Test name regexp to run."
5255
echo " -c Chunk to run in the form X/Y: Run chunk X from a total of Y chunks."
5356
echo " -b Specify the base git branch for comparison when determining changed tests to"
@@ -65,8 +68,7 @@ print_help() {
6568

6669

6770
# legacy argument handling
68-
case ${1} in
69-
"build_dtest_jars" | "stress-test" | "fqltool-test" | "microbench" | "test-burn" | "long-test" | "cqlsh-test" | "simulator-dtest" | "test" | "test-cdc" | "test-compression" | "test-oa" | "test-system-keyspace-directory" | "test-latest" | "jvm-dtest" | "jvm-dtest-upgrade" | "jvm-dtest-novnode" | "jvm-dtest-upgrade-novnode")
71+
if [[ " ${TARGET_TYPES} " =~ " ${1} " ]]; then
7072
test_type="-a ${1}"
7173
if [[ -z ${2} ]]; then
7274
test_list=""
@@ -78,7 +80,7 @@ case ${1} in
7880
echo "Using deprecated legacy arguments. Please update to new parameter format: ${test_type} ${test_list}"
7981
$0 ${test_type} ${test_list}
8082
exit $?
81-
esac
83+
fi
8284

8385

8486
env_vars=""
@@ -88,6 +90,7 @@ detect_changed_tests=true
8890
while getopts "a:t:c:e:ib:shj:" opt; do
8991
case $opt in
9092
a ) test_target="$OPTARG"
93+
[[ " ${TARGET_TYPES} " =~ " ${test_target/-repeat/} " ]] || error 1 "Invalid test target type '${test_target}'. Valid types: ${TARGET_TYPES}"
9194
;;
9295
t ) test_name_regexp="$OPTARG"
9396
;;

.jenkins/Jenkinsfile

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,24 @@
2929
//
3030
// This Jenkinsfile is expected to work on any Jenkins infrastructure.
3131
// The controller should have 4 cpu, 12GB ram (and be configured to use `-XX:+UseG1GC -Xmx8G`)
32-
// It is required to have agents providing five labels, each that can provide docker and the following capabilities:
33-
// - cassandra-amd64-small : 1 cpu, 1GB ram
34-
// - cassandra-small : 1 cpu, 1GB ram (alias for above but for any arch)
35-
// - cassandra-amd64-medium : 3 cpu, 5GB ram
36-
// - cassandra-medium : 3 cpu, 5GB ram (alias for above but for any arch)
37-
// - cassandra-amd64-large : 7 cpu, 16GB ram
38-
// - cassandra-large : 7 cpu, 16GB ram
32+
//
33+
// It is required to have agents providing 6+ labels, each that can provide docker and the following capabilities:
34+
//
35+
// - cassandra-small + cassandra-${arch}-small : 1 cpu, 1GB ram (alias for above but for any arch)
36+
// - cassandra-medium + cassandra-${arch}-medium : 3 cpu, 5GB ram
37+
// - cassandra-large + cassandra-${arch}-large : 7 cpu, 16GB ram
38+
//
39+
// Performance targets required a `cassandra-${arch}-large-dedicated` labelled nodes.
40+
//
41+
// Nodes running on spot instances have to have labels with `-spot` suffixes.
42+
// For example: cassandra-amd64-large-spot
3943
//
4044
// When running builds parameterised to other architectures the corresponding labels are expected.
4145
// For example 'arm64' requires the labels: cassandra-arm64-small, cassandra-arm64-medium, cassandra-arm64-large.
4246
//
43-
// The built-in node must has the "controller" label. There must be more than two agents for each label.
44-
//
4547
// Plugins required are:
46-
// git, workflow-job, workflow-cps, junit, workflow-aggregator, ws-cleanup, pipeline-build-step, test-stability, copyartifact.
48+
// git, workflow-job, workflow-cps, junit, workflow-aggregator, ws-cleanup, pipeline-build-step, test-stability, copyartifact, jmh-report.
49+
// See .jenkins/k8s/jenkins-deployment.yaml for up to date list of plugins.
4750
//
4851
// Any functionality that depends upon ASF Infra ( i.e. the canonical ci-cassandra.a.o )
4952
// will be ignored when run on other environments.
@@ -143,6 +146,7 @@ def pipelineProfiles() {
143146
'pre-commit': ['artifacts', 'lint', 'debian', 'redhat', 'fqltool-test', 'cqlsh-test', 'test', 'test-latest', 'stress-test', 'test-burn', 'jvm-dtest', 'simulator-dtest', 'dtest', 'dtest-latest'],
144147
'pre-commit w/ upgrades': ['artifacts', 'lint', 'debian', 'redhat', 'fqltool-test', 'cqlsh-test', 'test', 'test-latest', 'stress-test', 'test-burn', 'jvm-dtest', 'jvm-dtest-upgrade', 'simulator-dtest', 'dtest', 'dtest-novnode', 'dtest-latest', 'dtest-upgrade'],
145148
'post-commit': ['artifacts', 'lint', 'debian', 'redhat', 'fqltool-test', 'cqlsh-test', 'test-cdc', 'test', 'test-latest', 'test-compression', 'stress-test', 'test-burn', 'long-test', 'test-oa', 'test-system-keyspace-directory', 'jvm-dtest', 'jvm-dtest-upgrade', 'simulator-dtest', 'dtest', 'dtest-novnode', 'dtest-latest', 'dtest-large', 'dtest-large-novnode', 'dtest-large-latest', 'dtest-upgrade', 'dtest-upgrade-novnode', 'dtest-upgrade-large', 'dtest-upgrade-novnode-large'],
149+
'performance': ['microbench'],
146150
'custom': []
147151
]
148152
}
@@ -204,12 +208,19 @@ def tasks() {
204208
'dtest-upgrade-novnode': [splits: 128, size: 'large'],
205209
'dtest-upgrade-large': [splits: 32, size: 'large'],
206210
'dtest-upgrade-novnode-large': [splits: 32, size: 'large'],
211+
'test-system-keyspace-directory': [splits: 16],
212+
// performance tests need 'cassandra-*large-dedicated' nodes
213+
'microbench': [splits: 1, size: 'large', timeout: 6, benchmark: true],
207214
]
208215
testSteps.each() {
209216
it.value.put('type', 'test')
210217
if (!it.value['size']) {
211218
it.value.put('size', 'medium')
212219
}
220+
if (!it.value['timeout']) {
221+
// default 1 hour
222+
it.value.put('timeout', 1)
223+
}
213224
if (it.key.startsWith('dtest')) {
214225
it.value.put('python-dtest', true)
215226
}
@@ -391,7 +402,7 @@ def test(command, cell) {
391402
script_vars = "${script_vars} cython=\'${cell.cython}\'"
392403
}
393404
script_vars = fetchDTestsSource(command, script_vars)
394-
timeout(time: 1, unit: 'HOURS') { // best throughput with each cell at ~10 minutes
405+
timeout(time: command.timeout, unit: 'HOURS') { // best throughput with each cell at ~10 minutes
395406
def timer = System.currentTimeMillis()
396407
try {
397408
buildJVMDTestJars(cell, script_vars, logfile)
@@ -425,7 +436,7 @@ def test(command, cell) {
425436
find test/output -type f -name "*.xml" -print0 | xargs -0 -r -n1 -P"\$(nproc)" xz -f
426437
echo "test result files compressed"; find test/output -type f -name "*.xml.xz" | wc -l
427438
"""
428-
archiveArtifacts artifacts: "test/logs/**,test/**/TEST-*.xml.xz,test/**/cqlshlib*.xml.xz,test/**/nosetests*.xml.xz", fingerprint: true
439+
archiveArtifacts artifacts: "test/logs/**,test/**/TEST-*.xml.xz,test/**/cqlshlib*.xml.xz,test/**/nosetests*.xml.xz,test/jmh-result.json", fingerprint: true
429440
copyToNightlies("${logfile}, test/logs/**", "${cell.step}/${cell.arch}/jdk${cell.jdk}/python${cell.python}/cython_${cell.cython}/" + "split_${cell.split}_${splits}".replace("/", "_"))
430441
}
431442
cleanAgent(cell.step)
@@ -483,8 +494,12 @@ def fetchDockerImages(dockerfiles) {
483494
}
484495

485496
def getNodeLabel(command, cell) {
486-
echo "using node label: cassandra-${cell.arch}-${command.size}"
487-
return "cassandra-${cell.arch}-${command.size}"
497+
def label = "cassandra-${cell.arch}-${command.size}"
498+
if (command.containsKey('benchmark') && command.benchmark) {
499+
label = "${label}-dedicated"
500+
}
501+
echo "using node label: ${label}"
502+
return label
488503
}
489504

490505
def copyToNightlies(sourceFiles, remoteDirectory='') {
@@ -557,7 +572,7 @@ def generateTestReports() {
557572
unzip -x -d build/test -q output.zip ) ${teeSuffix}
558573
"""
559574
} else {
560-
copyArtifacts filter: 'test/**/TEST-*.xml.xz,test/**/cqlshlib*.xml.xz,test/**/nosetests*.xml.xz', fingerprintArtifacts: true, projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER), target: "build/", optional: true
575+
copyArtifacts filter: 'test/**/TEST-*.xml.xz,test/**/cqlshlib*.xml.xz,test/**/nosetests*.xml.xz,test/jmh-result.json', fingerprintArtifacts: true, projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER), target: "build/", optional: true
561576
}
562577
if (fileExists('build/test/output')) {
563578
// merge splits for each target's test report, other axes are kept separate
@@ -585,7 +600,10 @@ def generateTestReports() {
585600

586601
dir('build/') {
587602
archiveArtifacts artifacts: "ci_summary.html,results_details.tar.xz,${logfile}", fingerprint: true
588-
copyToNightlies('ci_summary.html,results_details.tar.xz,${logfile}')
603+
copyToNightlies('ci_summary.html,results_details.tar.xz,${logfile},test/jmh-result.json')
604+
if (fileExists('test/jmh-result.json')) {
605+
jmhReport('test/jmh-result.json')
606+
}
589607
}
590608
}
591609
}

.jenkins/k8s/jenkins-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ controller:
5858
- pipeline-rest-api
5959
- test-stability
6060
- copyartifact
61+
- jmh-plugin
6162
node-selector:
6263
cassandra.jenkins.controller: true
6364
scriptApproval:

0 commit comments

Comments
 (0)