File tree 4 files changed +222
-0
lines changed
4 files changed +222
-0
lines changed Original file line number Diff line number Diff line change 7
7
branches :
8
8
- master
9
9
- 2.*
10
+ - hurl-tests
10
11
pull_request :
11
12
branches :
12
13
- master
13
14
- 2.*
14
15
15
16
jobs :
16
17
test :
18
+ permissions :
19
+ checks : write
20
+ pull-requests : write
17
21
strategy :
18
22
# Default is true, cancels jobs for other platforms in the matrix if one fails
19
23
fail-fast : false
@@ -125,6 +129,31 @@ jobs:
125
129
go test -tags nobadger -v -coverprofile="cover-profile.out" -short -race ./...
126
130
# echo "status=$?" >> $GITHUB_OUTPUT
127
131
132
+ - name : Install Hurl
133
+ if : matrix.os == 'linux' && matrix.go == '1.22'
134
+ run : |
135
+ curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/4.2.0/hurl_4.2.0_amd64.deb
136
+ sudo dpkg -i hurl_4.2.0_amd64.deb
137
+
138
+ - name : Run Caddy
139
+ if : matrix.os == 'linux' && matrix.go == '1.22'
140
+ working-directory : ./cmd/caddy
141
+ run : |
142
+ ./caddy start
143
+
144
+ - name : Run tests with Hurl
145
+ if : matrix.os == 'linux' && matrix.go == '1.22'
146
+ run : |
147
+ mkdir hurl-report
148
+ find . -name *.hurl -exec hurl --very-verbose --verbose --test --report-junit hurl-report/junit.xml --color {} \;
149
+
150
+ - name : Publish Test Results
151
+ if : matrix.os == 'linux' && matrix.go == '1.22'
152
+ uses : EnricoMi/publish-unit-test-result-action@v2
153
+ with :
154
+ files : |
155
+ hurl-report/junit.xml
156
+
128
157
# Relevant step if we reinvestigate publishing test/coverage reports
129
158
# - name: Prepare coverage reports
130
159
# run: |
Original file line number Diff line number Diff line change
1
+ # Configure Caddy
2
+ POST http://localhost:2019/load
3
+ Content-Type: text/caddyfile
4
+ ```
5
+ {
6
+ skip_install_trust
7
+ http_port 9080
8
+ https_port 9443
9
+ local_certs
10
+ debug
11
+ }
12
+ localhost {
13
+ header "X-Custom-Header" "Custom-Value"
14
+ }
15
+ ```
16
+
17
+ GET https://localhost:9443
18
+ [Options]
19
+ insecure: true
20
+ HTTP 200
21
+ [Asserts]
22
+ header "X-Custom-Header" == "Custom-Value"
Original file line number Diff line number Diff line change
1
+ # Configure Caddy
2
+ POST http://localhost:2019/load
3
+ User-Agent: hurl/ci
4
+ Content-Type: text/caddyfile
5
+ ```
6
+ {
7
+ skip_install_trust
8
+ http_port 9080
9
+ https_port 9443
10
+ local_certs
11
+ }
12
+ localhost {
13
+ rewrite /from /to
14
+ respond {uri}
15
+ }
16
+ ```
17
+
18
+ # simple scenario: rewriting /from to /to produces expected result of seeing /to
19
+ GET https://localhost:9443/from
20
+ [Options]
21
+ insecure: true
22
+ HTTP 200
23
+ [Asserts]
24
+ body == "/to"
25
+
26
+ # unmatched path is passed through unchanged
27
+ GET https://localhost:9443
28
+ [Options]
29
+ insecure: true
30
+ HTTP 200
31
+ [Asserts]
32
+ body == "/"
33
+
34
+ # having a query parameter does not trip the rewrite and retains the query
35
+ GET https://localhost:9443/from?query_param=value
36
+ [Options]
37
+ insecure: true
38
+ HTTP 200
39
+ [Asserts]
40
+ body == "/to?query_param=value"
41
+
42
+
43
+ # Configure Caddy
44
+ POST http://localhost:2019/load
45
+ User-Agent: hurl/ci
46
+ Content-Type: text/caddyfile
47
+ ```
48
+ {
49
+ skip_install_trust
50
+ http_port 9080
51
+ https_port 9443
52
+ local_certs
53
+ }
54
+ localhost {
55
+ rewrite /from /to?a=b
56
+ respond {uri}
57
+ }
58
+ ```
59
+
60
+ # a rewrite with query parameters affects the parameters
61
+ GET https://localhost:9443/from?query_param=value
62
+ [Options]
63
+ insecure: true
64
+ HTTP 200
65
+ [Asserts]
66
+ body == "/to?a=b"
Original file line number Diff line number Diff line change
1
+ # Configure Caddy
2
+ POST http://localhost:2019/load
3
+ User-Agent: hurl/ci
4
+ Content-Type: text/caddyfile
5
+ ```
6
+ {
7
+ skip_install_trust
8
+ http_port 9080
9
+ https_port 9443
10
+ local_certs
11
+ }
12
+ localhost {
13
+ log
14
+ respond "Hello, World!"
15
+ }
16
+ ```
17
+
18
+ GET https://localhost:9443
19
+ [Options]
20
+ insecure: true
21
+ HTTP 200
22
+ [Asserts]
23
+ `Hello, World!`
24
+
25
+
26
+ GET https://localhost:9443/foo
27
+ [Options]
28
+ insecure: true
29
+ HTTP 200
30
+ [Asserts]
31
+ `Hello, World!`
32
+
33
+ # Configure Caddy
34
+ POST http://localhost:2019/load
35
+ User-Agent: hurl/ci
36
+ Content-Type: text/caddyfile
37
+ ```
38
+ {
39
+ skip_install_trust
40
+ http_port 9080
41
+ https_port 9443
42
+ local_certs
43
+ }
44
+ localhost {
45
+ respond "New text!"
46
+ }
47
+ ```
48
+
49
+ GET https://localhost:9443
50
+ [Options]
51
+ insecure: true
52
+ HTTP/2 200
53
+ [Asserts]
54
+ `New text!`
55
+
56
+
57
+ GET https://localhost:9443/foo
58
+ [Options]
59
+ insecure: true
60
+ HTTP/2 200
61
+ [Asserts]
62
+ `New text!`
63
+
64
+ GET https://localhost:9443/foo
65
+ [Options]
66
+ insecure: true
67
+ HTTP/2 200
68
+ [Asserts]
69
+ body != "Hello, World!"
70
+
71
+ # Configure Caddy
72
+ # The body is a placeholder
73
+ POST http://localhost:2019/load
74
+ User-Agent: hurl/ci
75
+ Content-Type: text/caddyfile
76
+ ```
77
+ {
78
+ skip_install_trust
79
+ http_port 9080
80
+ https_port 9443
81
+ local_certs
82
+ }
83
+ localhost {
84
+ log
85
+ respond {http.request.body}
86
+ }
87
+ ```
88
+
89
+ # handler responds with the "application/json" if the response body is valid JSON
90
+ POST https://localhost:9443
91
+ [Options]
92
+ insecure: true
93
+ ```json
94
+ {
95
+ "greeting": "Hello, world!"
96
+ }
97
+ ```
98
+ HTTP/2 200
99
+ [Asserts]
100
+ header "Content-Type" == "application/json"
101
+ ```json
102
+ {
103
+ "greeting": "Hello, world!"
104
+ }
105
+ ```
You can’t perform that action at this time.
0 commit comments