Skip to content

Add more tests, fix FileExistsKraken.Message#4423

Merged
HebaruSan merged 7 commits into
KSP-CKAN:masterfrom
HebaruSan:fix/exclude-ui-from-coverage
Aug 29, 2025
Merged

Add more tests, fix FileExistsKraken.Message#4423
HebaruSan merged 7 commits into
KSP-CKAN:masterfrom
HebaruSan:fix/exclude-ui-from-coverage

Conversation

@HebaruSan
Copy link
Copy Markdown
Member

Motivation

Coveralls's list of files with the most "missed" lines now includes:

  • ModuleInstaller
  • GUIModList
  • A bunch of stuff that can't be tested because it deals directly with input or output which is not available in tests

Problem

In KSP-CKAN/NetKAN#10713, a FileExistsKraken was printed in a short form that didn't include the details of the problem:

  Error: 8249 [1] ERROR CKAN.CmdLine.ConsoleUser (null) - Exception of type 'CKAN.FileExistsKraken' was thrown.
  Install canceled. Your files have been returned to their initial state.

Cause

In #4398, we refactored and standardized the Kraken classes to provide Message themselves, mostly in their constructors. But in the case of FileExistsKraken, some parts of the message are not known until additional properties are populated later, so we couldn't pass the proper string to Exception's constructor. Instead, we passed a default of null, then overrode Message to return the more detailed strings if base.Message was null. Unfortunately Exception's constructor seems to set Message to a default string so it's never actually null, and we don't fall back to the messages we really want to use.

Changes

  • New tests are added for ModuleInstaller and GUI.ModList
  • We now pass -a ExcludeFromCodeCoverage to AltCover, and many untestable classes and functions are now tagged with [ExcludeFromCodeCoverage]
  • Now FileExistsKraken.Message ignores base.Message and instead always returns the custom messages it's supposed to. To reflect this lack of (unused) overridability, the reason parameter is removed from its constructor.

This should keep our Coveralls number moving in the right direction while remaining accurate and restore the previous clarity of file conflict errors.

@HebaruSan HebaruSan added Bug Something is not working as intended Tests Issues affecting the internal tests labels Aug 29, 2025
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 17334875667

Details

  • 1 of 2 (50.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+5.7%) to 65.016%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Core/Types/Kraken.cs 1 2 50.0%
Files with Coverage Reduction New Missed Lines %
GUI/Model/ModList.cs 1 60.0%
Totals Coverage Status
Change from base Build 17278596596: 5.7%
Covered Lines: 10102
Relevant Lines: 15260

💛 - Coveralls

@HebaruSan HebaruSan merged commit fa519fa into KSP-CKAN:master Aug 29, 2025
6 checks passed
@HebaruSan HebaruSan deleted the fix/exclude-ui-from-coverage branch August 29, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working as intended Tests Issues affecting the internal tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants