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

test-fix(offline): Only run "applies stashed ops with no saved ops" test against local server #23383

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions packages/test/test-end-to-end-tests/src/test/stashedOps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ const waitForSummary = async (
container,
testConfig,
);
await summarizeNow(summarizer);
const { summaryVersion } = await summarizeNow(summarizer);
summarizingContainer.close();
return summaryVersion;
};
// Introduced in 0.37
// REVIEW: enable compat testing
Expand Down Expand Up @@ -2025,14 +2026,21 @@ describeCompat("stashed ops", "NoCompat", (getTestObjectProvider, apis) => {
});

it("applies stashed ops with no saved ops", async function () {
// TODO: This test is consistently failing when ran against AFR. See ADO:7968
if (provider.driver.type === "routerlicious" && provider.driver.endpointName === "frs") {
// Waiting for summary takes many seconds and can timeout these tests on real services.
// That coverage isn't a marginal gain over local server testing, so only test against local server.
if (provider.driver.type !== "local") {
this.skip();
}
await waitForSummary(provider, container1, testContainerConfig);

// avoid our join op being saved
const headers: IRequestHeader = { [LoaderHeader.loadMode]: { deltaConnection: "none" } };
// We want to test the case where we stash ops based on the sequence number of the snapshot we load from
// So step 1 is to complete a summary so we can load from it.
const summaryVersion = await waitForSummary(provider, container1, testContainerConfig);

// avoid our join op being saved (so saved ops is empty and the map op below has the right ref seq)
const headers: IRequestHeader = {
[LoaderHeader.loadMode]: { deltaConnection: "none" },
[LoaderHeader.version]: summaryVersion,
};
const container: IContainerExperimental = await loader.resolve({ url, headers });
const dataStore = (await container.getEntryPoint()) as ITestFluidObject;
const map = await dataStore.getSharedObject<ISharedMap>(mapId);
Expand All @@ -2041,8 +2049,13 @@ describeCompat("stashed ops", "NoCompat", (getTestObjectProvider, apis) => {
const stashBlob = await container.closeAndGetPendingLocalState?.();
assert(stashBlob);
const pendingState = JSON.parse(stashBlob);

// make sure the container loaded from summary and we have no saved ops
assert.strictEqual(pendingState.savedOps.length, 0);
assert.strictEqual(pendingState.savedOps.length, 0, "Expected no saved ops");
assert(
pendingState.pendingRuntimeState.pending.pendingStates[0].referenceSequenceNumber > 0,
"Expected the pending state to have some ops with non-zero ref seq (should match the snapshot sequence number)",
);

// load container with pending ops, which should resend the op not sent by previous container
const container2 = await loader.resolve({ url }, stashBlob);
Expand Down
Loading