Fix up the tests after TLS changes in Caddy
This commit is contained in:
parent
ae59fae1dc
commit
77cd5d827e
2 changed files with 11 additions and 15 deletions
|
|
@ -130,25 +130,25 @@ func (c *caddyTestServer) StartTestServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
caddyForwardProxy = caddyTestServer{addr: "127.0.0.2:1984", root: "./test/forwardproxy",
|
caddyForwardProxy = caddyTestServer{addr: "127.0.19.84:1984", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"},
|
directives: []string{"tls self_signed"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{"serve_pac",
|
proxyEnabled: true, proxyDirectives: []string{"serve_pac",
|
||||||
"acl {\nallow all\n}"}}
|
"acl {\nallow all\n}"}}
|
||||||
caddyForwardProxy.StartTestServer()
|
caddyForwardProxy.StartTestServer()
|
||||||
|
|
||||||
caddyForwardProxyAuth = caddyTestServer{addr: "127.0.0.2:4891", root: "./test/forwardproxy",
|
caddyForwardProxyAuth = caddyTestServer{addr: "127.0.0.1:4891", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"},
|
directives: []string{"tls self_signed"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
|
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
|
||||||
"acl {\nallow all\n}"}}
|
"acl {\nallow all\n}"}}
|
||||||
caddyForwardProxyAuth.StartTestServer()
|
caddyForwardProxyAuth.StartTestServer()
|
||||||
|
|
||||||
caddyHTTPForwardProxyAuth = caddyTestServer{addr: "127.0.0.2:6973", root: "./test/forwardproxy",
|
caddyHTTPForwardProxyAuth = caddyTestServer{addr: "127.0.69.73:6973", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls off"},
|
directives: []string{"tls off"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
|
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
|
||||||
"acl {\nallow all\n}"}}
|
"acl {\nallow all\n}"}}
|
||||||
caddyHTTPForwardProxyAuth.StartTestServer()
|
caddyHTTPForwardProxyAuth.StartTestServer()
|
||||||
|
|
||||||
caddyForwardProxyProbeResist = caddyTestServer{addr: "127.0.0.2:8888", root: "./test/forwardproxy",
|
caddyForwardProxyProbeResist = caddyTestServer{addr: "127.0.88.88:8888", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"}, HTTPRedirectPort: "8880",
|
directives: []string{"tls self_signed"}, HTTPRedirectPort: "8880",
|
||||||
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
|
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
|
||||||
"probe_resistance test.localhost",
|
"probe_resistance test.localhost",
|
||||||
|
|
@ -156,13 +156,13 @@ func TestMain(m *testing.M) {
|
||||||
"acl {\nallow all\n}"}}
|
"acl {\nallow all\n}"}}
|
||||||
caddyForwardProxyProbeResist.StartTestServer()
|
caddyForwardProxyProbeResist.StartTestServer()
|
||||||
|
|
||||||
caddyDummyProbeResist = caddyTestServer{addr: "127.0.0.2:9999", root: "./test/forwardproxy",
|
caddyDummyProbeResist = caddyTestServer{addr: "127.0.99.99:9999", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"}, HTTPRedirectPort: "9980",
|
directives: []string{"tls self_signed"}, HTTPRedirectPort: "9980",
|
||||||
proxyEnabled: false}
|
proxyEnabled: false}
|
||||||
caddyDummyProbeResist.StartTestServer()
|
caddyDummyProbeResist.StartTestServer()
|
||||||
|
|
||||||
// 127.0.0.1 and localhost are both used to avoid Caddy matching and routing proxy requests internally
|
// 127.0.0.1 and localhost are both used to avoid Caddy matching and routing proxy requests internally
|
||||||
caddyTestTarget = caddyTestServer{addr: "localhost:6451", root: "./test/index",
|
caddyTestTarget = caddyTestServer{addr: "127.0.64.51:6451", root: "./test/index",
|
||||||
directives: []string{},
|
directives: []string{},
|
||||||
proxyEnabled: false}
|
proxyEnabled: false}
|
||||||
caddyTestTarget.StartTestServer()
|
caddyTestTarget.StartTestServer()
|
||||||
|
|
@ -172,26 +172,26 @@ func TestMain(m *testing.M) {
|
||||||
proxyEnabled: false}
|
proxyEnabled: false}
|
||||||
caddyHTTPTestTarget.StartTestServer()
|
caddyHTTPTestTarget.StartTestServer()
|
||||||
|
|
||||||
caddyAuthedUpstreamEnter = caddyTestServer{addr: "127.0.0.2:6585", root: "./test/upstreamingproxy",
|
caddyAuthedUpstreamEnter = caddyTestServer{addr: "127.0.65.25:6585", root: "./test/upstreamingproxy",
|
||||||
directives: []string{"tls self_signed"},
|
directives: []string{"tls self_signed"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{"upstream https://test:pass@127.0.0.1:4891",
|
proxyEnabled: true, proxyDirectives: []string{"upstream https://test:pass@127.0.0.1:4891",
|
||||||
"basicauth upstreamtest upstreampass"}}
|
"basicauth upstreamtest upstreampass"}}
|
||||||
caddyAuthedUpstreamEnter.StartTestServer()
|
caddyAuthedUpstreamEnter.StartTestServer()
|
||||||
|
|
||||||
caddyForwardProxyWhiteListing = caddyTestServer{addr: "127.0.0.2:8776", root: "./test/forwardproxy",
|
caddyForwardProxyWhiteListing = caddyTestServer{addr: "127.0.87.76:8776", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"},
|
directives: []string{"tls self_signed"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{"acl {\nallow localhost\n deny all\n}",
|
proxyEnabled: true, proxyDirectives: []string{"acl {\nallow 127.0.64.51\n deny all\n}",
|
||||||
"ports 6451"}}
|
"ports 6451"}}
|
||||||
caddyForwardProxyWhiteListing.StartTestServer()
|
caddyForwardProxyWhiteListing.StartTestServer()
|
||||||
|
|
||||||
caddyForwardProxyBlackListing = caddyTestServer{addr: "127.0.0.2:6676", root: "./test/forwardproxy",
|
caddyForwardProxyBlackListing = caddyTestServer{addr: "127.0.66.76:6676", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"},
|
directives: []string{"tls self_signed"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{"acl {\ndeny " + blacklistedIPv4 + "/30\n" +
|
proxyEnabled: true, proxyDirectives: []string{"acl {\ndeny " + blacklistedIPv4 + "/30\n" +
|
||||||
"deny " + blacklistedIPv6 + "\nallow all\n}"},
|
"deny " + blacklistedIPv6 + "\nallow all\n}"},
|
||||||
}
|
}
|
||||||
caddyForwardProxyBlackListing.StartTestServer()
|
caddyForwardProxyBlackListing.StartTestServer()
|
||||||
|
|
||||||
caddyForwardProxyNoBlacklistOverride = caddyTestServer{addr: "127.0.0.2:6679", root: "./test/forwardproxy",
|
caddyForwardProxyNoBlacklistOverride = caddyTestServer{addr: "127.0.66.79:6679", root: "./test/forwardproxy",
|
||||||
directives: []string{"tls self_signed"},
|
directives: []string{"tls self_signed"},
|
||||||
proxyEnabled: true, proxyDirectives: []string{}}
|
proxyEnabled: true, proxyDirectives: []string{}}
|
||||||
caddyForwardProxyNoBlacklistOverride.StartTestServer()
|
caddyForwardProxyNoBlacklistOverride.StartTestServer()
|
||||||
|
|
|
||||||
|
|
@ -197,10 +197,6 @@ func TestConnectAuthWrongProbeResist(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if responseProbeResist.StatusCode != http.StatusOK {
|
|
||||||
t.Fatalf("Expected response: 200 StatusOK, Got: %d\n",
|
|
||||||
responseProbeResist.StatusCode)
|
|
||||||
}
|
|
||||||
if err = responsesAreEqual(responseProbeResist, responseReference); err != nil {
|
if err = responsesAreEqual(responseProbeResist, responseReference); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue