tests: `Port 8080 exposed and accepting external connections`

This commit is contained in:
Sameer Naik 2015-08-13 20:38:40 +05:30
parent 98b5c1cc55
commit ac56239710
1 changed files with 29 additions and 0 deletions

29
bitnami/tomcat/test.sh Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bats
CONTAINER_NAME=bitnami-tomcat-test
IMAGE_NAME=${IMAGE_NAME:-bitnami/tomcat}
SLEEP_TIME=5
cleanup_running_containers() {
if [ "$(docker ps -a | grep $CONTAINER_NAME)" ]; then
docker rm -fv $CONTAINER_NAME
fi
}
setup() {
cleanup_running_containers
}
teardown() {
cleanup_running_containers
}
create_container(){
docker run --name $CONTAINER_NAME "$@" $IMAGE_NAME
sleep $SLEEP_TIME
}
@test "Port 8080 exposed and accepting external connections" {
create_container -d
run docker run --link $CONTAINER_NAME:tomcat --rm $IMAGE_NAME curl -L -i http://tomcat:8080
[[ "$output" =~ '200 OK' ]]
}