caddy
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not caddy’s official test suite, and the caddy project is not affiliated with atago.
Summary #
1 suite · 6 scenarios
Contents #
- caddy (self-hosted web server) — 6 scenarios
caddy (self-hosted web server) #
Source: test/e2e/thirdparty/caddy/caddy.atago.yaml
Scenario: the standard module set is compiled in #
When #
caddy list-modules
Then #
- exit code is
0 - stdout contains
http.handlers.file_server,http.handlers.static_response
Scenario: adapt turns a Caddyfile into canonical JSON #
Given #
- Fixture file
Caddyfileis created.
Inputs #
Fixture Caddyfile:
:18080
respond "hello from caddy"
When #
caddy adapt --config Caddyfile
Then #
- exit code is
0 - stdout at
$.apps.http.servers.srv0.listen[0]equals:18080
Scenario: fmt normalizes a messy Caddyfile in place #
Given #
- Fixture file
Caddyfileis created.
Inputs #
Fixture Caddyfile:
:18080 {
respond "ok"
}
When #
caddy fmt --overwrite Caddyfile
Then #
- exit code is
0 - file
Caddyfilecontainsrespond "ok"
Scenario: validate rejects a broken Caddyfile #
Given #
- Fixture file
Caddyfileis created.
Inputs #
Fixture Caddyfile:
:18080
no_such_directive_xyz
When #
caddy validate --config Caddyfile --adapter caddyfile
Then #
- exit code is not
0 - stderr contains
no_such_directive_xyz
Scenario: a config-driven server boots from an authored Caddyfile #
Given #
- Background service
caddyis started:caddy run --config Caddyfile --adapter caddyfile. - Fixture file
Caddyfileis created.
Inputs #
Fixture Caddyfile:
{
admin off
}
http://127.0.0.1:18081
respond "configured response" 200
When #
# HTTP GET /
Then #
- HTTP status is
200 - body contains
configured response
Scenario: the file server serves fixtures over real HTTP #
Given #
- Background service
caddyis started:caddy file-server --listen 127.0.0.1:18080 --root site. - Fixture file
site/index.htmlis created. - Fixture file
site/api/status.jsonis created.
Inputs #
Fixture site/index.html:
<html><body>hello from caddy</body></html>
Fixture site/api/status.json:
{"status":"ok","service":"caddy"}
When #
# HTTP GET /index.html
# HTTP GET /api/status.json
# HTTP GET /no-such-file
Then #
- after
HTTP GET /index.html:- HTTP status is
200 - body contains
hello from caddy - header
Content-Typecontainstext/html
- HTTP status is
- after
HTTP GET /api/status.json:- HTTP status is
200 - body at
$.statusequalsok
- HTTP status is
- after
HTTP GET /no-such-file:- HTTP status is
404
- HTTP status is