Skip to content

Commit 7ec7e76

Browse files
committed
test: use modern Squid Proxy with Authentication container image
Signed-off-by: Marc Nuri <[email protected]>
1 parent 57b7d2d commit 7ec7e76

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
def dockerRun = 'docker run --rm -d --name test-auth-proxy -e SQUID_USERNAME=foo -e SQUID_PASSWORD=bar -p 0.0.0.0:3128:3128 robhaswell/squid-authenticated@sha256:6a99946c96d063981b329c22efc2b9ad1ac4e90d16ddcbb9d0b2d6773a7bea2b'.execute()
1+
def dockerRun = 'docker run --rm -d --name test-auth-proxy -e SQUID_USERNAME=foo -e SQUID_PASSWORD=bar -p 0.0.0.0:3128:3128 marcnuri/squid-simple-auth:latest'.execute()
22
dockerRun.waitForOrKill(30_000)
3+
def count = 10
4+
def ready = false
5+
while(count-- > 0 && !ready) {
6+
def logOut = new StringBuilder(), logErr = new StringBuilder()
7+
def dockerLogs = 'docker logs test-auth-proxy'.execute()
8+
dockerLogs.consumeProcessOutput(logOut, logErr)
9+
dockerLogs.waitForOrKill(10_000)
10+
if (logOut.contains('Accepting HTTP Socket connections')) {
11+
ready = true
12+
}
13+
Thread.sleep(1000)
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
def logOut = new StringBuilder(), logErr = new StringBuilder()
2-
def dockerLogs = 'docker exec test-auth-proxy cat /var/log/squid3/access.log'.execute()
2+
def dockerLogs = 'docker exec test-auth-proxy cat /opt/squid/access.log'.execute()
33
dockerLogs.consumeProcessOutput(logOut, logErr)
44
dockerLogs.waitForOrKill(10_000)
55
def dockerStop = 'docker stop test-auth-proxy'.execute()
66
dockerStop.waitForOrKill(30_000)
7+
new FileWriter(new File(basedir, 'access.log')).withWriter { it << logOut }
78
assert logOut.toString().contains('CONNECT services.gradle.org:443')
89
def buildLog = new File(basedir, 'build.log').text
910
assert buildLog.contains('Gradle 8.2.1 download complete')
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
def dockerRun = 'docker run --rm -d --name test-auth-proxy -e SQUID_USERNAME=foo -e SQUID_PASSWORD=bar -p 0.0.0.0:3128:3128 robhaswell/squid-authenticated@sha256:6a99946c96d063981b329c22efc2b9ad1ac4e90d16ddcbb9d0b2d6773a7bea2b'.execute()
1+
def dockerRun = 'docker run --rm -d --name test-auth-proxy -e SQUID_USERNAME=foo -e SQUID_PASSWORD=bar -p 0.0.0.0:3128:3128 marcnuri/squid-simple-auth:latest'.execute()
22
dockerRun.waitForOrKill(30_000)
3+
def count = 10
4+
def ready = false
5+
while(count-- > 0 && !ready) {
6+
def logOut = new StringBuilder(), logErr = new StringBuilder()
7+
def dockerLogs = 'docker logs test-auth-proxy'.execute()
8+
dockerLogs.consumeProcessOutput(logOut, logErr)
9+
dockerLogs.waitForOrKill(10_000)
10+
if (logOut.contains('Accepting HTTP Socket connections')) {
11+
ready = true
12+
}
13+
Thread.sleep(1000)
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
def logOut = new StringBuilder(), logErr = new StringBuilder()
2-
def dockerLogs = 'docker exec test-auth-proxy cat /var/log/squid3/access.log'.execute()
2+
def dockerLogs = 'docker exec test-auth-proxy cat /opt/squid/access.log'.execute()
33
dockerLogs.consumeProcessOutput(logOut, logErr)
44
dockerLogs.waitForOrKill(10_000)
55
def dockerStop = 'docker stop test-auth-proxy'.execute()
66
dockerStop.waitForOrKill(30_000)
7+
new FileWriter(new File(basedir, 'access.log')).withWriter { it << logOut }
78
assert logOut.toString().contains('CONNECT services.gradle.org:443')
89
def buildLog = new File(basedir, 'build.log').text
910
assert buildLog.contains('Gradle 8.2.1 download complete')

src/it/system.properties.https-proxy/verify.groovy

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dockerLogs.consumeProcessOutput(logOut, logErr)
44
dockerLogs.waitForOrKill(10_000)
55
def dockerStop = 'docker stop test-proxy'.execute()
66
dockerStop.waitForOrKill(30_000)
7+
new FileWriter(new File(basedir, 'access.log')).withWriter { it << logOut }
78
assert logOut.toString().contains('CONNECT services.gradle.org:443')
89
def buildLog = new File(basedir, 'build.log').text
910
assert buildLog.contains('Gradle 8.2.1 download complete')

0 commit comments

Comments
 (0)