-
Notifications
You must be signed in to change notification settings - Fork 28
2. Configuration
Test framework allows to customise the configuration for the running test scenario via a test.properties
file placed under src/test/resources
folder.
Also, a global properties file can be specified using the system property mvn clean verify -Dts.test.resources.file.location=path/to/custom-global.properties
.
All the properties can be configured globally by replacing <YOUR SERVICE NAME>
with the global
scope where the YOUR SERVICE NAME
matches with the field name of the service, for example:
@QuarkusScenario
public class PingPongResourceIT {
@QuarkusApplication
static final RestService app = new RestService();
// ...
}
The <YOUR SERVICE NAME>
value is app
.
The current configuration options are:
ts.global.quarkus.expected.log=Installed features
In order to set the logging level (INFO by default), use:
# Possible values are: INFO, FINE, WARNING, SEVERE
ts.global.log.level=INFO
The same with the formatter log message and the target file:
ts.global.log.format=%d{HH:mm:ss,SSS} %-5p %s%e%n
ts.global.log.file.output=target/logs
Moreover, we can turn on/off (on by default) the logging by services using :
ts.<YOUR SERVICE NAME>.log.enable=true
We can disable the logging for all your services by using -Dts.global.log.enable=false
.
By default logs are using ANSI colors, use -Dts.global.log.nocolor=true
to disable them.
Services create their own folder under the target
directory, which contains temporary files.
If you want services to delete the folder on exit, set ts.global.delete.folder.on.exit
configuration property to true
.
Alternatively, use ts.<YOUR SERVICE NAME>.delete.folder.on.exit
for a specific service.
Timeouts are quite important property to, as an example, control how long to wait for a service to start. The existing options to configure timeouts are:
# Startup timeout for services is 5 minutes
ts.<global or YOUR SERVICE NAME>.startup.timeout=5m
# Default startup check poll interval is every 2 seconds
ts.<global or YOUR SERVICE NAME>.startup.check-poll-interval=2s
# Install operator timeout is 10 minutes
ts.<global or YOUR SERVICE NAME>.operator.install.timeout=10m
# Install image stream timeout is 5 minutes
ts.<global or YOUR SERVICE NAME>.imagestream.install.timeout=5m
In order to increase the default timeout for all the services, we can use the global
scope. For example, to increase the default startup timeout: ts.global.startup.timeout=10m
. Also, we can configure how often the test framework will check for the startup condition using the property ts.global.startup.check-poll-interval=3s
. Using these two properties, we are making all the services to wait up to 10 minutes to start and checking the condition every 3 seconds.
If we want to update the timeout for a single service because we know that this service is quite slow, we should use the property using the service name scope ts.ping.startup.timeout=20m
to wait up to 20 min for only the ping application to start.
How can we manipulate the overall timeout in slower environments? Let's say that our environment is twice and a half slower than a good environment, then we can instruct the test framework with:
ts.global.factor.timeout=2.5
And all the timeouts will take into account this factor value. For example, if previously, the startup timeout was 10 minutes, now it will be 10 * 2.5 = 25 minutes.
In a Multi-Module Maven test suite, if we want to configure the timeouts, we can do this via system properties:
- Increase the startup timeout only:
mvn clean verify -Dts.global.startup.timeout=20m
- Increase all the timeouts at once using the factor:
mvn clean verify -Dts.global.factor.timeout=2.5
The framework will allocate ports to deploy the services. We can configure the port range and the strategy to find an available port using:
ts.global.port.range.min=1100
ts.global.port.range.max=49151
## incremental (default) or random
ts.global.port.resolution.strategy=incremental
The framework has the ability to run built jars with java preview mode. To enable this function use -Dts.enable-java-preview
. This adds enable-preview
argument to java command as follows java --enable-preview .. -jar <jar-path>
.
To compile the code or run the tests in Dev Mode there is need to add --enable-preview
inside the configuration of maven-compiler-plugin
and quarkus-maven-plugin
. For example the quarkus-maven-plugin
will have similar setting to this:
...
<configuration>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<jvmArgs>--enable-preview</jvmArgs>
</configuration>
...
The framework will use Maven commands for some scenarios like Dev Mode and Remote Dev Mode. We can configure the properties we want to propagate to these internal Maven commands using:
# Propagate Properties strategy to use in all Maven commands:
## - all: by default
## - none
## - only-quarkus: only properties starting with "quarkus."
ts.global.maven.propagate-properties-strategy=all
# When selecting the `all` strategy, the properties that start with any of the next list will be ignored:
ts.global.maven.propagate-properties-strategy.all.exclude=sun.,awt.,java.,surefire.,user.,os.,jdk.,file.,basedir,line.,path.