Skip to content

Commit

Permalink
Added more logic to first test
Browse files Browse the repository at this point in the history
  • Loading branch information
villadalmine committed Aug 26, 2016
1 parent 1d18a20 commit 5e3d22e
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions tests/image-test.bats
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
#!/usr/bin/env bats
load ../common

@test "Build Docker Image" {
result=$(bin/build.sh |grep -c "Successfully built*")
[ $result -eq 1 ]
@test "Build Docker Image $imagename/$maintainer" {
run bash -c "ps -eaf |grep -v grep|grep -c docker"
if [ $output -eq 0 ]; then
skip "Docker service is not running"
fi

run bash -c "ls -l Dockerfile"
if [ $status -ne 0 ]; then
skip "Dockerfile is not present"
fi

run bash -c "grep -c -e imagename -e maintainer -e version common.bash "
if [ $output -ne 3 ]; then
skip "imagename,maintainer and version are not defined"
fi

run bash -c "grep -c -e version -e imagename -e maintainer Dockerfile"
if [ $output -lt 3 ]; then
skip "imagename,maintainer and version are not defined in Dockerfile"
fi

run bash -c "docker ps -f names=$imagename |wc -l"
if [ $output -gt 1 ]; then
skip "Docker $imagename/$maintainer was created before"
fi
run bash -c "docker images -q $maintainer/$imagename"
if [ $status -eq 0 ]; then
skip "Docker image $maintainer/$imagename was built before"
fi
run bash -c "bin/build.sh"
[ $status -eq 0 ]
}

0 comments on commit 5e3d22e

Please sign in to comment.