Skip to content

Commit

Permalink
Move to postman-echo.com from httpbin.org (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed May 22, 2023
1 parent 98e095c commit cbda6d3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 48 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs'

env:
BUILDER_VERSION: v0.9.40
BUILDER_VERSION: v0.9.43
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-crt-java
Expand All @@ -20,7 +20,7 @@ env:

jobs:
linux-compat:
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
strategy:
matrix:
image:
Expand All @@ -42,7 +42,7 @@ jobs:
./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ matrix.image }} build -p ${{ env.PACKAGE_NAME }}
linux-compiler-compat:
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
strategy:
matrix:
compiler:
Expand All @@ -69,7 +69,7 @@ jobs:
linux-arm:
name: ARM (${{ matrix.arch }})
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
strategy:
matrix:
arch: [armv6, armv7, arm64]
Expand All @@ -81,7 +81,7 @@ jobs:
./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream
raspberry:
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream
osx: # With integration tests
runs-on: macos-11 # latest
runs-on: macos-13 # latest
steps:
- name: Checkout Sources
uses: actions/checkout@v3
Expand All @@ -140,7 +140,7 @@ jobs:
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
osx-arm64:
runs-on: macos-11 # latest
runs-on: macos-13 # latest
steps:
- name: Checkout Sources
uses: actions/checkout@v3
Expand All @@ -154,7 +154,7 @@ jobs:
python3 codebuild/macos_compatibility_check.py armv8
osx-x64:
runs-on: macos-11
runs-on: macos-13
steps:
- name: Checkout Sources
uses: actions/checkout@v2
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
# check that docs can still build
check-docs:
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -192,7 +192,7 @@ jobs:
./make-docs.sh
check-submodules:
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
Expand All @@ -206,7 +206,7 @@ jobs:


localhost-test-linux:
runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-22.04 # latest
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -224,7 +224,7 @@ jobs:
python builder.pyz localhost-test -p ${{ env.PACKAGE_NAME }} --spec=downstream
localhost-test-mac:
runs-on: macos-11 # latest
runs-on: macos-13 # latest
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class Http2ClientConnectionTest extends HttpClientTestFixture {

private final static String HOST = "https://httpbin.org";
private final static String HOST = "https://postman-echo.com";
private final static HttpVersion EXPECTED_VERSION = HttpVersion.HTTP_2;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.concurrent.TimeUnit;

public class Http2RequestResponseTest extends HttpRequestResponseFixture {
private final static String HOST = "https://httpbin.org";
private final static String HOST = "https://postman-echo.com";
private final static HttpVersion EXPECTED_VERSION = HttpVersion.HTTP_2;

private Http2Request getHttp2Request(String method, String endpoint, String path, String requestBody)
Expand Down Expand Up @@ -114,27 +114,27 @@ public TestHttpResponse testHttp2Request(String method, String endpoint, String
@Test
public void testHttp2Get() throws Exception {
Assume.assumeTrue(System.getProperty("NETWORK_TESTS_DISABLED") == null);
testHttp2Request("GET", HOST, "/delete", EMPTY_BODY, 405);
testHttp2Request("GET", HOST, "/delete", EMPTY_BODY, 404);
testHttp2Request("GET", HOST, "/get", EMPTY_BODY, 200);
testHttp2Request("GET", HOST, "/post", EMPTY_BODY, 405);
testHttp2Request("GET", HOST, "/put", EMPTY_BODY, 405);
testHttp2Request("GET", HOST, "/post", EMPTY_BODY, 404);
testHttp2Request("GET", HOST, "/put", EMPTY_BODY, 404);
}

@Test
public void testHttp2Post() throws Exception {
skipIfNetworkUnavailable();
testHttp2Request("POST", HOST, "/delete", EMPTY_BODY, 405);
testHttp2Request("POST", HOST, "/get", EMPTY_BODY, 405);
testHttp2Request("POST", HOST, "/delete", EMPTY_BODY, 404);
testHttp2Request("POST", HOST, "/get", EMPTY_BODY, 404);
testHttp2Request("POST", HOST, "/post", EMPTY_BODY, 200);
testHttp2Request("POST", HOST, "/put", EMPTY_BODY, 405);
testHttp2Request("POST", HOST, "/put", EMPTY_BODY, 404);
}

@Test
public void testHttp2Put() throws Exception {
skipIfNetworkUnavailable();
testHttp2Request("PUT", HOST, "/delete", EMPTY_BODY, 405);
testHttp2Request("PUT", HOST, "/get", EMPTY_BODY, 405);
testHttp2Request("PUT", HOST, "/post", EMPTY_BODY, 405);
testHttp2Request("PUT", HOST, "/delete", EMPTY_BODY, 404);
testHttp2Request("PUT", HOST, "/get", EMPTY_BODY, 404);
testHttp2Request("PUT", HOST, "/post", EMPTY_BODY, 404);
testHttp2Request("PUT", HOST, "/put", EMPTY_BODY, 200);
}

Expand Down Expand Up @@ -202,6 +202,9 @@ public void onResponseComplete(HttpStreamBase stream, int errorCode) {
h2Stream.activate();
streamComplete.get();
}
catch(Exception e) {
// ignoring the exception as it might fail that RST_STREAM has been sent.
}
}
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.concurrent.TimeUnit;

public class HttpRequestResponseTest extends HttpRequestResponseFixture {
private final static String HOST = "https://postman-echo.com";

public TestHttpResponse testRequest(String method, String endpoint, String path, String requestBody,
boolean useChunkedEncoding, int expectedStatus) throws Exception {
Expand Down Expand Up @@ -108,46 +109,46 @@ public boolean resetPosition() {
@Test
public void testHttpDelete() throws Exception {
skipIfNetworkUnavailable();
testRequest("DELETE", "https://httpbin.org", "/delete", EMPTY_BODY, false, 200);
testRequest("DELETE", "https://httpbin.org", "/get", EMPTY_BODY, false, 405);
testRequest("DELETE", "https://httpbin.org", "/post", EMPTY_BODY, false, 405);
testRequest("DELETE", "https://httpbin.org", "/put", EMPTY_BODY, false, 405);
testRequest("DELETE", HOST, "/delete", EMPTY_BODY, false, 200);
testRequest("DELETE", HOST, "/get", EMPTY_BODY, false, 404);
testRequest("DELETE", HOST, "/post", EMPTY_BODY, false, 404);
testRequest("DELETE", HOST, "/put", EMPTY_BODY, false, 404);
}

@Test
public void testHttpGet() throws Exception {
skipIfNetworkUnavailable();
testRequest("GET", "https://httpbin.org", "/delete", EMPTY_BODY, false, 405);
testRequest("GET", "https://httpbin.org", "/get", EMPTY_BODY, false, 200);
testRequest("GET", "https://httpbin.org", "/post", EMPTY_BODY, false, 405);
testRequest("GET", "https://httpbin.org", "/put", EMPTY_BODY, false, 405);
testRequest("GET", HOST, "/delete", EMPTY_BODY, false, 404);
testRequest("GET", HOST, "/get", EMPTY_BODY, false, 200);
testRequest("GET", HOST, "/post", EMPTY_BODY, false, 404);
testRequest("GET", HOST, "/put", EMPTY_BODY, false, 404);
}

@Test
public void testHttpPost() throws Exception {
skipIfNetworkUnavailable();
testRequest("POST", "https://httpbin.org", "/delete", EMPTY_BODY, false, 405);
testRequest("POST", "https://httpbin.org", "/get", EMPTY_BODY, false, 405);
testRequest("POST", "https://httpbin.org", "/post", EMPTY_BODY, false, 200);
testRequest("POST", "https://httpbin.org", "/put", EMPTY_BODY, false, 405);
testRequest("POST", HOST, "/delete", EMPTY_BODY, false, 404);
testRequest("POST", HOST, "/get", EMPTY_BODY, false, 404);
testRequest("POST", HOST, "/post", EMPTY_BODY, false, 200);
testRequest("POST", HOST, "/put", EMPTY_BODY, false, 404);
}

@Test
public void testHttpPut() throws Exception {
skipIfNetworkUnavailable();
testRequest("PUT", "https://httpbin.org", "/delete", EMPTY_BODY, false, 405);
testRequest("PUT", "https://httpbin.org", "/get", EMPTY_BODY, false, 405);
testRequest("PUT", "https://httpbin.org", "/post", EMPTY_BODY, false, 405);
testRequest("PUT", "https://httpbin.org", "/put", EMPTY_BODY, false, 200);
testRequest("PUT", HOST, "/delete", EMPTY_BODY, false, 404);
testRequest("PUT", HOST, "/get", EMPTY_BODY, false, 404);
testRequest("PUT", HOST, "/post", EMPTY_BODY, false, 404);
testRequest("PUT", HOST, "/put", EMPTY_BODY, false, 200);
}

@Test
public void testHttpResponseStatusCodes() throws Exception {
skipIfNetworkUnavailable();
testRequest("GET", "https://httpbin.org", "/status/200", EMPTY_BODY, false, 200);
testRequest("GET", "https://httpbin.org", "/status/300", EMPTY_BODY, false, 300);
testRequest("GET", "https://httpbin.org", "/status/400", EMPTY_BODY, false, 400);
testRequest("GET", "https://httpbin.org", "/status/500", EMPTY_BODY, false, 500);
testRequest("GET", HOST, "/status/200", EMPTY_BODY, false, 200);
testRequest("GET", HOST, "/status/300", EMPTY_BODY, false, 300);
testRequest("GET", HOST, "/status/400", EMPTY_BODY, false, 400);
testRequest("GET", HOST, "/status/500", EMPTY_BODY, false, 500);
}

@Test
Expand Down Expand Up @@ -177,13 +178,13 @@ private String extractValueFromJson(String input) {
private void testHttpUpload(boolean chunked) throws Exception {
skipIfNetworkUnavailable();
String bodyToSend = TEST_DOC_LINE;
TestHttpResponse response = testRequest("PUT", "https://httpbin.org", "/anything", bodyToSend, chunked, 200);
TestHttpResponse response = testRequest("PUT", HOST, "/put", bodyToSend, chunked, 200);

// Get the Body bytes that were echoed back to us
String body = response.getBody();

/**
* Example Json Response Body from httpbin.org:
* Example Json Response Body from postman-echo.com:
*
* {
* "args": {},
Expand All @@ -194,12 +195,11 @@ private void testHttpUpload(boolean chunked) throws Exception {
* "form": {},
* "headers": {
* "Content-Length": "166",
* "Host": "httpbin.org"
* "Host": "postman-echo.com"
* },
* "json": null,
* "method": "PUT",
* "origin": "1.2.3.4, 5.6.7.8",
* "url": "https://httpbin.org/anything"
* }
*
*/
Expand Down Expand Up @@ -240,7 +240,7 @@ public void testHttpUploadChunked() throws Exception {
public void testHttpRequestUnActivated() throws Exception {
skipIfNetworkUnavailable();

URI uri = new URI("https://httpbin.org");
URI uri = new URI(HOST);

HttpHeader[] requestHeaders = new HttpHeader[] { new HttpHeader("Host", uri.getHost()) };

Expand Down

0 comments on commit cbda6d3

Please sign in to comment.