Skip to content

Commit 0bb9f76

Browse files
[Data Virtualization]: Repro groupId and offline causing extra network calls (#21910)
[AB#8937](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/8937) This PR is expected to fail until the fix is merged in: #21908 The repro is: - Offline and Data virtualization are enabled - A virtualized datastore is created - It is summarized - A new container loads from that summary - In offline mode, we store the blobs on load that we have. - Because some of the blobs are not there, the loader makes a network call for each blob.
1 parent 9428bd9 commit 0bb9f76

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*!
2+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3+
* Licensed under the MIT License.
4+
*/
5+
6+
import {
7+
describeCompat,
8+
TestDataObjectType,
9+
type ITestDataObject,
10+
} from "@fluid-private/test-version-utils";
11+
import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
12+
import type { IContainerRuntimeBase } from "@fluidframework/runtime-definitions/internal";
13+
import { MockLogger } from "@fluidframework/telemetry-utils/internal";
14+
import {
15+
type ITestObjectProvider,
16+
createSummarizer,
17+
createTestConfigProvider,
18+
summarizeNow,
19+
} from "@fluidframework/test-utils/internal";
20+
21+
import { TestSnapshotCache } from "../../testSnapshotCache.js";
22+
23+
describeCompat("Odsp Network calls", "NoCompat", (getTestObjectProvider) => {
24+
// Allow us to control summaries
25+
const runtimeOptions: IContainerRuntimeOptions = {
26+
summaryOptions: {
27+
summaryConfigOverrides: {
28+
state: "disabled",
29+
},
30+
},
31+
};
32+
const configProvider = createTestConfigProvider({
33+
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2": true,
34+
"Fluid.Container.enableOfflineLoad": true,
35+
});
36+
37+
let provider: ITestObjectProvider;
38+
const testSnapshotCache = new TestSnapshotCache();
39+
40+
beforeEach("setup", async function () {
41+
provider = getTestObjectProvider({ persistedCache: testSnapshotCache });
42+
if (provider.driver.type !== "odsp") {
43+
this.skip();
44+
}
45+
});
46+
47+
const loadingGroupId = "loadingGroupId";
48+
const createDataObjectsWithGroupIds = async (
49+
mainObject: ITestDataObject,
50+
containerRuntime: IContainerRuntimeBase,
51+
) => {
52+
const dataStoreA = await containerRuntime.createDataStore(
53+
TestDataObjectType,
54+
loadingGroupId,
55+
);
56+
const dataStoreB = await containerRuntime.createDataStore(
57+
TestDataObjectType,
58+
loadingGroupId,
59+
);
60+
61+
mainObject._root.set("dataObjectA", dataStoreA.entryPoint);
62+
mainObject._root.set("dataObjectB", dataStoreB.entryPoint);
63+
};
64+
65+
it.skip("Should not make odsp network calls", async () => {
66+
const container = await provider.makeTestContainer({
67+
runtimeOptions,
68+
loaderProps: { configProvider },
69+
});
70+
const mainObject = (await container.getEntryPoint()) as ITestDataObject;
71+
const containerRuntime = mainObject._context.containerRuntime;
72+
73+
// Testing all apis for creating a data store with a loadingGroupId
74+
await createDataObjectsWithGroupIds(mainObject, containerRuntime);
75+
const { summarizer } = await createSummarizer(provider, container, {
76+
loaderProps: { configProvider },
77+
});
78+
await provider.ensureSynchronized();
79+
await summarizeNow(summarizer);
80+
81+
testSnapshotCache.clearCache();
82+
const logger = new MockLogger();
83+
await provider.loadTestContainer({
84+
loaderProps: { configProvider, logger },
85+
});
86+
if (provider.driver.type === "odsp") {
87+
logger.assertMatchNone(
88+
[
89+
{
90+
eventName: "fluid:telemetry:OdspDriver:readDataBlob_end",
91+
},
92+
],
93+
"Should not have any odps network calls",
94+
);
95+
}
96+
});
97+
});

0 commit comments

Comments
 (0)