Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
#2344 fixed a JSON parsing problem that broke the auto updater for v1.24.0. This problem could and should have been caught by existing tests, but they weren't running on Travis, and when they did run, they failed due to TLS errors in their network requests (also fixed in #2344) rather than the real problem affecting the client.
#2263 added support for GitHub API auth tokens, but they are not currently used by the auto updater.
Cause
AutoUpdate
has tests, but they're in theFlakyNetwork
category and therefore don't run on Travis. This makes it harder to notice that you've broken the auto updater. When these tests do run, they rely on the network to provide input data, so failures cause by network problems can mask problems with other parts of the logic such as the JSON parsing.AutoUpdate
is not structured to be testable. It has many different responsibilities (checking for updates, parsing update metadata, downloading new client, running new client), which can't be separated out for isolated testing.Changes
Now
AutoUpdate
is refactored to better isolate the network-dependent part of what it does, and a new test is added that exercises the parsing code without relying on the network at all. This test would have caught the problem that #2344 fixed, and now it will run on Travis every time.One of the old tests is removed because it only fetched network data using functions that were removed in the refactoring (for a repo with no releases), but the rest are still there, so you can still use them to perform combined network-and-parsing tests if needed.
Net.DownloadText
is updated to support auth tokens, andAutoUpdate
uses it to get release info. So the auto updater now supports auth tokens.