Use the loopback address for connecting to an in-process web server

This may resolve the connection issues we sometimes see in GitHub
Actions where the Maven process that is being tested cannot connect
to the Jetty server that was just started.

This closes #107
This commit is contained in:
Maarten Mulders 2021-04-19 16:59:24 +02:00 committed by Michael Osipov
parent aea9276d50
commit d139dd68f7
3 changed files with 4 additions and 4 deletions

View File

@ -86,7 +86,7 @@ public class MavenIT0146InstallerSnapshotNaming
Verifier verifier = newVerifier( testDir.getAbsolutePath() ); Verifier verifier = newVerifier( testDir.getAbsolutePath() );
Properties properties = verifier.newDefaultFilterProperties(); Properties properties = verifier.newDefaultFilterProperties();
properties.setProperty( "@host@", InetAddress.getLocalHost().getCanonicalHostName() ); properties.setProperty( "@host@", InetAddress.getLoopbackAddress().getCanonicalHostName() );
properties.setProperty( "@port@", Integer.toString( port ) ); properties.setProperty( "@port@", Integer.toString( port ) );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties );
@ -125,7 +125,7 @@ public class MavenIT0146InstallerSnapshotNaming
verifier = newVerifier( testDir.getAbsolutePath() ); verifier = newVerifier( testDir.getAbsolutePath() );
Properties properties = verifier.newDefaultFilterProperties(); Properties properties = verifier.newDefaultFilterProperties();
properties.setProperty( "@host@", InetAddress.getLocalHost().getCanonicalHostName() ); properties.setProperty( "@host@", InetAddress.getLoopbackAddress().getCanonicalHostName() );
properties.setProperty( "@port@", Integer.toString( port ) ); properties.setProperty( "@port@", Integer.toString( port ) );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties );

View File

@ -119,7 +119,7 @@ public class MavenITmng2387InactiveProxyTest
Verifier verifier = newVerifier( testDir.getAbsolutePath() ); Verifier verifier = newVerifier( testDir.getAbsolutePath() );
Properties properties = verifier.newDefaultFilterProperties(); Properties properties = verifier.newDefaultFilterProperties();
properties.setProperty( "@host@", InetAddress.getLocalHost().getCanonicalHostName() ); properties.setProperty( "@host@", InetAddress.getLoopbackAddress().getCanonicalHostName() );
properties.setProperty( "@port@", Integer.toString( port ) ); properties.setProperty( "@port@", Integer.toString( port ) );
properties.setProperty( "@proxyPort@", Integer.toString( proxyPort ) ); properties.setProperty( "@proxyPort@", Integer.toString( proxyPort ) );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties );

View File

@ -93,7 +93,7 @@ public class MavenITmng4991NonProxyHostsTest
filterProps.setProperty( "@port@", Integer.toString( port ) ); filterProps.setProperty( "@port@", Integer.toString( port ) );
int proxyPort = ( (NetworkConnector) proxy.getConnectors()[0] ).getLocalPort(); int proxyPort = ( (NetworkConnector) proxy.getConnectors()[0] ).getLocalPort();
filterProps.setProperty( "@proxyPort@", Integer.toString( proxyPort ) ); filterProps.setProperty( "@proxyPort@", Integer.toString( proxyPort ) );
filterProps.setProperty( "@localhost@", InetAddress.getLocalHost().getCanonicalHostName() ); filterProps.setProperty( "@localhost@", InetAddress.getLoopbackAddress().getCanonicalHostName() );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps ); verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
verifier.addCliOption( "-s" ); verifier.addCliOption( "-s" );
verifier.addCliOption( "settings.xml" ); verifier.addCliOption( "settings.xml" );