mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-24 03:19:59 +08:00
ci: test local CA and update SNI tests (#3145)
* run caddy tests in process * call main with run args * exclude tests - windows * include json example * disable caddyfile tests, include json test with non trusted local ca * converted SNI tests to json syntax
This commit is contained in:
@ -66,71 +66,3 @@ func TestDuplicateHosts(t *testing.T) {
|
||||
"caddyfile",
|
||||
"duplicate site address not allowed")
|
||||
}
|
||||
|
||||
func TestDefaultSNI(t *testing.T) {
|
||||
|
||||
// arrange
|
||||
caddytest.InitServer(t, `
|
||||
{
|
||||
http_port 9080
|
||||
https_port 9443
|
||||
default_sni *.caddy.localhost
|
||||
}
|
||||
|
||||
127.0.0.1:9443 {
|
||||
tls /caddy.localhost.crt /caddy.localhost.key
|
||||
respond /version 200 {
|
||||
body "hello from a"
|
||||
}
|
||||
}
|
||||
`, "caddyfile")
|
||||
|
||||
// act and assert
|
||||
caddytest.AssertGetResponse(t, "https://127.0.0.1:9443/version", 200, "hello from a")
|
||||
}
|
||||
|
||||
func TestDefaultSNIWithNamedHostAndExplicitIP(t *testing.T) {
|
||||
|
||||
// arrange
|
||||
caddytest.InitServer(t, `
|
||||
{
|
||||
http_port 9080
|
||||
https_port 9443
|
||||
default_sni a.caddy.localhost
|
||||
}
|
||||
|
||||
a.caddy.localhost:9443, 127.0.0.1:9443 {
|
||||
tls /a.caddy.localhost.crt /a.caddy.localhost.key
|
||||
respond /version 200 {
|
||||
body "hello from a"
|
||||
}
|
||||
}
|
||||
`, "caddyfile")
|
||||
|
||||
// act and assert
|
||||
// makes a request with no sni
|
||||
caddytest.AssertGetResponse(t, "https://127.0.0.1:9443/version", 200, "hello from a")
|
||||
}
|
||||
|
||||
func TestDefaultSNIWithPortMappingOnly(t *testing.T) {
|
||||
|
||||
// arrange
|
||||
caddytest.InitServer(t, `
|
||||
{
|
||||
http_port 9080
|
||||
https_port 9443
|
||||
default_sni a.caddy.localhost
|
||||
}
|
||||
|
||||
:9443 {
|
||||
tls /a.caddy.localhost.crt /a.caddy.localhost.key
|
||||
respond /version 200 {
|
||||
body "hello from a.caddy.localhost"
|
||||
}
|
||||
}
|
||||
`, "caddyfile")
|
||||
|
||||
// act and assert
|
||||
// makes a request with no sni
|
||||
caddytest.AssertGetResponse(t, "https://127.0.0.1:9443/version", 200, "hello from a")
|
||||
}
|
||||
|
Reference in New Issue
Block a user