-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: test caddy file * test: add interval and burst * test: find container
- Loading branch information
Showing
2 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,14 @@ import ( | |
|
||
func TestConvertToCaddyfile(t *testing.T) { | ||
caddyCfg := config.CaddyConfig{ | ||
Global: config.GlobalOptions{ | ||
Email: "[email protected]", | ||
OnDemandTls: config.OnDemandTlsConfig{ | ||
Ask: "https://acme.example.com/directory", | ||
Interval: "3600", | ||
Burst: "13", | ||
}, | ||
}, | ||
Rules: []config.Rule{ | ||
{ | ||
Match: "localhost", | ||
|
@@ -40,7 +48,7 @@ func TestConvertToCaddyfile(t *testing.T) { | |
} | ||
|
||
caddyfile := ConvertToCaddyfile(caddyCfg, 8080) | ||
expectedCaddyfile := "localhost {\n tls {\n internal\n }\n handle / {\n root * /usr/share/caddy\n }\n handle /healthz {\n respond \"OK\" 200\n }\n reverse_proxy / http://localhost:8080\n}\n\n" | ||
expectedCaddyfile := "{\n email [email protected]\n on_demand_tls {\n ask https://acme.example.com/directory\n interval 3600\n burst 13\n }\n}\n\nlocalhost {\n tls {\n internal\n }\n handle / {\n root * /usr/share/caddy\n }\n handle /healthz {\n respond \"OK\" 200\n }\n reverse_proxy / http://localhost:8080\n}\n\n" | ||
assert.Equal(t, expectedCaddyfile, caddyfile) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters