@@ -56,7 +56,7 @@ func TestProxiedEnvironment(t *testing.T) {
56
56
}
57
57
58
58
t .Cleanup (func () {
59
- outputTCPDeniedLogs (t , tc )
59
+ failOnProxyTCPDenied (t , tc )
60
60
})
61
61
62
62
// bootstrap the first node and makes sure it is healthy. also executes the kots
@@ -147,7 +147,7 @@ func TestProxiedCustomCIDR(t *testing.T) {
147
147
}
148
148
149
149
t .Cleanup (func () {
150
- outputTCPDeniedLogs (t , tc )
150
+ failOnProxyTCPDenied (t , tc )
151
151
})
152
152
153
153
// bootstrap the first node and makes sure it is healthy. also executes the kots
@@ -246,7 +246,7 @@ func TestInstallWithMITMProxy(t *testing.T) {
246
246
}
247
247
248
248
t .Cleanup (func () {
249
- outputTCPDeniedLogs (t , tc )
249
+ failOnProxyTCPDenied (t , tc )
250
250
})
251
251
252
252
// bootstrap the first node and makes sure it is healthy. also executes the kots
@@ -288,11 +288,15 @@ func TestInstallWithMITMProxy(t *testing.T) {
288
288
t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
289
289
}
290
290
291
- func outputTCPDeniedLogs (t * testing.T , tc * lxd.Cluster ) {
292
- stdout , _ , err := tc .RunCommandOnProxyNode (t , []string {"sh" , "-c" , "grep -A4 -B4 TCP_DENIED /var/log/squid/access.log || true" })
291
+ func failOnProxyTCPDenied (t * testing.T , tc * lxd.Cluster ) {
292
+ line := []string {"sh" , "-c" , `grep -A1 TCP_DENIED /var/log/squid/access.log | grep -v speedtest\.net` }
293
+ stdout , _ , err := tc .RunCommandOnProxyNode (t , line )
293
294
if err != nil {
294
295
t .Fatalf ("fail to check squid access log: %v" , err )
295
296
}
296
297
t .Logf ("TCP_DENIED logs:" )
297
298
t .Log (stdout )
299
+ if strings .Contains (stdout , "TCP_DENIED" ) {
300
+ t .Fatalf ("TCP_DENIED logs found" )
301
+ }
298
302
}
0 commit comments