Skip to content

Commit 77cd5d8

Browse files
committed
Fix up the tests after TLS changes in Caddy
1 parent ae59fae commit 77cd5d8

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

common_test.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -130,39 +130,39 @@ func (c *caddyTestServer) StartTestServer() {
130130
}
131131

132132
func TestMain(m *testing.M) {
133-
caddyForwardProxy = caddyTestServer{addr: "127.0.0.2:1984", root: "./test/forwardproxy",
133+
caddyForwardProxy = caddyTestServer{addr: "127.0.19.84:1984", root: "./test/forwardproxy",
134134
directives: []string{"tls self_signed"},
135135
proxyEnabled: true, proxyDirectives: []string{"serve_pac",
136136
"acl {\nallow all\n}"}}
137137
caddyForwardProxy.StartTestServer()
138138

139-
caddyForwardProxyAuth = caddyTestServer{addr: "127.0.0.2:4891", root: "./test/forwardproxy",
139+
caddyForwardProxyAuth = caddyTestServer{addr: "127.0.0.1:4891", root: "./test/forwardproxy",
140140
directives: []string{"tls self_signed"},
141141
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
142142
"acl {\nallow all\n}"}}
143143
caddyForwardProxyAuth.StartTestServer()
144144

145-
caddyHTTPForwardProxyAuth = caddyTestServer{addr: "127.0.0.2:6973", root: "./test/forwardproxy",
145+
caddyHTTPForwardProxyAuth = caddyTestServer{addr: "127.0.69.73:6973", root: "./test/forwardproxy",
146146
directives: []string{"tls off"},
147147
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
148148
"acl {\nallow all\n}"}}
149149
caddyHTTPForwardProxyAuth.StartTestServer()
150150

151-
caddyForwardProxyProbeResist = caddyTestServer{addr: "127.0.0.2:8888", root: "./test/forwardproxy",
151+
caddyForwardProxyProbeResist = caddyTestServer{addr: "127.0.88.88:8888", root: "./test/forwardproxy",
152152
directives: []string{"tls self_signed"}, HTTPRedirectPort: "8880",
153153
proxyEnabled: true, proxyDirectives: []string{"basicauth test pass",
154154
"probe_resistance test.localhost",
155155
"serve_pac superhiddenfile.pac",
156156
"acl {\nallow all\n}"}}
157157
caddyForwardProxyProbeResist.StartTestServer()
158158

159-
caddyDummyProbeResist = caddyTestServer{addr: "127.0.0.2:9999", root: "./test/forwardproxy",
159+
caddyDummyProbeResist = caddyTestServer{addr: "127.0.99.99:9999", root: "./test/forwardproxy",
160160
directives: []string{"tls self_signed"}, HTTPRedirectPort: "9980",
161161
proxyEnabled: false}
162162
caddyDummyProbeResist.StartTestServer()
163163

164164
// 127.0.0.1 and localhost are both used to avoid Caddy matching and routing proxy requests internally
165-
caddyTestTarget = caddyTestServer{addr: "localhost:6451", root: "./test/index",
165+
caddyTestTarget = caddyTestServer{addr: "127.0.64.51:6451", root: "./test/index",
166166
directives: []string{},
167167
proxyEnabled: false}
168168
caddyTestTarget.StartTestServer()
@@ -172,26 +172,26 @@ func TestMain(m *testing.M) {
172172
proxyEnabled: false}
173173
caddyHTTPTestTarget.StartTestServer()
174174

175-
caddyAuthedUpstreamEnter = caddyTestServer{addr: "127.0.0.2:6585", root: "./test/upstreamingproxy",
175+
caddyAuthedUpstreamEnter = caddyTestServer{addr: "127.0.65.25:6585", root: "./test/upstreamingproxy",
176176
directives: []string{"tls self_signed"},
177177
proxyEnabled: true, proxyDirectives: []string{"upstream https://test:[email protected]:4891",
178178
"basicauth upstreamtest upstreampass"}}
179179
caddyAuthedUpstreamEnter.StartTestServer()
180180

181-
caddyForwardProxyWhiteListing = caddyTestServer{addr: "127.0.0.2:8776", root: "./test/forwardproxy",
181+
caddyForwardProxyWhiteListing = caddyTestServer{addr: "127.0.87.76:8776", root: "./test/forwardproxy",
182182
directives: []string{"tls self_signed"},
183-
proxyEnabled: true, proxyDirectives: []string{"acl {\nallow localhost\n deny all\n}",
183+
proxyEnabled: true, proxyDirectives: []string{"acl {\nallow 127.0.64.51\n deny all\n}",
184184
"ports 6451"}}
185185
caddyForwardProxyWhiteListing.StartTestServer()
186186

187-
caddyForwardProxyBlackListing = caddyTestServer{addr: "127.0.0.2:6676", root: "./test/forwardproxy",
187+
caddyForwardProxyBlackListing = caddyTestServer{addr: "127.0.66.76:6676", root: "./test/forwardproxy",
188188
directives: []string{"tls self_signed"},
189189
proxyEnabled: true, proxyDirectives: []string{"acl {\ndeny " + blacklistedIPv4 + "/30\n" +
190190
"deny " + blacklistedIPv6 + "\nallow all\n}"},
191191
}
192192
caddyForwardProxyBlackListing.StartTestServer()
193193

194-
caddyForwardProxyNoBlacklistOverride = caddyTestServer{addr: "127.0.0.2:6679", root: "./test/forwardproxy",
194+
caddyForwardProxyNoBlacklistOverride = caddyTestServer{addr: "127.0.66.79:6679", root: "./test/forwardproxy",
195195
directives: []string{"tls self_signed"},
196196
proxyEnabled: true, proxyDirectives: []string{}}
197197
caddyForwardProxyNoBlacklistOverride.StartTestServer()

probe_resist_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ func TestConnectAuthWrongProbeResist(t *testing.T) {
197197
if err != nil {
198198
t.Fatal(err)
199199
}
200-
if responseProbeResist.StatusCode != http.StatusOK {
201-
t.Fatalf("Expected response: 200 StatusOK, Got: %d\n",
202-
responseProbeResist.StatusCode)
203-
}
204200
if err = responsesAreEqual(responseProbeResist, responseReference); err != nil {
205201
t.Fatal(err)
206202
}

0 commit comments

Comments
 (0)