Skip to content

Commit 0773bf5

Browse files
authored
Merge pull request #44913 from holly-cummins/fix-test-that-needs-network
Add guard on test that network is available
2 parents 6a487f0 + 87817c6 commit 0773bf5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/deployment/pkg/builditem/GeneratedResourceBuildItemTest.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
import java.io.IOException;
77
import java.io.InputStream;
88
import java.io.InputStreamReader;
9+
import java.net.InetAddress;
910
import java.net.URL;
11+
import java.net.UnknownHostException;
1012
import java.nio.charset.StandardCharsets;
1113
import java.util.Collections;
1214
import java.util.List;
1315

16+
import org.junit.jupiter.api.Assumptions;
1417
import org.junit.jupiter.api.Test;
1518
import org.junit.jupiter.api.extension.RegisterExtension;
1619

@@ -35,7 +38,8 @@ class GeneratedResourceBuildItemTest {
3538
Dependency.of("org.apache.cxf", "cxf-rt-bindings-soap", "3.4.3")));
3639

3740
@Test
38-
public void testXMLResourceWasMerged() throws IOException {
41+
public void testXMLResourceWasMerged() {
42+
Assumptions.assumeTrue(isOnline());
3943
assertThat(runner.getStartupConsoleOutput()).contains("RESOURCES: 1",
4044
"<entry key=\"xml-javax.wsdl.Port\">org.apache.cxf.binding.xml.wsdl11.HttpAddressPlugin</entry>",
4145
"<entry key=\"xml-javax.wsdl.Binding\">org.apache.cxf.binding.xml.wsdl11.XmlBindingPlugin</entry>",
@@ -58,4 +62,13 @@ public static void main(String[] args) throws IOException {
5862
}
5963
}
6064
}
65+
66+
boolean isOnline() {
67+
try {
68+
InetAddress resolved = InetAddress.getByName("sun.com");
69+
return resolved != null;
70+
} catch (UnknownHostException e) {
71+
return false;
72+
}
73+
}
6174
}

0 commit comments

Comments
 (0)