-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(GC) Update a GC end-to-end test to use sinon timers instead of real ones #23516
(GC) Update a GC end-to-end test to use sinon timers instead of real ones #23516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/test/test-end-to-end-tests/src/test/gc/gcSweepDataStores.spec.ts:685
- Replace 'tombstone ready' with 'sweep ready' for consistency.
// Summarize. The tombstone ready data store should get realized because it has a trailing op.
packages/test/test-end-to-end-tests/src/test/gc/gcSweepDataStores.spec.ts
Outdated
Show resolved
Hide resolved
packages/test/test-end-to-end-tests/src/test/gc/gcSweepDataStores.spec.ts
Outdated
Show resolved
Hide resolved
packages/test/test-end-to-end-tests/src/test/gc/gcSweepDataStores.spec.ts
Show resolved
Hide resolved
packages/test/test-end-to-end-tests/src/test/gc/gcSweepDataStores.spec.ts
Show resolved
Hide resolved
packages/test/test-end-to-end-tests/src/test/gc/gcSweepDataStores.spec.ts
Outdated
Show resolved
Hide resolved
bbae5bb
to
1334d8b
Compare
|
||
// Send an op to update the timestamp that the summarizer client uses for GC to a current one. | ||
defaultDataObject._root.set("update", "timestamp"); | ||
await provider.ensureSynchronized(); | ||
|
||
// Close the container as it would be closed by session expiry before sweep ready ever occurs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this comment by the container.close where you moved it?
summarizingContainer1.close(); | ||
|
||
clock.tick(sweepTimeoutMs + 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why'd you decide to move this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's done after loading the new summarize, its session will expire when the clock moves past sweep timeout.
|
||
// Send a trailing op and close the summarizer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore this? It's nice to highlight where the trailing op is, since that's a key part of the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this code a bit and added another comment in place of this.
const container2 = await provider.loadTestContainer(testContainerConfig); | ||
await provider.ensureSynchronized(); | ||
// Close the first container to simulate scenario where it closes before its session expires. | ||
container.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this prevent the "unexpected delete" log or whatever, about the local thing getting deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does.
@@ -125,7 +125,7 @@ function validateDataStoreStateInSummary( | |||
|
|||
const tombstoneTimeoutMs = 200; | |||
const sweepGracePeriodMs = 0; // Skip Tombstone, these tests focus on Sweep | |||
const sweepTimeoutMs = tombstoneTimeoutMs + sweepGracePeriodMs; | |||
const sweepTimeoutMs = tombstoneTimeoutMs + sweepGracePeriodMs; // defaultSweepGracePeriodMs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const sweepTimeoutMs = tombstoneTimeoutMs + sweepGracePeriodMs; // defaultSweepGracePeriodMs; | |
const sweepTimeoutMs = tombstoneTimeoutMs + sweepGracePeriodMs; |
This PR updates one of the GC end-to-end test to use sinon fake timers instead of real timers. The tests in this file adds delays to wait for sweep timers to expire. Using fake timers these delays have been replaced with advancing the clock thereby reducing the runtime.
The run time for this test file went from 4s to 2s.
AB#11248