-
Notifications
You must be signed in to change notification settings - Fork 281
/
test.sqlite.bats
executable file
·70 lines (56 loc) · 2.25 KB
/
test.sqlite.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bats
load test_helpers
load docker_helpers
load "lib/batslib"
load "lib/output"
@test "[$TEST_FILE] docker-compose up" {
command docker-compose -f test/docker-compose-sqlite.yml up -d
}
@test "[$TEST_FILE] check for container init" {
docker_wait_for_log test_cachet_1 15 "Initializing Cachet container ..."
}
@test "[$TEST_FILE] check for container start message" {
docker_wait_for_log test_cachet_1 15 "Starting Cachet! ..."
}
@test "[$TEST_FILE] check for nginx startup" {
docker_wait_for_log test_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 test_cachet_1 15 "INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)"
}
@test "[$TEST_FILE] php artisan cachet:seed" {
run docker exec test_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 test_cachet_1 :8000/auth/login --head
assert_output -l 0 $'HTTP/1.1 200 OK\r'
}
@test "[$TEST_FILE] login test" {
run curl_container test_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 test_cachet_1 :8000/api/v1/ping
assert_output -l 0 $'{"data":"Pong!"}'
}
@test "[$TEST_FILE] restart cachet" {
command docker-compose -f test/docker-compose-sqlite.yml stop cachet
command docker-compose -f test/docker-compose-sqlite.yml rm -f cachet
command docker-compose -f test/docker-compose-sqlite.yml up -d
docker_wait_for_log test_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 test_cachet_1 :8000/api/v1/ping
assert_output -l 0 $'{"data":"Pong!"}'
}
@test "[$TEST_FILE] post-restart login test" {
run curl_container test_cachet_1 :8000/auth/login --head --user test:test123
assert_output -l 0 $'HTTP/1.1 200 OK\r'
}
@test "[$TEST_FILE] stop all test containers" {
stop_bats_containers
}
@test "[$TEST_FILE] Cleanup test containers" {
docker_clean test_cachet_1
}