com.nortal.test.testcontainers.configuration.ContainerProperties.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of test-automation-containers Show documentation
Show all versions of test-automation-containers Show documentation
Cucumber based API and UI test framework
The newest version!
/**
* Copyright (c) 2022 Nortal AS
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.nortal.test.testcontainers.configuration
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.NestedConfigurationProperty
@ConfigurationProperties(prefix = "test-automation.containers")
data class ContainerProperties(
/**
* Enables use of default Docker bridge network.
*/
val useDefaultBridgeNetwork: Boolean = false,
/**
* Container under testing configuration.
*/
val testableContainer: TestableContainerProperties,
/**
* Context containers that are required for testable container to properly work.
*/
val contextContainers: Map = hashMapOf()
)
@ConfigurationProperties(prefix = "test-automation.containers.testable-container")
class TestableContainerProperties(
/**
* Testable container can be disabled if a different setup is used. For example docker compose.
*/
var enabled: Boolean = true,
/**
* container alias that will be registered under its network. This is also used for container name.
*/
var internalNetworkAlias: String = "container-under-test",
/**
* Application startup timeout.
*/
var startupTimeout: Long = 120,
/**
* Reuse testable container between runs. It will be redeployed if container jar war rebuilt. Eventually container has to be manually closed.
NOTE: must be disabled for shared docker instances like CI runners.
*/
val reuseBetweenRuns: Boolean = false,
/**
* A directory mounting mapping. The idea is to mount relevant container directories to host system. A good example would be log directory.
* example: "/var/log/:build/container-logs/" This will mount var/log directory to build/container-logs dir.
*/
val directoryMounts: List = listOf(),
/**
* Spring Boot testable container configuration.
*/
@NestedConfigurationProperty
val springBoot: SpringBootTestContainerProperties = SpringBootTestContainerProperties(),
)
@ConfigurationProperties(prefix = "test-automation.containers.testable-container.spring-boot")
class SpringBootTestContainerProperties(
/**
* Base image for docker container.
*/
val baseImage: String = "azul/zulu-openjdk:17",
/**
* directory where testable jar will be created. Picks first jar in dir.
*/
val jarBuildDir: String = "",
/**
* jar matcher regex pattern. Should be changes if build generates more than one jar.
*/
val jarRegexMatcher: String = "^.+?.*(?