Skip to content

Fix failing Github Actions Tests #1753

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

Merged
merged 4 commits into from
Dec 12, 2020
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
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ public void asyncOptionsTest() throws Throwable {

final AtomicReference<HttpHeaders> responseHeaders = new AtomicReference<>();

// Some responses contain the TRACE method, some do not - account for both
// FIXME: Actually refactor this test to account for both cases
final String[] expected = {"GET", "HEAD", "OPTIONS", "POST"};
final String[] expectedWithTrace = {"GET", "HEAD", "OPTIONS", "POST", "TRACE"};
Future<String> f = client.prepareOptions("http://www.apache.org/").execute(new AsyncHandlerAdapter() {

@Override
Expand All @@ -455,10 +458,16 @@ public String onCompleted() {
HttpHeaders h = responseHeaders.get();
assertNotNull(h);
String[] values = h.get(ALLOW).split(",|, ");
assertNotNull(values);
assertEquals(values.length, expected.length);
assertNotNull(values);
// Some responses contain the TRACE method, some do not - account for both
assert(values.length == expected.length || values.length == expectedWithTrace.length);
Arrays.sort(values);
assertEquals(values, expected);
// Some responses contain the TRACE method, some do not - account for both
if(values.length == expected.length) {
assertEquals(values, expected);
} else {
assertEquals(values, expectedWithTrace);
}
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testMaxTotalConnectionsExceedingException() throws IOException {

@Test(groups = "online")
public void testMaxTotalConnections() throws Exception {
String[] urls = new String[]{"https://google.com", "https://github.com"};
String[] urls = new String[]{"https://www.google.com", "https://www.youtube.com"};

final CountDownLatch latch = new CountDownLatch(2);
final AtomicReference<Throwable> ex = new AtomicReference<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.testng.annotations.Test;

import java.net.UnknownHostException;
import java.net.ConnectException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -70,11 +71,14 @@ public void onEmptyListenerTest() throws Exception {
}
}

@Test(timeOut = 60000, expectedExceptions = UnknownHostException.class)
@Test(timeOut = 60000, expectedExceptions = {UnknownHostException.class, ConnectException.class})
public void onFailureTest() throws Throwable {
try (AsyncHttpClient c = asyncHttpClient()) {
c.prepareGet("ws://abcdefg").execute(new WebSocketUpgradeHandler.Builder().build()).get();
} catch (ExecutionException e) {

String expectedMessage = "DNS name not found";
assertTrue(e.getCause().toString().contains(expectedMessage));
throw e.getCause();
}
}
Expand Down