Last active
October 1, 2019 16:01
-
-
Save MemoAlfa/f6b9c7dc7550fb34f50fc7c1833e24c8 to your computer and use it in GitHub Desktop.
Integration Test Demo customized plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'docker-compose' | |
apply plugin: 'com.adarshr.test-logger' | |
// ====== integration tests config | |
task integrationTest(type: Test) { | |
// injecting thoes as fake secrets whic is just one way to stop aws from failing on application startup | |
environment "AWS_ACCESS_KEY_ID", "fake" | |
environment "AWS_SECRET_ACCESS_KEY", "fake" | |
useJUnitPlatform { | |
// tagging our tests is a new way of distinguishing between tests in Junit5 Jupiters engine. | |
// the test must be annotated with @org.junit.jupiter.api.Tag("integration-test") | |
includeTags 'integration-test' | |
} | |
// beautiful way of showing logs of teseting with the execution time color-coded. | |
testLogging { | |
testlogger { | |
theme 'standard' | |
slowThreshold 1000 | |
} | |
} | |
check.dependsOn it | |
shouldRunAfter test | |
} | |
integrationTest.doFirst { | |
dockerCompose.exposeAsSystemProperties(integrationTest) | |
} | |
dockerCompose.isRequiredBy(integrationTest) | |
dockerCompose { | |
useComposeFiles = ['docker-compose.yaml'] | |
waitForTcpPorts = true | |
captureContainersOutput = false | |
removeVolumes = true | |
projectName = UUID.randomUUID() | |
dockerComposeWorkingDirectory = "${projectDir}/src/test/resources/" | |
dockerComposeStopTimeout = java.time.Duration.ofSeconds(5) | |
environment.put 'HOSTNAME_EXTERNAL', 'localhost' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment