QALIPSIS Gradle plugin
The QALIPSIS Gradle plugin simplifies the creation of new QALIPSIS projects and the integration of QALIPSIS projects into CI pipelines. It is composed of two plugins:
-
the bootstrap plugin (
io.qalipsis.bootstrap), used to initialize a QALIPSIS project and run scenarios locally, -
the cloud plugin (
io.qalipsis.cloud), used to publish scenarios to and trigger campaigns in the QALIPSIS cloud environment.
Setup
The Gradle plugin is built into the bootstrap project. If you choose not use the bootstrap project skeleton, you can still setup your project to take advantage of the Gradle plugin.
You can check the latest version of the QALIPSIS Gradle plugin from the Gradle Plugin Portal.
With Bootstrap
- Kotlin
plugins {
id("io.qalipsis.bootstrap") version "..."
}
- Groovy
plugins {
id 'io.qalipsis.bootstrap' version '...'
}
With the Cloud plugin
The cloud plugin enables publishing scenarios to and triggering campaigns in the QALIPSIS cloud environment. It can be applied alongside the bootstrap plugin.
- Kotlin
plugins {
id("io.qalipsis.cloud") version "..."
}
- Groovy
plugins {
id 'io.qalipsis.cloud' version '...'
}
The cloud plugin requires the following properties to be set, typically in gradle.properties or as Gradle execution options:
qalipsis.cloud.registry.url=https://app.qalipsis.io/api/scenarios
qalipsis.cloud.registry.list=true
qalipsis.cloud.registry.token=<your-api-token>
qalipsis.cloud.api.url=https://app.qalipsis.io/api
Version Configuration
The Gradle plugin includes a default QALIPSIS version; you can specify a different version in the appropriate build file.
- Kotlin
-
In build.gradle.kts, to specify version 0.18.a:
qalipsis {
version("0.18.a")
}
- Groovy
-
In build.gradle, to specify version 0.18.a:
qalipsis {
version = '0.18.a'
}
- As a Gradle property
-
To specify version 0.18.a, add the version in the gradle.properties or Gradle execution options:
qalipsis.version=0.18.a
Creating a QALIPSIS head/factory-only project
By default, the bootstrap plugin creates a QALIPSIS project with all dependencies for running as head, factory or standalone. You can then select at runtime which deployment mode you want to use.
However, if you want to create a QALIPSIS project with only the dependencies for running as a head (respectively as a factory), you can call the statement
qalipsis { asHead() } (respectively qalipsis { asFactory() }) in your build.gradle.kts or build.gradle file.
By doing so, you will have a QALIPSIS project with only the dependencies for running as head (respectively factory) and do not have to select the deployment mode at runtime.
Adding QALIPSIS plugins
To integrate QALIPSIS plugins, configure them in build.gradle.kts or build.gradle:
- Kotlin
qalipsis {
plugins {
apacheKafka()
jackson("1.2.3") // You can override the version of the plugin.
}
}
- Groovy
qalipsis {
plugins {
apacheKafka()
jackson("1.2.3") // You can override the version of the plugin.
}
}
Gradle is available for the following QALIPSIS plugins:
-
apacheCassandra
-
apacheKafka
-
elasticsearch
-
graphite
-
http
-
influxDb
-
jackson
-
jms
-
jakartaMessaging
-
mail
-
mongoDb
-
netty
-
r2dbcJasync
-
rabbitMq
-
redisLettuce
-
slack
-
sql
-
timescaleDb
Executing QALIPSIS
Default Execution
The QALIPSIS RunAllScenarios task runs all scenarios in your project’s classpath.
- Kotlin
tasks {
named("qalipsisRunAllScenarios") {
configuration(
"report.export.junit.enabled" to "true",
"report.export.junit.folder" to project.layout.buildDirectory.dir("test-results/my-new-scenario").get().asFile.path
)
}
}
- Groovy
tasks.named('qalipsisRunAllScenarios') {
configuration 'report.export.junit.enabled': 'true',
'report.export.junit.folder': layout.buildDirectory.dir('test-results/my-new-scenario').get().asFile.path
}
Custom Execution
You can create custom tasks of type RunQalipsis to run specific scenarios with custom configurations.
- Kotlin
tasks {
create("executeRestApiSpikeTest", RunQalipsis::class.java) {
scenarios("spike-test-of-rest-api", "constant-monitoring")
configuration("report.export.junit.enabled" to "true",
"report.export.junit.folder" to project.layout.buildDirectory.dir("test-results/my-new-scenario").get().asFile.path
)
}
}
- Groovy
tasks.create('executeRestApiSpikeTest', RunQalipsis) {
scenarios 'spike-test-of-rest-api', 'constant-monitoring'
configuration 'report.export.junit.enabled': 'true',
'report.export.junit.folder': layout.buildDirectory.dir('test-results/my-new-scenario').get().asFile.path
}
Cloud Campaign Execution
When the cloud plugin is applied, you can create tasks of type CloudRunQalipsis to trigger campaigns in the QALIPSIS cloud environment.
A campaign can configure several scenarios, each with its own minions count, geographic distribution and execution profile.
tasks {
create("qalipsisRunCampaign", CloudRunQalipsis::class.java) {
campaign("Test campaign") {
speedFactor.set(2.0)
startOffsetMs.set(2000)
campaignTimeout.set("PT1H30M")
hardTimeout.set(false)
scenario("My scenario 1") {
minionsCount = 710
zones {
"US" to 45
"DE" to 55
}
profile {
stages(completionMode = CompletionMode.HARD) {
stage(
minionsCount = 10,
rampUpDurationMs = 10,
totalDurationMs = 100000,
resolutionMs = 10000
)
stage(
minionsCount = 200,
rampUpDurationMs = 100,
totalDurationMs = 10000,
resolutionMs = 1000
)
stage(
minionsCount = 500,
rampUpDurationMs = 2000,
totalDurationMs = 1000,
resolutionMs = 4000
)
}
}
}
}
}
}