forked from eficode/wait-for
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwait-for-healthy.bats
39 lines (26 loc) · 1.04 KB
/
wait-for-healthy.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
#!/usr/bin/env bats
@test "google should be immediately found" {
run ./wait-for-healthy https://www.google.com/ -- echo 'success'
[ "$output" = "success" ]
}
@test "google should be immediately found with HTTP method GET" {
run ./wait-for-healthy https://www.google.com/ -m GET -- echo 'success'
[ "$output" = "success" ]
}
@test "google should be immediately found with HTTP method (--method) GET" {
run ./wait-for-healthy https://www.google.com/ --method=GET -- echo 'success'
[ "$output" = "success" ]
}
@test "httpbin should respond with 200 with HTTP method POST" {
run ./wait-for-healthy https://httpbin.org/status/200 -m POST -- echo 'success'
[ "$output" = "success" ]
}
@test "httpbin should respond with 201 with HTTP method PUT" {
run ./wait-for-healthy https://httpbin.org/status/201 -m PUT -- echo 'success'
[ "$output" = "success" ]
}
@test "nonexistent server should not start command" {
run ./wait-for-healthy -t 1 noserver -m GET -- echo 'success'
[ "$status" -ne 0 ]
[ "$output" != "success" ]
}