Skip to content

Commit 5fd67d7

Browse files
authored
Point Desktop.IntegrationTests::HttpResourceIntegrationTests to a non-rate limited API (#12056)
## Description There are three tests in `Desktop.Integration`'s `HttpResourceIntegrationTests` which verify that requests against a server that requires a `User-Agent` will succeed with the header present and fail when it's missing. To do this we're using a standard unauthenticated GitHub API endpoint. However, we can also hit rate limiting on this endpoint, causing the tests to fail. This PR improves the stability of those tests by instead hitting an API with the same Header requirement, but without rate limiting. ### Type of Change - Bug fix (non-breaking change which fixes an issue) ### Why Stop good PRs from failing due to rate limiting causing tests to fail sporadically. ### What Instead of hitting random GitHub API endpoints (and getting caught in unauthenticated rate limiting), instead change to calling the `/rate_limit` API, which has no rate limit itself. ## Screenshots N/A ## Testing Ran integration tests. ## Changelog Should this change be included in the release notes: No
1 parent c030b7c commit 5fd67d7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Point Desktop.IntegrationTests::HttpResourceIntegrationTests to a non-rate limited API",
4+
"packageName": "react-native-windows",
5+
"email": "jthysell@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Desktop.IntegrationTests/HttpResourceIntegrationTests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ TEST_CLASS (HttpResourceIntegrationTest) {
169169
}
170170

171171
TEST_METHOD(RequestGetExplicitUserAgentSucceeds) {
172-
string url = "https://api.github.com/repos/microsoft/react-native-xaml";
172+
string url = "https://api.github.com/rate_limit";
173173

174174
promise<void> rcPromise;
175175
string error;
@@ -206,7 +206,7 @@ TEST_CLASS (HttpResourceIntegrationTest) {
206206
}
207207

208208
TEST_METHOD(RequestGetImplicitUserAgentSucceeds) {
209-
string url = "https://api.github.com/repos/microsoft/react-native-windows";
209+
string url = "https://api.github.com/rate_limit";
210210

211211
promise<void> rcPromise;
212212
string error;
@@ -246,7 +246,7 @@ TEST_CLASS (HttpResourceIntegrationTest) {
246246

247247
TEST_METHOD(RequestGetMissingUserAgentFails) {
248248
// string url = "http://localhost:" + std::to_string(s_port);
249-
string url = "https://api.github.com/repos/microsoft/react-native-macos";
249+
string url = "https://api.github.com/rate_limit";
250250

251251
promise<void> rcPromise;
252252
string error;

0 commit comments

Comments
 (0)