Skip to content
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

Merged
merged 7 commits into from
Jan 22, 2025

Conversation

agarwal-navin
Copy link
Contributor

@agarwal-navin agarwal-navin commented Jan 8, 2025

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

@github-actions github-actions bot added area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch labels Jan 8, 2025
Copy link
Contributor

@Copilot 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.

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.

@github-actions github-actions bot added the area: runtime Runtime related issues label Jan 13, 2025
@github-actions github-actions bot removed the area: runtime Runtime related issues label Jan 15, 2025

// 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.
Copy link
Member

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);
Copy link
Member

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?

Copy link
Contributor Author

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.
Copy link
Member

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

Copy link
Contributor Author

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();
Copy link
Member

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?

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const sweepTimeoutMs = tombstoneTimeoutMs + sweepGracePeriodMs; // defaultSweepGracePeriodMs;
const sweepTimeoutMs = tombstoneTimeoutMs + sweepGracePeriodMs;

@github-actions github-actions bot added the area: runtime Runtime related issues label Jan 22, 2025
@agarwal-navin agarwal-navin changed the title [GC] Update a GC end-to-end test to use sinon timers instead of real ones (GC) Update a GC end-to-end test to use sinon timers instead of real ones Jan 22, 2025
@agarwal-navin agarwal-navin merged commit 4f2ca3e into microsoft:main Jan 22, 2025
26 checks passed
@agarwal-navin agarwal-navin deleted the sinonTimerInGCTest branch January 22, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: runtime Runtime related issues area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants