Skip to content

Commit

Permalink
Update docker container naming in tests to match this repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sedan07 committed Mar 16, 2021
1 parent ee7acdf commit dfbc80b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
build:
context: .
args:
- cachet_ver=2.4
- cachet_ver=2.5
ports:
- 80:8000
links:
Expand Down
4 changes: 2 additions & 2 deletions test/docker-compose-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- MYSQL_DATABASE=mysql
- DEBUG=false
cachet:
image: docker_cachet
image: cachetdocker_cachet
ports:
- 80:8000
links:
Expand All @@ -29,4 +29,4 @@ services:
networks:
default:
external:
name: docker_default
name: cachetdocker_default
4 changes: 2 additions & 2 deletions test/docker-compose-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
cachet:
image: docker_cachet
image: cachetdocker_cachet
ports:
- 80:8000
environment:
Expand All @@ -15,7 +15,7 @@ services:
networks:
default:
external:
name: docker_default
name: cachetdocker_default

volumes:
cachetdb:
2 changes: 1 addition & 1 deletion test/docker_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function docker_clean {

# get the ip of docker container $1
function docker_ip {
docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress }}' $1
docker inspect --format '{{ .NetworkSettings.Networks.cachetdocker_default.IPAddress }}' $1
}

# get the id of docker container $1
Expand Down
38 changes: 19 additions & 19 deletions test/test.full.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,85 +13,85 @@ load "lib/output"
}

@test "[$TEST_FILE] check for container init" {
docker_wait_for_log docker_cachet_1 15 "Initializing Cachet container ..."
docker_wait_for_log cachetdocker_cachet_1 15 "Initializing Cachet container ..."
}

@test "[$TEST_FILE] check for postgres database startup" {
docker_wait_for_log docker_postgres_1 120 "LOG: database system is ready to accept connections"
docker_wait_for_log cachetdocker_postgres_1 120 "LOG: database system is ready to accept connections"
}

@test "[$TEST_FILE] check for empty sessions table" {
docker_wait_for_log docker_cachet_1 15 "Table chq_sessions does not exist! ..."
docker_wait_for_log cachetdocker_cachet_1 15 "Table chq_sessions does not exist! ..."
}

@test "[$TEST_FILE] check for DB init" {
docker_wait_for_log docker_cachet_1 15 "Initializing Cachet database ..."
docker_wait_for_log cachetdocker_cachet_1 15 "Initializing Cachet database ..."
}

@test "[$TEST_FILE] check for populated sessions table" {
docker_wait_for_log docker_cachet_1 15 "Table chq_sessions exists! ..."
docker_wait_for_log cachetdocker_cachet_1 15 "Table chq_sessions exists! ..."
}

@test "[$TEST_FILE] check for container start message" {
docker_wait_for_log docker_cachet_1 15 "Starting Cachet! ..."
docker_wait_for_log cachetdocker_cachet_1 15 "Starting Cachet! ..."
}

@test "[$TEST_FILE] check for nginx startup" {
docker_wait_for_log docker_cachet_1 15 "INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
docker_wait_for_log cachetdocker_cachet_1 15 "INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
}

@test "[$TEST_FILE] check for php-fpm startup" {
docker_wait_for_log docker_cachet_1 15 "INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
docker_wait_for_log cachetdocker_cachet_1 15 "INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
}

@test "[$TEST_FILE] check for queue-worker startup" {
docker_wait_for_log docker_cachet_1 15 "INFO success: queue-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
docker_wait_for_log cachetdocker_cachet_1 15 "INFO success: queue-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
}

@test "[$TEST_FILE] php artisan cachet:seed" {
run docker exec docker_cachet_1 php artisan cachet:seed
run docker exec cachetdocker_cachet_1 php artisan cachet:seed
assert_output -l 0 $'Database seeded with demo data successfully!'
}

@test "[$TEST_FILE] curl 200 response test" {
run curl_container docker_cachet_1 :8000/auth/login --head
run curl_container cachetdocker_cachet_1 :8000/auth/login --head
assert_output -l 0 $'HTTP/1.1 200 OK\r'
}

@test "[$TEST_FILE] login test" {
run curl_container docker_cachet_1 :8000/auth/login --head --user test:test123
run curl_container cachetdocker_cachet_1 :8000/auth/login --head --user test:test123
assert_output -l 0 $'HTTP/1.1 200 OK\r'
}

@test "[$TEST_FILE] check for curl API pong" {
run curl_container docker_cachet_1 :8000/api/v1/ping
run curl_container cachetdocker_cachet_1 :8000/api/v1/ping
assert_output -l 0 $'{"data":"Pong!"}'
}

@test "[$TEST_FILE] check for pg_dump version mismatch" {
run docker exec docker_cachet_1 php artisan app:update
run docker exec cachetdocker_cachet_1 php artisan app:update
refute_output -l 5 $'pg_dump: aborting because of server version mismatch'
}

@test "[$TEST_FILE] ensure there are no volumes" {
run docker inspect -f '{{ .Mounts }}' docker_cachet_1
run docker inspect -f '{{ .Mounts }}' cachetdocker_cachet_1
assert_output -l 0 $'[]'
}

@test "[$TEST_FILE] restart cachet" {
command docker-compose stop cachet
command docker-compose rm -f cachet
command docker-compose up -d
docker_wait_for_log docker_cachet_1 15 "INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
docker_wait_for_log cachetdocker_cachet_1 15 "INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
}

@test "[$TEST_FILE] post-restart API pong" {
run curl_container docker_cachet_1 :8000/api/v1/ping
run curl_container cachetdocker_cachet_1 :8000/api/v1/ping
assert_output -l 0 $'{"data":"Pong!"}'
}

@test "[$TEST_FILE] post-restart login test" {
run curl_container docker_cachet_1 :8000/auth/login --head --user test:test123
run curl_container cachetdocker_cachet_1 :8000/auth/login --head --user test:test123
assert_output -l 0 $'HTTP/1.1 200 OK\r'
}

Expand All @@ -100,6 +100,6 @@ load "lib/output"
}

@test "[$TEST_FILE] Cleanup test containers" {
docker_clean docker_cachet_1
docker_clean cachetdocker_cachet_1
docker_clean docker_postgres_1
}
2 changes: 1 addition & 1 deletion test/test_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function curl_container {
local -r container=$1
local -r path=$2
shift 2
docker run --rm --net=docker_default --label bats-type="curl" curlimages/curl --silent \
docker run --rm --net=cachetdocker_default --label bats-type="curl" curlimages/curl --silent \
--connect-timeout 5 \
--max-time 20 \
--retry 4 --retry-delay 5 \
Expand Down

0 comments on commit dfbc80b

Please sign in to comment.