Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create main.bats
chubing committed Oct 8, 2018
1 parent fdfd1f6 commit d5241b5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/main.bats
@@ -0,0 +1,33 @@
#!/usr/bin/env bats

load ../common

@test "010 Image is present and healthy" {
docker image inspect ${maintainer}/${imagename}
}

@test "030 Port 443/https is listening" {
docker run -d ${maintainer}/${imagename}
sleep 25
#get cont id
contid=$(docker ps | grep ${maintainer}/${imagename} | cut -f 1 -d ' ')
run docker exec -i ${contid} sh -c 'cat < /dev/null > /dev/tcp/127.0.0.1/443'
docker kill ${contid} &>/dev/null
docker rm ${contid} &>/dev/null
[ "$status" -eq 0 ]
}

@test "040 The Grouper Status page is present" {
docker run -d ${maintainer}/${imagename}
sleep 60
contid2=$(docker ps | grep ${maintainer}/${imagename} | cut -f 1 -d ' ')
run docker exec -i ${contid2} sh -c 'curl -I -k -s -f https://127.0.0.1/grouper/status?diagnosticType=trivial'
docker kill ${contid2} &>/dev/null
docker rm ${contid2} &>/dev/null
[ "$status" -eq 0 ]
}


@test "070 There are no known security vulnerabilities" {
./tests/clairscan.sh ${maintainer}/${imagename}
}

0 comments on commit d5241b5

Please sign in to comment.