Smoke Tests¶
As part of the jenkins CI pipeline the capability to do smoke tests where added. This includes dedicated inbound and endpoint filters, unit tests and a configured jenkins stage to run these tests. The smoke tests run against a docker container of the appsuite-proxy which is started during the CI pipeline.
Configuration¶
The smoke test entrypoint is described in the build.gradle
file. Here you will find a separate task to support the tests. This task will run during the jenkins stage.
task smokeTest( type: Test) {
reports {
html.enabled = true
junitXml.enabled = true
}
testLogging {
showStandardStreams = true
}
exclude 'io/ox/proxy/**'
include 'io/ox/smoke/test/**'
}
Use the keywords include and exclude to handle future tests and to run them separately from each other.
Run locally¶
As a precondition you need to build the images with ./gradlew buildImage
. To create a small local test setup you can use ./gradlew createDockerTestSetup
. Additionally use ./gradlew copyReloadTestConfiguration copySmokeTestFilter
to make smoke test filters and the reload config available in the proxy container.
This setup contains the proxy docker container, two python backend containers and a corresponding docker network. The associated config can be found under the jenkins-pipeline
folder and fits for the smoke tests in the BackendRoutingTest class.
To remove the test setup you can use ./gradlew removeDockerTestSetup
. This should remove all docker components of the test setup. If that is not the case remove them manually.
Testing TLS encryption¶
Currently the existing smoke tests are using an image that is configured to handle TLS based requests. Therefore the docker image creates all properties and certificates automatically on container startup.
Jenkins Pipeline¶
The Jenkins pipeline has a dedicated smoke test stage, where it launches the previously built image on the underlying docker daemon on Jenkins.
Automatic config generation¶
As mentioned above the configuration of the smoke tests can be generated on container startup. We use the confd framework to do so. Under config/confd you will find templates
for the config files. If you want to enhance them or generate other config files use this directory for more templates. Building the config files is triggered by the docker-entrypoint.sh
script.
If you want to add new tests depending on new variables to the jenkins pipeline you have to add these variables to the gradle task createProxyContainer
.
Debug logging¶
If you want to change your global log level in a docker container setup there is the possibility to set it on container startup.
Use the environment variable GLOBAL_LOG_LEVEL = DEBUG
to enable debug logging.