forked from asciidoctor/asciidoctor-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test): use a random available port on http test
Instead of using the default mojo port (2000) during http test, find the first available port on the host an use it during tests.
- Loading branch information
1 parent
8ed7f8b
commit 69999c5
Showing
2 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/groovy/org/asciidoctor/maven/test/AsciidoctorMojoTestHelper.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.asciidoctor.maven.test | ||
|
||
class AsciidoctorMojoTestHelper { | ||
def getAvailablePort() { | ||
ServerSocket socket = new ServerSocket(0) | ||
def port = socket.getLocalPort() | ||
socket.close() | ||
return port | ||
} | ||
} |