-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun-http-specs
More file actions
executable file
·66 lines (50 loc) · 2.93 KB
/
Copy pathrun-http-specs
File metadata and controls
executable file
·66 lines (50 loc) · 2.93 KB
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
#!/bin/bash
time (
http-spec examples/file-not-found.htsf && exit 1
http-spec examples/line-count-mismatch.htsf && exit 1
http-spec examples/request-only.htsf && exit 1
http-spec examples/uuid.htsf && exit 1
http-spec examples/random-uuid.htsf && exit 1
http-spec examples/malformed-prefix.htsf && exit 1
http-spec examples/malformed-request-line.htsf && exit 1
http-spec examples/malformed-header.htsf && exit 1
http-spec examples/malformed-spacing.htsf && exit 1
http-spec examples/not-found.htsf \
examples/post.htsf \
examples/regexp-and-substitution.htsf \
examples/sleep.htsf || exit 1
http-spec -skip-tls-verification examples/insecure.htsf || exit 1
http-spec examples/do-not-follow-redirect.htsf || exit 1
http-spec examples/built-in-substitution.htsf || exit 1
http-spec -matchers matchers.json \
examples/custom-matcher.htsf || exit 1
http-spec -hostname httpbin.org -scheme http \
examples/scheme-and-hostname-1.htsf || exit 1
http-spec -hostname httpbin.org -scheme https \
examples/scheme-and-hostname-2.htsf || exit 1
http-spec examples/multiple-matchers.htsf || exit 1
output=$(http-spec -http-timeout 1ms \
-max-http-attempts 1 \
examples/not-found.htsf 2>&1) && exit 1
echo "$output" | grep -qi 'timeout' || exit 1
SECONDS=0
output=$(http-spec -retry-status-codes 404 \
-max-http-attempts 2 \
-http-retry-delay 1s \
examples/not-found.htsf 2>&1) && exit 1
[ $SECONDS -ge 1 ] || exit 1
echo "$output" | grep -q 'retry limit reached' || exit 1
output=$(http-spec examples/malformed-prefix.htsf 2>&1) && exit 1
echo "$output" | grep -q 'Substitutions' || exit 1
output=$(http-spec -show-substitutions \
examples/not-found.htsf 2>&1) || exit 1
echo "$output" | grep -q 'Substitutions' || exit 1
output=$(http-spec examples/not-found.htsf 2>&1) || exit 1
! echo "$output" | grep -q 'Substitutions' || exit 1
output=$(http-spec -retry-status-codes abc \
examples/not-found.htsf 2>&1) && exit 1
echo "$output" | grep -q 'invalid status code' || exit 1
) || exit 1
echo
echo Tests ran successfully!
exit 0