Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verifies downloads through https proxies #12

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/it/https-proxy/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals.1=verify -U -Dhttps.proxyHost=localhost -Dhttps.proxyPort=3128
37 changes: 37 additions & 0 deletions src/it/https-proxy/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.marcnuri.plugins.it</groupId>
<artifactId>no-action</artifactId>
<version>0.1-SNAPSHOT</version>
<name>Maven Integration Test :: Gradle API :: HTTPS Proxy</name>

<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${version.groovy}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-all</artifactId>
<version>${version.gradle.8}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.marcnuri.plugins</groupId>
<artifactId>gradle-api-maven-plugin</artifactId>
<version>@project.version@</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
14 changes: 14 additions & 0 deletions src/it/https-proxy/setup.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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(30_000)
def count = 10
def ready = false
while(count-- > 0 && !ready) {
def logOut = new StringBuilder(), logErr = new StringBuilder()
def dockerLogs = 'docker logs test-proxy'.execute()
dockerLogs.consumeProcessOutput(logOut, logErr)
dockerLogs.waitForOrKill(10_000)
if (logOut.contains('Accepting HTTP Socket connections')) {
ready = true
}
Thread.sleep(1000)
}
9 changes: 9 additions & 0 deletions src/it/https-proxy/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def logOut = new StringBuilder(), logErr = new StringBuilder()
def dockerLogs = 'docker logs test-proxy'.execute()
dockerLogs.consumeProcessOutput(logOut, logErr)
dockerLogs.waitForOrKill(10_000)
def dockerStop = 'docker stop test-proxy'.execute()
dockerStop.waitForOrKill(30_000)
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')