From a6b9d79612926abea08696758fc0c47ff457cd4d Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 22 Mar 2023 09:30:57 +0000 Subject: [PATCH 1/2] [tests] Add backup ssl sites in case of 429 response. Our SSL test can fail quite often with a 429 Too Many Requests error. This makes the CI very unstable as we are constantly having to wait and retry the tests. So lets put that logic into the test itself. If we get a 429 we should try some other ssl site. --- .../Mono.Android-Tests/System.Net/SslTest.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/Mono.Android-Tests/System.Net/SslTest.cs b/tests/Mono.Android-Tests/System.Net/SslTest.cs index 37662f646e8..934435d52fb 100644 --- a/tests/Mono.Android-Tests/System.Net/SslTest.cs +++ b/tests/Mono.Android-Tests/System.Net/SslTest.cs @@ -83,11 +83,24 @@ public void HttpsShouldWork () void DoHttpsShouldWork () { // string url = "https://bugzilla.novell.com/show_bug.cgi?id=634817"; - string url = "https://encrypted.google.com/"; + string[] urls = new string[] { + "https://dotnet.microsoft.com/", + "https://www.bing.com/", + "https://httpbin.org/get", + }; // string url = "http://slashdot.org"; - HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); - request.Method = "GET"; - var response = (HttpWebResponse) request.GetResponse (); + HttpWebResponse response = null; + foreach (var url in urls) { + HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); + request.Method = "GET"; + response = (HttpWebResponse) request.GetResponse (); + if (response.StatusCode == HttpStatusCode.TooManyRequests) { + // try the next url. + continue; + } + break; + } + Assert.IsNotNull (response); int len = 0; using (var _r = new StreamReader (response.GetResponseStream ())) { char[] buf = new char [4096]; From 5528a90ead058934a86ad423995a83c6f06a804c Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 22 Mar 2023 10:18:22 +0000 Subject: [PATCH 2/2] change to use bing --- tests/Mono.Android-Tests/System.Net/ProxyTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Mono.Android-Tests/System.Net/ProxyTest.cs b/tests/Mono.Android-Tests/System.Net/ProxyTest.cs index efe746c7cee..a8149eccd3c 100644 --- a/tests/Mono.Android-Tests/System.Net/ProxyTest.cs +++ b/tests/Mono.Android-Tests/System.Net/ProxyTest.cs @@ -13,7 +13,7 @@ public class ProxyTest { [Test] public void QuoteInvalidQuoteUrlsShouldWork () { - string url = "http://example.com/?query&foo|bar"; + string url = "https://bing.com/?query&foo|bar"; var request = (HttpWebRequest) WebRequest.Create (url); request.Method = "GET"; var response = (HttpWebResponse) request.GetResponse ();