You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/06/11 20:44:29 UTC
[maven-surefire] 02/02: printing /etc/hosts and network interfaces
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch macos
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 868171c2b40e68aca0fad02c88f6d7560a22500f
Author: tibordigana <ti...@apache.org>
AuthorDate: Thu Jun 11 22:44:17 2020 +0200
printing /etc/hosts and network interfaces
---
.github/workflows/maven.yml | 2 +-
.github/workflows/smoketest.yml | 2 +-
Jenkinsfile | 4 +--
surefire-logger-api/pom.xml | 4 ++-
.../surefire/log/api/ConsoleLoggerUtilsTest.java | 35 ++++++++++++++++++++++
5 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 1cfd2e3..c6dc8ca 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -39,4 +39,4 @@ jobs:
java-version: 14
- name: Build with Maven
- run: mvn install -e -B -V -nsu --no-transfer-progress -P run-its
+ run: mvn test -e -B -V -nsu --no-transfer-progress --projects surefire-logger-api
diff --git a/.github/workflows/smoketest.yml b/.github/workflows/smoketest.yml
index 7500579..2f25c92 100644
--- a/.github/workflows/smoketest.yml
+++ b/.github/workflows/smoketest.yml
@@ -33,4 +33,4 @@ jobs:
java-version: 14
- name: Build with Maven
- run: mvn install -e -B -V -nsu --no-transfer-progress -P run-its -DskipITs
+ run: mvn test -e -B -V -nsu --no-transfer-progress --projects surefire-logger-api
diff --git a/Jenkinsfile b/Jenkinsfile
index 6508b37..b5249fd 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,8 +36,8 @@ final def mavens = env.BRANCH_NAME == 'master' ? ['3.6.x', '3.2.x'] : ['3.6.x']
final def jdks = [15, 14, 11, 8, 7]
final def options = ['-e', '-V', '-B', '-nsu', '-P', 'run-its']
-final def goals = ['clean', 'install']
-final def goalsDepl = ['clean', 'deploy', 'jacoco:report']
+final def goals = ['clean']
+final def goalsDepl = ['clean']
final Map stages = [:]
oses.eachWithIndex { osMapping, indexOfOs ->
diff --git a/surefire-logger-api/pom.xml b/surefire-logger-api/pom.xml
index 3bb3e84..5e5b542 100644
--- a/surefire-logger-api/pom.xml
+++ b/surefire-logger-api/pom.xml
@@ -78,9 +78,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
+<!-- <useFile>true</useFile>-->
+ <redirectTestOutputToFile>false</redirectTestOutputToFile>
<argLine>${jvm.args.tests} ${jacoco.agent}</argLine>
<includes>
- <include>**/JUnit4SuiteTest.java</include>
+ <include>ConsoleLoggerUtilsTest</include>
</includes>
</configuration>
<dependencies>
diff --git a/surefire-logger-api/src/test/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtilsTest.java b/surefire-logger-api/src/test/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtilsTest.java
index 902a17e..5428a9d 100644
--- a/surefire-logger-api/src/test/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtilsTest.java
+++ b/surefire-logger-api/src/test/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtilsTest.java
@@ -23,6 +23,11 @@ import org.junit.Test;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Enumeration;
import static org.fest.assertions.Assertions.assertThat;
@@ -32,6 +37,36 @@ import static org.fest.assertions.Assertions.assertThat;
public class ConsoleLoggerUtilsTest
{
@Test
+ public void testMacOS() throws Exception
+ {
+ System.out.println( "localhost: " + InetAddress.getLocalHost() );
+ Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
+ while ( nets.hasMoreElements() )
+ {
+ NetworkInterface net = nets.nextElement();
+ if ( !net.isUp() )
+ {
+ continue;
+ }
+ System.out.println( "NetworkInterface: " + net.toString() + ", addresses=" + net.getInetAddresses()
+ + ", up=" + net.isUp() + ", virtual=" + net.isVirtual() + ", loopback=" + net.isLoopback() );
+ System.out.println( "InetAddresses:" );
+ for ( Enumeration<InetAddress> inets = net.getInetAddresses(); inets.hasMoreElements(); )
+ {
+ InetAddress addr = inets.nextElement();
+ System.out.println( addr + " (anylocalAddr=" + addr.isAnyLocalAddress()
+ + ", loopback=" + addr.isLoopbackAddress() + ", linkLocalAddr=" + addr.isLinkLocalAddress()
+ + ", siteLocalAddr=" + addr.isSiteLocalAddress() + ")" );
+ }
+ }
+
+ byte[] content = Files.readAllBytes( Paths.get( "/etc", "hosts" ) );
+ System.out.println( "The content of '/etc/hosts'" );
+ System.out.println( new String( content ) );
+
+ }
+
+ @Test
public void shouldPrintStacktraceAsString()
{
Exception e = new IllegalArgumentException( "wrong param" );