blob: 7a849eb90d39bca3e20bb7685a56c1fa4d08126c [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/..
Carlos Sanchez59d9ef62016-11-09 13:08:41 +010013 docker_build -t $SUT_IMAGE .
Carlos Sanchez0e026d22016-08-08 09:57:58 +020014}
15
Vincent Latombec14af952016-07-18 10:20:12 +020016@test "versionLT" {
Carlos Sanchez3e58be92016-09-16 18:32:23 -070017 run docker run --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 Sanchez3e58be92016-09-16 18:32:23 -070019 run docker run --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 Sanchez3e58be92016-09-16 18:32:23 -070021 run docker run --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 Sanchez3e58be92016-09-16 18:32:23 -070023 run docker run --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 Sanchez3e58be92016-09-16 18:32:23 -070025 run docker run --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 Sanchez3e58be92016-09-16 18:32:23 -070027 run docker run --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 Sanchez3e58be92016-09-16 18:32:23 -070029 run docker run --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}