From 43a95f00e8235bdab969028471c47b29909a0802 Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Thu, 15 Oct 2026 23:05:04 +0200 Subject: [PATCH] test: accept GitHub's rate-limit 403 in BindingIT (#1846) The two HTTP output binding error tests call api.github.com without a token and expected a 404. When the runner's IP has used up GitHub's unauthenticated rate limit, GitHub answers 403 instead and both tests fail. Accept either status and check the body that matches it. Signed-off-by: Javier Aliaga (cherry picked from commit 0d993caafa6353f99e658ed5001e8da7b84b5869) --- .../java/io/dapr/it/binding/http/BindingIT.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java b/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java index 438e8ac374..dc7bc28b90 100644 --- a/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java +++ b/sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java @@ -52,11 +52,11 @@ public void httpOutputBindingError() throws Exception { client.invokeBinding("github-http-binding-404", "get", "").block(); fail("Should throw an exception"); } catch (DaprException e) { - assertEquals(404, e.getHttpStatusCode()); + assertGitHubErrorStatus(e.getHttpStatusCode()); // This HTTP binding did not set `errorIfNot2XX` to false in component metadata, so the error payload is not // consistent between HTTP and gRPC. assertTrue(new String(e.getPayload()).contains( - "error invoking output binding github-http-binding-404: received status code 404")); + "error invoking output binding github-http-binding-404: received status code " + e.getHttpStatusCode())); } }, 10000); } @@ -78,11 +78,12 @@ public void httpOutputBindingErrorIgnoredByComponent() throws Exception { client.invokeBinding("github-http-binding-404-success", "get", "").block(); fail("Should throw an exception"); } catch (DaprException e) { - assertEquals(404, e.getHttpStatusCode()); + assertGitHubErrorStatus(e.getHttpStatusCode()); // The HTTP binding must set `errorIfNot2XX` to false in component metadata for the error payload to be // consistent between HTTP and gRPC. assertTrue(new String(e.getPayload()).contains("message")); - assertTrue(new String(e.getPayload()).contains("Not Found")); + assertTrue(new String(e.getPayload()).contains( + e.getHttpStatusCode() == 404 ? "Not Found" : "API rate limit exceeded")); assertTrue(new String(e.getPayload()).contains("documentation_url")); assertTrue(new String(e.getPayload()).contains("https://docs.github.com/rest")); } @@ -90,6 +91,12 @@ public void httpOutputBindingErrorIgnoredByComponent() throws Exception { } } + // api.github.com answers 404 for an unknown path, or 403 when the runner's IP has used up the unauthenticated + // rate limit. Either way the binding must pass the status and body through. + private static void assertGitHubErrorStatus(int status) { + assertTrue(status == 404 || status == 403, "expected 404 or 403 but was " + status); + } + @Test public void inputOutputBinding() throws Exception { var bindingName = "sample123";