-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
villadalmine
committed
Aug 26, 2016
1 parent
1d18a20
commit 5e3d22e
Showing
1 changed file
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ] | ||
| } |