Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoupdater tests on TLS-fragile platforms #2344

Merged
merged 1 commit into from
Mar 5, 2018

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Mar 5, 2018

Problems

We have three failing tests currently. (Travis skips them by excluding anything tagged with FlakyNetwork, which these are.)

1) Failed : Tests.Core.AutoUpdate.AutoUpdate.FetchCkanUrl
  Expected: <CKAN.Kraken>
  But was:  <System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at CKAN.AutoUpdate.MakeRequest(Uri url) in C:\Users\user\github\CKAN\Core\Net\AutoUpdate.cs:line 215
   at Tests.Core.AutoUpdate.AutoUpdate.Fetch(Uri url, Int32 whichOne) in C:\Users\user\github\CKAN\Tests\Core\Net\AutoUpdate.cs:line 57
   at Tests.Core.AutoUpdate.AutoUpdate.<FetchCkanUrl>b__1_0() in C:\Users\user\github\CKAN\Tests\Core\Net\AutoUpdate.cs:line 22
   at NUnit.Framework.Assert.Throws(IResolveConstraint expression, TestDelegate code, String message, Object[] args)>
   at Tests.Core.AutoUpdate.AutoUpdate.FetchCkanUrl() in C:\Users\user\github\CKAN\Tests\Core\Net\AutoUpdate.cs:line 20

2) Error : Tests.Core.AutoUpdate.AutoUpdate.FetchLatestReleaseInfo
System.Net.WebException : The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at CKAN.AutoUpdate.MakeRequest(Uri url) in C:\Users\user\github\CKAN\Core\Net\AutoUpdate.cs:line 215
   at CKAN.AutoUpdate.FetchLatestReleaseInfo() in C:\Users\user\github\CKAN\Core\Net\AutoUpdate.cs:line 87
   at Tests.Core.AutoUpdate.AutoUpdate.FetchLatestReleaseInfo() in C:\Users\user\github\CKAN\Tests\Core\Net\AutoUpdate.cs:line 36

3) Error : Tests.NetKAN.Sources.Github.GithubApiTests.GetsLatestReleaseCorrectly
System.Net.WebException : The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at CKAN.NetKAN.Sources.Github.GithubApi.Call(String path) in C:\Users\user\github\CKAN\Netkan\Sources\Github\GithubApi.cs:line 96
   at CKAN.NetKAN.Sources.Github.GithubApi.GetLatestRelease(GithubRef reference) in C:\Users\user\github\CKAN\Netkan\Sources\Github\GithubApi.cs:line 32
   at Tests.NetKAN.Sources.Github.GithubApiTests.GetsLatestReleaseCorrectly() in C:\Users\user\github\CKAN\Tests\NetKAN\Sources\Github\GithubApiTests.cs:line
 22

Causes

We need to set ServicePointManager.SecurityProtocol before accessing GitHub to enable TLS1.2, see #2297. Running tests bypasses that.

After you fix these three, another test failure happens:

1) Failed : Tests.Core.AutoUpdate.AutoUpdate.FetchLatestReleaseInfo
  Expected: True
  But was:  False
   at Tests.Core.AutoUpdate.AutoUpdate.FetchLatestReleaseInfo() in C:\Users\user\github\CKAN\Tests\Core\Net\AutoUpdate.cs:line 43

This happens because we stop searching a release for ckan.exe after we find AutoUpdater.exe due to an errant break statement. I think this means the auto-updater in 1.24.0 won't work.

Changes

ServicePointManager.SecurityProtocol is set before network accesses in the affected tests.

The break statement is removed to make FetchLatestReleaseInfo continue through all the needed assets.

After these changes, all tests now pass.

@HebaruSan HebaruSan added Pull request AutoUpdate Issues affecting the automatic updating Tests Issues affecting the internal tests labels Mar 5, 2018
@politas politas merged commit 2a378ab into KSP-CKAN:master Mar 5, 2018
@HebaruSan HebaruSan deleted the fix/autoupdater-tests branch March 5, 2018 01:58
@Ruedii
Copy link

Ruedii commented Apr 12, 2018

Does this fix the issues with Mono 4.x? I know they were related to this.

@HebaruSan
Copy link
Member Author

No, this has nothing to do with the actual app, just the tests that are run by the build system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoUpdate Issues affecting the automatic updating Tests Issues affecting the internal tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants