blob: b89de8c50aac7581bc0bca8c39136aaef3fac43a [file] [log] [blame]
Vincent Latombec14af952016-07-18 10:20:12 +02001#!/usr/bin/env bats
2
Carlos Sanchez0e026d22016-08-08 09:57:58 +02003SUT_IMAGE=bats-jenkins
4
Vincent Latombec14af952016-07-18 10:20:12 +02005load 'test_helper/bats-support/load'
6load 'test_helper/bats-assert/load'
7load test_helpers
8
9. $BATS_TEST_DIRNAME/../jenkins-support
10
Carlos Sanchez0e026d22016-08-08 09:57:58 +020011@test "build image" {
12 cd $BATS_TEST_DIRNAME/..
13 docker build -t $SUT_IMAGE .
14}
15
Vincent Latombec14af952016-07-18 10:20:12 +020016@test "versionLT" {
Carlos Sanchez0e026d22016-08-08 09:57:58 +020017 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.0"
Vincent Latombec14af952016-07-18 10:20:12 +020018 assert_failure
Carlos Sanchez0e026d22016-08-08 09:57:58 +020019 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.1"
Vincent Latombec14af952016-07-18 10:20:12 +020020 assert_success
Carlos Sanchez0e026d22016-08-08 09:57:58 +020021 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.1 1.0"
Vincent Latombec14af952016-07-18 10:20:12 +020022 assert_failure
Carlos Sanchez0e026d22016-08-08 09:57:58 +020023 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-beta-1 1.0"
Vincent Latombec14af952016-07-18 10:20:12 +020024 assert_success
Carlos Sanchez0e026d22016-08-08 09:57:58 +020025 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.0-beta-1"
Vincent Latombec14af952016-07-18 10:20:12 +020026 assert_failure
Carlos Sanchez0e026d22016-08-08 09:57:58 +020027 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-alpha-1 1.0-beta-1"
Vincent Latombec14af952016-07-18 10:20:12 +020028 assert_success
Carlos Sanchez0e026d22016-08-08 09:57:58 +020029 run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-beta-1 1.0-alpha-1"
Vincent Latombec14af952016-07-18 10:20:12 +020030 assert_failure
31}