This repository has been archived by the owner on Apr 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CO-103: integration and performance tests runner plugin (#23)
* CO-103: integration and performance tests runner plugin - [x] gatling sbt plugin based performance test task added - [x] integration tests are surrounded with docker tasks * docker version checking plugin is added * add some todos * add dump logs plugin * health check task is added * small fixes * scalafmt * header and scalastyle fixes * docker lifecycle is now running nearly expected * scripted tests added for docker-version plugin * fix build name for docker-version tests * tests for health plugin * health check pooling is added * cleanStop is now running if after failing tests also √ * pooling logic fixed * revert checkContainersHealth to Task[Unit] * clean the code base and add in-code docs * small fix npe * update readme * scripted test added for test runner plugin but there is an error in healthcheck task * small fix in test * fix recursion problem on healthcheck pool * improve test runner * simple performance added to test * make jenkins happy for now * improve test scripts * Added in updateToLatest * Proposed changes for docker health plugin * go over the docker health plugin and tests * remove newline * dockerhealth scripted test passing now on local with some FIXMEs * solve testrunner dependency problem * ensure testrunner is green * fix scalastyle error * tests are green on local again * remove dependency on lower level tests for both perf and int tasks
- Loading branch information
Showing
35 changed files
with
1,119 additions
and
26 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ | |
package net.cakesolutions | ||
|
||
import com.typesafe.sbt.SbtNativePackager._ | ||
import com.typesafe.sbt.packager.Keys._ | ||
import net.cakesolutions.CakeBuildInfoKeys.externalBuildTools | ||
import sbt._ | ||
import sbt.Keys._ | ||
|
||
import net.cakesolutions.CakeBuildInfoKeys.externalBuildTools | ||
|
||
/** | ||
* Cake recommended tasks for configuring and using docker-compose within SBT | ||
* build files (e.g. for use within integration tests, etc.) | ||
|
@@ -25,7 +25,7 @@ object CakeDockerComposePlugin extends AutoPlugin { | |
* When this plugin is enabled, {{autoImport}} defines a wildcard import for | ||
* set, eval, and .sbt files. | ||
*/ | ||
val autoImport = CakeDockerComposePluginKeys | ||
val autoImport = CakeDockerComposeKeys | ||
import autoImport._ | ||
|
||
private val dockerComposeConfigCheckTask: Def.Initialize[Task[Unit]] = | ||
|
@@ -141,7 +141,7 @@ object CakeDockerComposePlugin extends AutoPlugin { | |
/** | ||
* SBT docker-compose build settings and tasks | ||
*/ | ||
object CakeDockerComposePluginKeys { | ||
object CakeDockerComposeKeys { | ||
This comment has been minimized.
Sorry, something went wrong.
fommil
Contributor
|
||
|
||
/** | ||
* Setting key defining the project files to be used by docker-compose | ||
|
80 changes: 80 additions & 0 deletions
80
src/main/scala/net/cakesolutions/CakeDockerHealthPlugin.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright: 2017 https://github.com/cakesolutions/sbt-cake/graphs | ||
// License: http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package net.cakesolutions | ||
|
||
import sbt._ | ||
import sbt.Keys._ | ||
|
||
import net.cakesolutions.CakeDockerVersionKeys.{minimumDockerComposeVersion, minimumDockerVersion} | ||
import net.cakesolutions.internal.Version | ||
|
||
/** | ||
* Plugin for checking `docker` and `docker-compose` versions on the system | ||
* against minimum required versions which have default values in the plugin, | ||
* and also configurable with provided setting keys. | ||
*/ | ||
object CakeDockerHealthPlugin extends AutoPlugin { | ||
|
||
import net.cakesolutions.internal.CakeDockerUtils._ | ||
|
||
/** | ||
* When this plugin is enabled, {{autoImport}} defines a wildcard import for | ||
* set, eval, and .sbt files. | ||
*/ | ||
val autoImport = CakeDockerHealthKeys | ||
import autoImport._ | ||
|
||
/** @see http://www.scala-sbt.org/0.13/api/index.html#sbt.package */ | ||
override def requires: Plugins = | ||
CakeDockerComposePlugin && CakeDockerVersionPlugin | ||
|
||
/** @see http://www.scala-sbt.org/0.13/api/index.html#sbt.package */ | ||
override def trigger: PluginTrigger = allRequirements | ||
|
||
/** @see http://www.scala-sbt.org/0.13/api/index.html#sbt.package */ | ||
override val projectSettings = Seq( | ||
// Docker 1.12.0 (2016-07-28) introduced HEALTHCHECK | ||
// see https://docs.docker.com/release-notes/docker-engine/#1120-2016-07-28 | ||
minimumDockerVersion := | ||
Version.selectLatest(minimumDockerVersion.value, (1, 12)), | ||
// Docker-compose 1.10.0 (2017-01-18) introduced healthcheck | ||
// see https://docs.docker.com/release-notes/docker-compose/#1100-2017-01-18 | ||
minimumDockerComposeVersion := | ||
Version.selectLatest(minimumDockerComposeVersion.value, (1, 10)), | ||
dumpContainersLogs := dumpLogs( | ||
CakeDockerComposeKeys.dockerComposeFiles.value, | ||
file("target") | ||
)(streams.value.log), | ||
checkContainersHealth := { | ||
require( | ||
checkHealth(CakeDockerComposeKeys.dockerComposeFiles.value)( | ||
streams.value.log | ||
), | ||
"All containers should be healthy" | ||
) | ||
} | ||
) | ||
|
||
} | ||
|
||
/** | ||
* Keys that will be auto-imported when this plugin is enabled. | ||
*/ | ||
object CakeDockerHealthKeys { | ||
|
||
/** | ||
* Task that dumps the logs of each container in the | ||
* docker-compose scope. | ||
*/ | ||
val dumpContainersLogs: TaskKey[Unit] = | ||
taskKey[Unit]("Dumps target containers' logs") | ||
|
||
/** | ||
* Task that checks the health status of each container in the | ||
* docker-compose scope and they should be in healthy state. | ||
*/ | ||
val checkContainersHealth: TaskKey[Unit] = | ||
taskKey[Unit]("Checks target containers' health") | ||
|
||
} |
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
Oops, something went wrong.
thanks for reading the comment