vaslabs / sbt-regression-suite   1.0

GitHub

A plugin for enabling blue green deployments through regression testing

Scala versions: 2.12
sbt plugins: 1.0

Regression suite plugin

Features:

  • Pack your regression tests
  • Automates backwards and forwards compatibility tests for your releases

The general idea

Pre-requisites:

  • You have an integration test that uses your production code case classes and automatic derivation (e.g. for json http requests).

  • The integration test is pointing to a service that is using your latest code. If your integration tests are testing your code in the repository this is not going to work for now as there are no mechanics yet with code version control, so you have to ensure that you are not testing the same version of production code.

In other words, you need to be testing a service with state A with 2 different versions of your integration test.

A working example

  • Spin the new version of your service, e.g. with docker compose
  • Run the regression test (as described below) that points to the services in docker compose
  • The regression test will first run the tests as the last time they were successful
  • Then it will create a new docker image and run the tests again

Another example

This plugin packs your code in a docker container and does some simple version control over it. For instance, the latest tag has your currently running production code.

Everytime you are doing a release you can do

regression:test
  1. With the default settings, it will run the tests from the latest docker image. If they pass, your code is backwards compatible.
  2. Then it packs a new docker container with your new code and runs the tests again. If they pass, your code is forwards compatible.
  3. If both tests are successful, the latest tag is updated with a docker push.

Usage

  1. Add the plugin to your project
addSbtPlugin("org.vaslabs.tests" % "sbt-regression-suite" % "1.0")
  1. Enable the plugin in your integration test project.
  .enablePlugins(RegressionSuitePlugin)
  1. Configure the plugin

dockerImage in regression := "The base name of your docker image without the tag"

newVersion in regression := version.value //This is going to be the tag of the new version

testCommand in regression := Seq("sbt" ,"moduleIntegrationTests/test")

//This is useful if you spin the service with docker-compose (e.g. locally)
dockerNetwork in regression := Some("sandbox_network")

  1. First time use:
regression:pack

Find the docker image from the logs and do

docker tag <image:version> <image:latest>

Run your first regression

regression:test

This is a PoC, please send feedback or ideally pull requests thanks :)