Fix AD mod upgrading, add tests, and fix all warnings #3315
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
In #3190, we allowed AD mods to be upgraded, replacing them with a CKAN-managed module.
In v1.30.0, AD mods again are no longer treated as upgradeable.
Causes
InstalledModule
returnsnull
for AD mods, and after #3307 we attempt to access properties of that return value, which throws a null reference exception.HasUpdate
catches this exception and returnsfalse
.CKAN/Core/Registry/IRegistryQuerier.cs
Line 197 in 6ec7270
Changes
Now we pass
null
for the modules to remove ifInstalledModule
returnsnull
. In future we would like to tellRelationshipResolver
to check what will happen if we remove the DLL, but for now this will at least bring the upgrade checkboxes back.Two tests are added to make it harder to break this accidentally:
Side fixes
The
Tests/GUI
folder is reorganized slightly, with two files moved to a newModel
subfolder to match where their tested code lives.Fixed warnings during build:
Added documentation of this parameter
We were using this
protected Hashtable
as a cache for ourResourceSet
s because that's what I found on StackExchange, but the base class no longer uses this object, hence this warning. Now we use aprivate Dictionary
instead for the same purpose.Fixed warnings from tests:
Reworked
GithubTransformerTests
slightly so the multi-asset release is only processed by code that's prepared for itAdded tags to the test data in
CkanValidatorTests