Skip to content
Permalink
Browse files

Add first real demo/simple test

  • Loading branch information
mederly committed Sep 27, 2018
1 parent 86b58f9 commit 87f255c5a123013c6539c2b923df0b8b204c6caf
Showing with 34 additions and 0 deletions.
  1. +2 −0 Jenkinsfile
  2. +14 −0 demo/simple/tests/main.bats
  3. +18 −0 library.bash
@@ -36,6 +36,7 @@ pipeline {
try {
sh './download-midpoint &> debug'
sh 'bin/rebuild.sh &>> debug'
sh 'echo Build output ; cat debug'
} catch (error) {
def error_details = readFile('./debug')
def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
@@ -50,6 +51,7 @@ pipeline {
script {
try {
sh 'bin/test.sh &> debug'
sh '(cd demo/simple ; bats tests ) &>> debug'
sh 'echo Test output ; cat debug'
} catch (error) {
def error_details = readFile('./debug')
@@ -0,0 +1,14 @@
#!/usr/bin/env bats

load ../../../common
load ../../../library

@test "000 Initialize and start midPoint" {
run docker-compose down -v
docker-compose up -d
wait_for_midpoint_start simple_midpoint-server_1
}

@test "999 Clean up" {
docker-compose down -v
}
@@ -0,0 +1,18 @@
#!/bin/bash

function wait_for_midpoint_start () {
ATTEMPT=0
MAX_ATTEMPTS=20
DELAY=10

until [[ $ATTEMPT = $MAX_ATTEMPTS ]]; do
ATTEMPT=$((ATTEMPT+1))
echo "Waiting $DELAY seconds for midPoint to start (attempt $ATTEMPT) ..."
sleep $DELAY
docker ps
( docker logs $1 2>&1 | grep "INFO (com.evolveum.midpoint.web.boot.MidPointSpringApplication): Started MidPointSpringApplication in" ) && return 0
done

echo midPoint did not start in $(( $MAX_ATTEMPTS * $DELAY )) seconds
return 1
}

0 comments on commit 87f255c

Please sign in to comment.
You can’t perform that action at this time.