Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add first real demo/simple test
mederly committed Sep 27, 2018
1 parent 86b58f9 commit 87f255c
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Jenkinsfile
@@ -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')
14 changes: 14 additions & 0 deletions demo/simple/tests/main.bats
@@ -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
}
18 changes: 18 additions & 0 deletions library.bash
@@ -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.