Skip to content

Commit 112c832

Browse files
authored
[tests] Add backup ssl sites in case of 429 response. (#7909)
Our SSL test can fail quite often with a HTTP-429 Too Many Requests error. This makes the CI very unstable as we are constantly having to wait and retry the tests. Improve this by putting that logic into the test itself. If we get an HTTP-429 we should try some other SSL site.
1 parent 9d6e735 commit 112c832

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

tests/Mono.Android-Tests/System.Net/ProxyTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ProxyTest {
1313
[Test]
1414
public void QuoteInvalidQuoteUrlsShouldWork ()
1515
{
16-
string url = "http://example.com/?query&foo|bar";
16+
string url = "https://bing.com/?query&foo|bar";
1717
var request = (HttpWebRequest) WebRequest.Create (url);
1818
request.Method = "GET";
1919
var response = (HttpWebResponse) request.GetResponse ();

tests/Mono.Android-Tests/System.Net/SslTest.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,24 @@ public void HttpsShouldWork ()
8383
void DoHttpsShouldWork ()
8484
{
8585
// string url = "https://bugzilla.novell.com/show_bug.cgi?id=634817";
86-
string url = "https://encrypted.google.com/";
86+
string[] urls = new string[] {
87+
"https://dotnet.microsoft.com/",
88+
"https://www.bing.com/",
89+
"https://httpbin.org/get",
90+
};
8791
// string url = "http://slashdot.org";
88-
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
89-
request.Method = "GET";
90-
var response = (HttpWebResponse) request.GetResponse ();
92+
HttpWebResponse response = null;
93+
foreach (var url in urls) {
94+
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
95+
request.Method = "GET";
96+
response = (HttpWebResponse) request.GetResponse ();
97+
if (response.StatusCode == HttpStatusCode.TooManyRequests) {
98+
// try the next url.
99+
continue;
100+
}
101+
break;
102+
}
103+
Assert.IsNotNull (response);
91104
int len = 0;
92105
using (var _r = new StreamReader (response.GetResponseStream ())) {
93106
char[] buf = new char [4096];

0 commit comments

Comments
 (0)