You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(watcher): pin the single row after a fast resync replaces a container - #1648
Adds the regression test asked for on #1595: after a UI or API update recreates a container (new ID, same name), the fast resync leaves exactly one row. The old ID is gone and the replacement is present, with WATCHEVENTS on and off.
No behavior change. The removal already happens in removeStaleContainerEntriesWithSameName when the replacement is first discovered; disabling that call fails both cases.
✨ Added
New test file: app/watchers/providers/docker/Docker.fast-resync-old-row.test.ts (+99 lines, new file).
Regression test for fast resync after a GUI/API update recreates a container with a new ID and the same name (ref #1595).
Test runs under describe.each([false, true]) with watchevents disabled and enabled.
Assertions: old-id is undefined; new-id is defined; getContainers({ watcher: 'local' }) ids equal ['new-id'].
🔧 Changed
None. No production source files changed.
🐛 Fixed
None.
🗑️ Removed
None.
⚠️ Breaking
None.
🔒 Security
None.
Concerns
Test calls (docker as any).maybeFastResyncAfterUpdate('dashy'). Private method accessed via any; breaks silently on rename.
Test relies on removeStaleContainerEntriesWithSameName (docker-image-details-orchestration.ts:925, called at line 1026) for removal. Test does not isolate this path; removal logic is not changed in this PR.
PR objective states disabling removeStaleContainerEntriesWithSameName fails both cases. Not verified by this diff; no test run evidence available.
vi.mock('../../../log') and vi.restoreAllMocks() in afterEach: confirm vi is a global (no explicit import { vi } from 'vitest'). Other test files in the repo should be checked for the same convention.
as typeof docker.configuration and as unknown as Dockerode casts: weaken type checking; consider a typed fixture helper.
Mock getContainer ignores options.filters shape beyond id/name; summary() hardcodes ImageID: 'image-new' for both old and new containers.
Duplicated fixture-building logic (summary, inspection) could reuse existing test helpers if present in app/test/helpers.js.
Reviewing files that changed from the base of the PR and between 6502488 and 723f380.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Adds a Docker watcher regression test using a migrated in-memory database and mocked dependencies. The test runs with watchevents enabled and disabled. After the container ID changes while its name stays the same, it checks that the old row is absent and exactly one row remains for the replacement container.
Possibly related PRs
CodesWhat/drydock#1632: Changes fast resync after a UI or API update, which is the behavior this test covers.
CodesWhat/drydock#1430: Adds test coverage for name refresh after an external container recreation, including replacement IDs and stale same-name entries.
Change: Other
Merge Risk: Minimal · previous review 65024
This change adds a test for fast resync after a container is recreated with a new ID and the same name. It does not change runtime behavior, and no merge-blocking risk was identified.
Pre-merge checks: 2
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
The configuration directory could not be loaded. This review used the available YAML and UI settings; directory instructions and checks were not evaluated.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
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
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.
Adds the regression test asked for on #1595: after a UI or API update recreates a container (new ID, same name), the fast resync leaves exactly one row. The old ID is gone and the replacement is present, with
WATCHEVENTSon and off.No behavior change. The removal already happens in
removeStaleContainerEntriesWithSameNamewhen the replacement is first discovered; disabling that call fails both cases.✨ Added
app/watchers/providers/docker/Docker.fast-resync-old-row.test.ts(+99 lines, new file).#1595).describe.each([false, true])withwatcheventsdisabled and enabled.createMigratedMemoryDatabase), mockeddockerApi(listContainers,getContainer,getImage), mockedensureRemoteAuthHeaders,findNewVersion,registry.getState,event.emitContainerReport.old-idis undefined;new-idis defined;getContainers({ watcher: 'local' })ids equal['new-id'].🔧 Changed
🐛 Fixed
🗑️ Removed
🔒 Security
Concerns
(docker as any).maybeFastResyncAfterUpdate('dashy'). Private method accessed viaany; breaks silently on rename.removeStaleContainerEntriesWithSameName(docker-image-details-orchestration.ts:925, called at line 1026) for removal. Test does not isolate this path; removal logic is not changed in this PR.removeStaleContainerEntriesWithSameNamefails both cases. Not verified by this diff; no test run evidence available.vi.mock('../../../log')andvi.restoreAllMocks()inafterEach: confirmviis a global (no explicitimport { vi } from 'vitest'). Other test files in the repo should be checked for the same convention.as typeof docker.configurationandas unknown as Dockerodecasts: weaken type checking; consider a typed fixture helper.getContainerignoresoptions.filtersshape beyondid/name;summary()hardcodesImageID: 'image-new'for both old and new containers.summary,inspection) could reuse existing test helpers if present inapp/test/helpers.js.