diff options
author | Mark Sargent <[email protected]> | 2020-03-14 06:32:53 +1300 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-13 11:32:53 -0600 |
commit | c4472363579e26485fdfc01f4fd79b86d44acd86 (patch) | |
tree | 9a59e09cd79f9d1c5efbca8723bfffc2d21afbf2 /caddytest/caddytest_test.go | |
parent | 5a19db5dc2db7c02d0f99630a07a64cacb7f7b44 (diff) | |
download | caddy-c4472363579e26485fdfc01f4fd79b86d44acd86.tar.gz caddy-c4472363579e26485fdfc01f4fd79b86d44acd86.zip |
caddyhttp: Fix default SNI for default conn policy (#3141)
* add integration tests
* removed SNI test
* remove integration test condition
* minor edit
* fix sni when using static certificates
Co-authored-by: Matt Holt <[email protected]>
Diffstat (limited to 'caddytest/caddytest_test.go')
-rw-r--r-- | caddytest/caddytest_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/caddytest/caddytest_test.go b/caddytest/caddytest_test.go new file mode 100644 index 000000000..a46867ca8 --- /dev/null +++ b/caddytest/caddytest_test.go @@ -0,0 +1,33 @@ +package caddytest + +import ( + "strings" + "testing" +) + +func TestReplaceCertificatePaths(t *testing.T) { + rawConfig := `a.caddy.localhost:9443 { + tls /caddy.localhost.crt /caddy.localhost.key { + } + + redir / https://b.caddy.localhost:9443/version 301 + + respond /version 200 { + body "hello from a.caddy.localhost" + } + }` + + r := prependCaddyFilePath(rawConfig) + + if !strings.Contains(r, getIntegrationDir()+"/caddy.localhost.crt") { + t.Error("expected the /caddy.localhost.crt to be expanded to include the full path") + } + + if !strings.Contains(r, getIntegrationDir()+"/caddy.localhost.key") { + t.Error("expected the /caddy.localhost.crt to be expanded to include the full path") + } + + if !strings.Contains(r, "https://b.caddy.localhost:9443/version") { + t.Error("expected redirect uri to be unchanged") + } +} |