Skip to content

test: Comprehensive unit tests for Sub Issue 13 (Client/Upgrade/Differential/Push/Parameter matrix)#391

Merged
JusterZhu merged 2 commits into
masterfrom
test/comprehensive-unit-tests-13
May 24, 2026
Merged

test: Comprehensive unit tests for Sub Issue 13 (Client/Upgrade/Differential/Push/Parameter matrix)#391
JusterZhu merged 2 commits into
masterfrom
test/comprehensive-unit-tests-13

Conversation

@JusterZhu
Copy link
Copy Markdown
Collaborator

Summary

Closes #390

Comprehensive unit tests for Sub Issue 13 of the GeneralUpdate refactoring plan.

Changes

4 new test files (2669 lines)

  1. ClientUpgradeIntegrationTests.cs (CoreTest)

    • Client ↔ Upgrade mutual upgrade configuration
    • VersionInfo scenarios (cross-version, forcibly, freeze, version chain)
    • ProcessInfo IPC serialization round-trip
    • PipelineContext middleware key storage
    • ConfigurationMapper field mapping
    • Full event listener chain (7 types)
    • Real-world developer production setup chain
    • ClientConfig → ProcessInfo → JSON data flow
  2. ParameterMatrixAndEventTests.cs (CoreTest)

    • Event notification pipeline (UpdateInfo, Exception, multiple listeners, all download events)
    • Push upgrade simulation (server notify, forcibly update, multiple versions)
    • Configinfo validation matrix (missing fields, auth schemes, blacklists)
    • BlackList configuration variations
    • UpdateOptions constants accessibility
    • StorageManager backup/restore with skip directories
    • Parameter combination scenarios (full config, various version formats, various URLs)
  3. DifferentialUpgradeIntegrationTests.cs (DifferentialTest)

    • Clean → Dirty full mesh update cycle
    • Binary file differential (EXE/DLL, large files)
    • Deep nested directory structures
    • Mixed operations (modified + added + deleted + unchanged)
    • DiffPipeline parallel/serial/cancellation/progress
    • DiffPipelineBuilder with custom differ
    • DiffProgress calculation boundary cases
    • Real-world version chain update (3 incremental steps)
    • Edge cases (empty source, empty target, non-existent paths, temp file cleanup)
  4. ClientBootstrapScenarioTests.cs (ClientCoreTest)

    • Mutual upgrade (both/main-only/upgrade-only)
    • Precheck/skip callback scenarios
    • Custom option injection
    • Full event listener chain (client-side)
    • Fluent API (full chain and minimal chain)
    • Silent update configuration
    • Configinfo edge cases (null lists, defaults, cross-platform)
    • UpdateInfoEventArgs and ExceptionEventArgs tests

Test Results

Project Passed Failed (new) Failed (pre-existing) Status
CoreTest 111 0 1
DifferentialTest 23 0 0
ClientCoreTest 115 0 0

The 1 pre-existing failure in CoreTest (ConfiginfoBuilderTests.Build_InitializesCollectionProperties) is unrelated and exists on master.

Copilot AI review requested due to automatic review settings May 24, 2026 14:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a comprehensive set of new unit/integration tests across Core, ClientCore, and Differential test projects to cover Sub Issue 13 of the refactoring plan (mutual upgrade flows, differential pipeline scenarios, push/event notifications, and parameter matrix validation).

Changes:

  • Introduces new integration-style tests for differential Clean/Dirty flows, including binary/large-file and pipeline progress/cancellation scenarios.
  • Adds Core tests for EventManager dispatch/listener behavior, Configinfo validation matrices, blacklist variations, and StorageManager backup behavior.
  • Adds developer-scenario tests for bootstrap configuration in both Core (GeneralUpdateBootstrap) and ClientCore (GeneralClientBootstrap).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
tests/DifferentialTest/DifferentialUpgradeIntegrationTests.cs New end-to-end differential upgrade tests covering Clean/Dirty, binary/large file diffs, pipeline progress/cancellation, and edge cases.
tests/CoreTest/Bootstrap/ParameterMatrixAndEventTests.cs New parameter matrix + EventManager pipeline tests plus StorageManager backup scenarios.
tests/CoreTest/Bootstrap/ClientUpgradeIntegrationTests.cs New Core bootstrap integration tests for mutual-upgrade configuration and ProcessInfo/VersionInfo serialization scenarios.
tests/ClientCoreTest/Bootstrap/ClientBootstrapScenarioTests.cs New ClientCore bootstrap scenario tests for fluent configuration, listeners, precheck/skip, and config edge cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +27
/// - Client ??Upgrade mesh update: generate patches in client context, apply in upgrade context
/// - All file operations: modified, added, deleted, unchanged, binary
/// - Complex directory structures
/// - Push upgrade simulation via differential pipeline
/// - Various parameter combinations (parallel, serial, cancellation, progress)
// Act ??Step 2: Upgrade applies patches (Dirty)
await DifferentialCore.Dirty(appDir, patchDir);

// Assert �� core files should still exist after Dirty
Comment on lines +268 to +277
var manager = BlackListManager.Instance;

manager.AddBlackFiles(new List<string> { "*.pdb", "*.xml" });
manager.AddBlackFileFormats(new List<string> { ".log", ".cache" });
manager.AddSkipDirectorys(new List<string> { "logs", "temp_directory" });

Assert.NotNull(manager.BlackFiles);
Assert.NotNull(manager.BlackFileFormats);
Assert.NotNull(manager.SkipDirectorys);
}
Comment on lines +18 to +21
/// Comprehensive integration tests for Client �?Upgrade mutual upgrade process.
/// Tests the full lifecycle: Client validates versions, downloads packages,
/// passes ProcessInfo to Upgrade, and Upgrade applies updates.
///
Comment on lines +115 to +139
[Fact]
public void ClientUpgrade_ForciblyUpdate_SkipCallbackIsIgnored()
{
var config = new Configinfo
{
UpdateUrl = "https://api.example.com/updates",
MainAppName = "MyApp.exe",
ClientVersion = "1.0.0",
InstallPath = _testBaseDir,
AppSecretKey = "test-key",
Scheme = "https",
Token = "test-token"
};

var skipCalled = false;
var bootstrap = new GeneralUpdateBootstrap()
.SetConfig(config)
.SetCustomSkipOption(() =>
{
skipCalled = true;
return true;
});

Assert.NotNull(bootstrap);
}
Comment on lines +86 to +89
// Assert �?all components configured correctly
Assert.NotNull(bootstrap);
Assert.Same(bootstrap, bootstrap);
}
Comment on lines +17 to +21
/// <summary>
/// Comprehensive ClientBootstrap scenario tests.
/// Covers real-world developer usage patterns:
/// - Client �?Upgrade mutual upgrade configuration
/// - Version precheck / skip scenarios
JusterZhu added 2 commits May 24, 2026 22:46
Add comprehensive unit tests covering:
- Client/Upgrade mutual upgrade integration (ProcessInfo IPC, version chain, forcibly update)
- Differential upgrade full cycle (Clean/Dirty, binary files, nested directories, mixed operations)
- Event notification pipeline (all 7 event types, push upgrade simulation, multiple listeners)
- Parameter matrix combinations (UpdateOptions, Configinfo validation, auth schemes, blacklists)
- Real-world developer usage scenarios (minimal setup, full production chain, fluent API)
- StorageManager backup/restore tests
- PipelineContext and DiffPipeline tests

Results: CoreTest 111/112 pass, DifferentialTest 23/23 pass, ClientCoreTest 115/115 pass
- Rebase on origin/master (merged project structure)
- Fix all namespace references to GeneralUpdate.Core.*
- Fix API changes: AppType enum, UpdateOptions, BlackListManager
- Fix copilot suggestions: encoding, tautology, mutations, unused vars
- Fix AddCustomOption empty list and Precheck callback tests

Results: CoreTest 165p, DifferentialTest 85p, ClientCoreTest 42p
@JusterZhu JusterZhu force-pushed the test/comprehensive-unit-tests-13 branch from d73f5ad to 7874712 Compare May 24, 2026 15:04
@JusterZhu JusterZhu merged commit e58e01c into master May 24, 2026
3 checks passed
@JusterZhu JusterZhu deleted the test/comprehensive-unit-tests-13 branch May 24, 2026 15:07
JusterZhu added a commit that referenced this pull request May 24, 2026
…x, config models) (#392)

* test: add missing coverage tests (post-#391 follow-up)

Files that missed the #391 squash merge:
- BootstrapFullParameterMatrixTests: ALL 42 UpdateOptions, 6 chains
  including Client+Upgrade dual full-configuration
- BootstrapHooksAndExtensionsTests: IUpdateHooks lifecycle (5 methods),
  IUpdateReporter, IUpdateEventListener (8 events), security schemes
- ConfigurationModelsTests: BlackListConfig, HubConfig, DownloadAsset/Plan/
  Progress/Result, 9 enums, UpdateOption<T> semantics

Closes #390 (follow-up)

* fix: copilot suggestions - remove OnCustomEvent, fix option counts, drop region counts

- Remove OnCustomEvent from TestEventListener (only 7 IUpdateEventListener methods exist)
- Fix file header: 42 options -> 37 options (matches actual UpdateOptions surface)
- Remove hard-coded test counts from #region headers to prevent drift
- Fix garbled characters in comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Comprehensive unit tests for Sub Issue 13 (Client/Upgrade/Differential/Push/Parameter matrix)

2 participants