From 9504d3aa6201374a4d6e6ed0bf0a260f23f41a68 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 30 Oct 2023 11:38:01 +0100 Subject: [PATCH] test: verifies downloads through https proxies Signed-off-by: Marc Nuri --- src/it/https-proxy/invoker.properties | 1 + src/it/https-proxy/pom.xml | 37 +++++++++++++++++++++++++++ src/it/https-proxy/setup.groovy | 2 ++ src/it/https-proxy/verify.groovy | 9 +++++++ 4 files changed, 49 insertions(+) create mode 100644 src/it/https-proxy/invoker.properties create mode 100644 src/it/https-proxy/pom.xml create mode 100644 src/it/https-proxy/setup.groovy create mode 100644 src/it/https-proxy/verify.groovy diff --git a/src/it/https-proxy/invoker.properties b/src/it/https-proxy/invoker.properties new file mode 100644 index 0000000..4a9b66c --- /dev/null +++ b/src/it/https-proxy/invoker.properties @@ -0,0 +1 @@ +invoker.goals.1=verify -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128 diff --git a/src/it/https-proxy/pom.xml b/src/it/https-proxy/pom.xml new file mode 100644 index 0000000..7f86e8d --- /dev/null +++ b/src/it/https-proxy/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + com.marcnuri.plugins.it + no-action + 0.1-SNAPSHOT + Maven Integration Test :: Gradle API :: No Action + + + + org.codehaus.groovy + groovy-all + ${version.groovy} + pom + provided + + + org.gradle + gradle-all + ${version.gradle.8} + provided + + + + + + + com.marcnuri.plugins + gradle-api-maven-plugin + @project.version@ + true + + + + diff --git a/src/it/https-proxy/setup.groovy b/src/it/https-proxy/setup.groovy new file mode 100644 index 0000000..abc8316 --- /dev/null +++ b/src/it/https-proxy/setup.groovy @@ -0,0 +1,2 @@ +def proc = 'docker run --rm -d --name test-proxy -p 0.0.0.0:3128:3128 ubuntu/squid:5.2-22.04_beta'.execute() +proc.waitForOrKill(30000) diff --git a/src/it/https-proxy/verify.groovy b/src/it/https-proxy/verify.groovy new file mode 100644 index 0000000..7cfe667 --- /dev/null +++ b/src/it/https-proxy/verify.groovy @@ -0,0 +1,9 @@ +def logOut = new StringBuilder(), logErr = new StringBuilder() +def dockerLogs = 'docker logs test-proxy'.execute() +dockerLogs.consumeProcessOutput(logOut, logErr) +dockerLogs.waitForOrKill(1000) +def dockerStop = 'docker stop test-proxy'.execute() +dockerStop.waitForOrKill(30000) +assert logOut.toString().contains('CONNECT services.gradle.org:443') +def buildLog = new File(basedir, 'build.log').text +assert buildLog.contains('Gradle 8.2.1 download complete')