test: fix flaky timing and correctness issues in reporter/plugin manager tests#142
Merged
intel352 merged 2 commits intofeat/issue-92-test-coveragefrom Feb 23, 2026
Merged
Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add comprehensive tests for under-tested packages
test: fix flaky timing and correctness issues in reporter/plugin manager tests
Feb 23, 2026
intel352
added a commit
that referenced
this pull request
Feb 23, 2026
* test: improve test coverage for critical packages (#92) Add comprehensive tests for under-tested packages: - admin: LoadConfigRaw, LoadConfig, MergeInto (0% → 89.5%) - config: LoadFromString, ResolveRelativePath, ResolvePathInConfig (40.7% → 100%) - observability: Reporter lifecycle, IngestHandler endpoints (15.2% → 62.5%) - plugin/admincore: Plugin metadata, UIPages, lifecycle (0% → 88.9%) - plugin: PluginManager ServeHTTP, state persistence, dependency resolution - sandbox: tar archive creation, CopyIn/CopyOut stubs, empty command validation All tests use table-driven patterns with t.Run() subtests and t.Parallel(). Verified with -race flag and golangci-lint. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: fix flaky timing and correctness issues in reporter/plugin manager tests (#142) * Initial plan * test: apply review feedback to reporter and plugin manager tests Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Four correctness and reliability issues in the test suite identified during review of #130.
observability/reporter_test.go
TestReporter_StopFlushesRemaining: handler was settingreceived=truefor any request, meaning the async registration POST to/api/v1/admin/instances/registercould satisfy the assertion before the actual flush to/api/v1/admin/ingest/executionsever happened. Now only the ingest path triggers the flag.TestReporter_BufferAndFlush: replaced fixedtime.Sleepwaits with a deadline/poll loop — exits as soon as all three ingest paths are observed, fails fast with a descriptive message after 2s. Addedt.Cleanup(cancel)to guarantee goroutine teardown.plugin/manager_test.go
DB setup: four tests were opening SQLite directly via
sql.Open("sqlite", ":memory:")+defer db.Close(), bypassing the existingopenTestDB(t)helper innative_test.go. Consolidated to use the helper (which registers cleanup viat.Cleanup). Removed now-unuseddatabase/sqland_ "modernc.org/sqlite"imports.TestPluginManager_AllPlugins:Register/Enablecalls were silently discarding errors with_ = .... Replaced witht.Fatalfso a future regression points directly at the failing call rather than a downstream assertion.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.