From 77cd5d827e722bc0d820ae1a3cb889dc7fcd64b8 Mon Sep 17 00:00:00 2001 From: Sergey Frolov Date: Sun, 3 Feb 2019 17:16:45 -0700 Subject: [PATCH] Fix up the tests after TLS changes in Caddy --- common_test.go | 22 +++++++++++----------- probe_resist_test.go | 4 ---- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/common_test.go b/common_test.go index e143dfe..32083f0 100644 --- a/common_test.go +++ b/common_test.go @@ -130,25 +130,25 @@ func (c *caddyTestServer) StartTestServer() { } 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"}, proxyEnabled: true, proxyDirectives: []string{"serve_pac", "acl {\nallow all\n}"}} 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"}, proxyEnabled: true, proxyDirectives: []string{"basicauth test pass", "acl {\nallow all\n}"}} 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"}, proxyEnabled: true, proxyDirectives: []string{"basicauth test pass", "acl {\nallow all\n}"}} 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", proxyEnabled: true, proxyDirectives: []string{"basicauth test pass", "probe_resistance test.localhost", @@ -156,13 +156,13 @@ func TestMain(m *testing.M) { "acl {\nallow all\n}"}} 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", proxyEnabled: false} caddyDummyProbeResist.StartTestServer() // 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{}, proxyEnabled: false} caddyTestTarget.StartTestServer() @@ -172,26 +172,26 @@ func TestMain(m *testing.M) { proxyEnabled: false} 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"}, proxyEnabled: true, proxyDirectives: []string{"upstream https://test:pass@127.0.0.1:4891", "basicauth upstreamtest upstreampass"}} 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"}, - 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"}} 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"}, proxyEnabled: true, proxyDirectives: []string{"acl {\ndeny " + blacklistedIPv4 + "/30\n" + "deny " + blacklistedIPv6 + "\nallow all\n}"}, } 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"}, proxyEnabled: true, proxyDirectives: []string{}} caddyForwardProxyNoBlacklistOverride.StartTestServer() diff --git a/probe_resist_test.go b/probe_resist_test.go index a2558d6..e74adf9 100644 --- a/probe_resist_test.go +++ b/probe_resist_test.go @@ -197,10 +197,6 @@ func TestConnectAuthWrongProbeResist(t *testing.T) { if err != nil { 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 { t.Fatal(err) }