@fluidframework/test-utils 1.2.1 → 2.0.0-internal.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DriverWrappers.d.ts +29 -0
- package/dist/DriverWrappers.d.ts.map +1 -0
- package/dist/DriverWrappers.js +54 -0
- package/dist/DriverWrappers.js.map +1 -0
- package/dist/TestConfigs.d.ts +7 -0
- package/dist/TestConfigs.d.ts.map +1 -0
- package/dist/TestConfigs.js +15 -0
- package/dist/TestConfigs.js.map +1 -0
- package/dist/TestSummaryUtils.d.ts +17 -0
- package/dist/TestSummaryUtils.d.ts.map +1 -0
- package/dist/TestSummaryUtils.js +95 -0
- package/dist/TestSummaryUtils.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/loaderContainerTracker.d.ts.map +1 -1
- package/dist/loaderContainerTracker.js +2 -1
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/testObjectProvider.d.ts +1 -0
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +3 -0
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.d.ts +2 -0
- package/dist/timeoutUtils.d.ts.map +1 -1
- package/dist/timeoutUtils.js +7 -1
- package/dist/timeoutUtils.js.map +1 -1
- package/package.json +26 -25
- package/src/DriverWrappers.ts +77 -0
- package/src/TestConfigs.ts +14 -0
- package/src/TestSummaryUtils.ts +139 -0
- package/src/index.ts +3 -0
- package/src/loaderContainerTracker.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/testObjectProvider.ts +4 -0
- package/src/timeoutUtils.ts +8 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IDocumentService, IDocumentServiceFactory, IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
|
+
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
7
|
+
/**
|
|
8
|
+
* Wraps the given IDocumentStorageService to override the `uploadSummaryWithContext` method. It calls the
|
|
9
|
+
* `uploadSummaryCb` whenever a summary is uploaded by the client. The summary context can be updated in the
|
|
10
|
+
* callback before it is uploaded to the server.
|
|
11
|
+
*/
|
|
12
|
+
export declare function wrapDocumentStorageService(innerDocStorageService: IDocumentStorageService, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentStorageService;
|
|
13
|
+
/**
|
|
14
|
+
* Wraps the given IDocumentService to override the `connectToStorage` method. The intent is to plumb the
|
|
15
|
+
* `uploadSummaryCb` to the IDocumentStorageService so that it is called whenever a summary is uploaded by
|
|
16
|
+
* the client.
|
|
17
|
+
* The document storage service that is created in `connectToStorage` is wrapped by calling `wrapDocumentStorageService`
|
|
18
|
+
* to pass in the `uploadSummaryCb`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function wrapDocumentService(innerDocService: IDocumentService, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentService;
|
|
21
|
+
/**
|
|
22
|
+
* Wraps the given IDocumentServiceFactory to override the `createDocumentService` method. The intent is to plumb
|
|
23
|
+
* the `uploadSummaryCb` all the way to the IDocumentStorageService so that it is called whenever a summary is
|
|
24
|
+
* uploaded by the client.
|
|
25
|
+
* The document service that is created in `createDocumentService` is wrapped by calling `wrapDocumentService` to
|
|
26
|
+
* pass in the `uploadSummaryCb`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function wrapDocumentServiceFactory(innerDocServiceFactory: IDocumentServiceFactory, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentServiceFactory;
|
|
29
|
+
//# sourceMappingURL=DriverWrappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DriverWrappers.d.ts","sourceRoot":"","sources":["../src/DriverWrappers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EAEvB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,0BAA0B,CACtC,sBAAsB,EAAE,uBAAuB,EAC/C,eAAe,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,KAAK,eAAe,2BAW5F;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,eAAe,EAAE,gBAAgB,EACjC,eAAe,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,KAAK,eAAe,oBAQ5F;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACtC,sBAAsB,EAAE,uBAAuB,EAC/C,eAAe,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,KAAK,eAAe,2BAa5F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.wrapDocumentServiceFactory = exports.wrapDocumentService = exports.wrapDocumentStorageService = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Wraps the given IDocumentStorageService to override the `uploadSummaryWithContext` method. It calls the
|
|
10
|
+
* `uploadSummaryCb` whenever a summary is uploaded by the client. The summary context can be updated in the
|
|
11
|
+
* callback before it is uploaded to the server.
|
|
12
|
+
*/
|
|
13
|
+
function wrapDocumentStorageService(innerDocStorageService, uploadSummaryCb) {
|
|
14
|
+
const outerDocStorageService = Object.create(innerDocStorageService);
|
|
15
|
+
outerDocStorageService.uploadSummaryWithContext = async (summary, context) => {
|
|
16
|
+
const newContext = uploadSummaryCb(summary, context);
|
|
17
|
+
return innerDocStorageService.uploadSummaryWithContext(summary, newContext);
|
|
18
|
+
};
|
|
19
|
+
return outerDocStorageService;
|
|
20
|
+
}
|
|
21
|
+
exports.wrapDocumentStorageService = wrapDocumentStorageService;
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the given IDocumentService to override the `connectToStorage` method. The intent is to plumb the
|
|
24
|
+
* `uploadSummaryCb` to the IDocumentStorageService so that it is called whenever a summary is uploaded by
|
|
25
|
+
* the client.
|
|
26
|
+
* The document storage service that is created in `connectToStorage` is wrapped by calling `wrapDocumentStorageService`
|
|
27
|
+
* to pass in the `uploadSummaryCb`.
|
|
28
|
+
*/
|
|
29
|
+
function wrapDocumentService(innerDocService, uploadSummaryCb) {
|
|
30
|
+
const outerDocService = Object.create(innerDocService);
|
|
31
|
+
outerDocService.connectToStorage = async () => {
|
|
32
|
+
const storageService = await innerDocService.connectToStorage();
|
|
33
|
+
return wrapDocumentStorageService(storageService, uploadSummaryCb);
|
|
34
|
+
};
|
|
35
|
+
return outerDocService;
|
|
36
|
+
}
|
|
37
|
+
exports.wrapDocumentService = wrapDocumentService;
|
|
38
|
+
/**
|
|
39
|
+
* Wraps the given IDocumentServiceFactory to override the `createDocumentService` method. The intent is to plumb
|
|
40
|
+
* the `uploadSummaryCb` all the way to the IDocumentStorageService so that it is called whenever a summary is
|
|
41
|
+
* uploaded by the client.
|
|
42
|
+
* The document service that is created in `createDocumentService` is wrapped by calling `wrapDocumentService` to
|
|
43
|
+
* pass in the `uploadSummaryCb`.
|
|
44
|
+
*/
|
|
45
|
+
function wrapDocumentServiceFactory(innerDocServiceFactory, uploadSummaryCb) {
|
|
46
|
+
const outerDocServiceFactory = Object.create(innerDocServiceFactory);
|
|
47
|
+
outerDocServiceFactory.createDocumentService = async (resolvedUrl, logger, clientIsSummarizer) => {
|
|
48
|
+
const documentService = await innerDocServiceFactory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
|
|
49
|
+
return wrapDocumentService(documentService, uploadSummaryCb);
|
|
50
|
+
};
|
|
51
|
+
return outerDocServiceFactory;
|
|
52
|
+
}
|
|
53
|
+
exports.wrapDocumentServiceFactory = wrapDocumentServiceFactory;
|
|
54
|
+
//# sourceMappingURL=DriverWrappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DriverWrappers.js","sourceRoot":"","sources":["../src/DriverWrappers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH;;;;GAIG;AACH,SAAgB,0BAA0B,CACtC,sBAA+C,EAC/C,eAAyF;IAEzF,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAA4B,CAAC;IAChG,sBAAsB,CAAC,wBAAwB,GAAG,KAAK,EACnD,OAAqB,EACrB,OAAwB,EACT,EAAE;QACjB,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,OAAO,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAChF,CAAC,CAAC;IACF,OAAO,sBAAsB,CAAC;AAClC,CAAC;AAbD,gEAaC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAC/B,eAAiC,EACjC,eAAyF;IAEzF,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAqB,CAAC;IAC3E,eAAe,CAAC,gBAAgB,GAAG,KAAK,IAAsC,EAAE;QAC5E,MAAM,cAAc,GAAG,MAAM,eAAe,CAAC,gBAAgB,EAAE,CAAC;QAChE,OAAO,0BAA0B,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IACvE,CAAC,CAAC;IACF,OAAO,eAAe,CAAC;AAC3B,CAAC;AAVD,kDAUC;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B,CACtC,sBAA+C,EAC/C,eAAyF;IAEzF,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAA4B,CAAC;IAChG,sBAAsB,CAAC,qBAAqB,GAAG,KAAK,EAChD,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B,EACH,EAAE;QAC3B,MAAM,eAAe,GAAG,MAAM,sBAAsB,CAAC,qBAAqB,CACtE,WAAW,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;QAC7C,OAAO,mBAAmB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC,CAAC;IACF,OAAO,sBAAsB,CAAC;AAClC,CAAC;AAfD,gEAeC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentService,\n IDocumentServiceFactory,\n IDocumentStorageService,\n IResolvedUrl,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Wraps the given IDocumentStorageService to override the `uploadSummaryWithContext` method. It calls the\n * `uploadSummaryCb` whenever a summary is uploaded by the client. The summary context can be updated in the\n * callback before it is uploaded to the server.\n */\nexport function wrapDocumentStorageService(\n innerDocStorageService: IDocumentStorageService,\n uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,\n) {\n const outerDocStorageService = Object.create(innerDocStorageService) as IDocumentStorageService;\n outerDocStorageService.uploadSummaryWithContext = async (\n summary: ISummaryTree,\n context: ISummaryContext,\n ): Promise<string> => {\n const newContext = uploadSummaryCb(summary, context);\n return innerDocStorageService.uploadSummaryWithContext(summary, newContext);\n };\n return outerDocStorageService;\n}\n\n/**\n * Wraps the given IDocumentService to override the `connectToStorage` method. The intent is to plumb the\n * `uploadSummaryCb` to the IDocumentStorageService so that it is called whenever a summary is uploaded by\n * the client.\n * The document storage service that is created in `connectToStorage` is wrapped by calling `wrapDocumentStorageService`\n * to pass in the `uploadSummaryCb`.\n */\nexport function wrapDocumentService(\n innerDocService: IDocumentService,\n uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,\n) {\n const outerDocService = Object.create(innerDocService) as IDocumentService;\n outerDocService.connectToStorage = async (): Promise<IDocumentStorageService> => {\n const storageService = await innerDocService.connectToStorage();\n return wrapDocumentStorageService(storageService, uploadSummaryCb);\n };\n return outerDocService;\n}\n\n/**\n * Wraps the given IDocumentServiceFactory to override the `createDocumentService` method. The intent is to plumb\n * the `uploadSummaryCb` all the way to the IDocumentStorageService so that it is called whenever a summary is\n * uploaded by the client.\n * The document service that is created in `createDocumentService` is wrapped by calling `wrapDocumentService` to\n * pass in the `uploadSummaryCb`.\n */\nexport function wrapDocumentServiceFactory(\n innerDocServiceFactory: IDocumentServiceFactory,\n uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,\n) {\n const outerDocServiceFactory = Object.create(innerDocServiceFactory) as IDocumentServiceFactory;\n outerDocServiceFactory.createDocumentService = async (\n resolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> => {\n const documentService = await innerDocServiceFactory.createDocumentService(\n resolvedUrl, logger, clientIsSummarizer);\n return wrapDocumentService(documentService, uploadSummaryCb);\n };\n return outerDocServiceFactory;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ConfigTypes, IConfigProviderBase } from "@fluidframework/telemetry-utils";
|
|
6
|
+
export declare const mockConfigProvider: (settings?: Record<string, ConfigTypes>) => IConfigProviderBase;
|
|
7
|
+
//# sourceMappingURL=TestConfigs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestConfigs.d.ts","sourceRoot":"","sources":["../src/TestConfigs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEnF,eAAO,MAAM,kBAAkB,cAAe,OAAO,MAAM,EAAE,WAAW,CAAC,KAAQ,mBAM/E,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.mockConfigProvider = void 0;
|
|
8
|
+
exports.mockConfigProvider = ((settings = {}) => {
|
|
9
|
+
settings["Fluid.GarbageCollection.TrackGCState"] = "true";
|
|
10
|
+
settings["Fluid.GarbageCollection.WriteDataAtRoot"] = "true";
|
|
11
|
+
return {
|
|
12
|
+
getRawConfig: (name) => settings[name],
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=TestConfigs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestConfigs.js","sourceRoot":"","sources":["../src/TestConfigs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,kBAAkB,GAAG,CAAC,CAAC,WAAwC,EAAE,EAAuB,EAAE;IACnG,QAAQ,CAAC,sCAAsC,CAAC,GAAG,MAAM,CAAC;IAC1D,QAAQ,CAAC,yCAAyC,CAAC,GAAG,MAAM,CAAC;IAC7D,OAAO;QACH,YAAY,EAAE,CAAC,IAAY,EAAe,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;KAC9D,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ConfigTypes, IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\n\nexport const mockConfigProvider = ((settings: Record<string, ConfigTypes> = {}): IConfigProviderBase => {\n settings[\"Fluid.GarbageCollection.TrackGCState\"] = \"true\";\n settings[\"Fluid.GarbageCollection.WriteDataAtRoot\"] = \"true\";\n return {\n getRawConfig: (name: string): ConfigTypes => settings[name],\n };\n});\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct";
|
|
6
|
+
import { IContainer } from "@fluidframework/container-definitions";
|
|
7
|
+
import { IGCRuntimeOptions, ISummarizer } from "@fluidframework/container-runtime";
|
|
8
|
+
import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
|
|
9
|
+
import { ITestObjectProvider } from "./testObjectProvider";
|
|
10
|
+
export declare function createSummarizerFromFactory(provider: ITestObjectProvider, container: IContainer, dataStoreFactory: IFluidDataStoreFactory, summaryVersion?: string, containerRuntimeFactoryType?: typeof ContainerRuntimeFactoryWithDefaultDataStore): Promise<ISummarizer>;
|
|
11
|
+
export declare function createSummarizer(provider: ITestObjectProvider, container: IContainer, summaryVersion?: string, gcOptions?: IGCRuntimeOptions): Promise<ISummarizer>;
|
|
12
|
+
export declare function summarizeNow(summarizer: ISummarizer, reason?: string): Promise<{
|
|
13
|
+
summaryTree: import("@fluidframework/protocol-definitions").ISummaryTree;
|
|
14
|
+
summaryVersion: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function waitForContainerConnection(container: IContainer): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=TestSummaryUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestSummaryUtils.d.ts","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,2CAA2C,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,UAAU,EAA6B,MAAM,uCAAuC,CAAC;AAE9F,OAAO,EACH,iBAAiB,EACjB,WAAW,EAEd,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEH,sBAAsB,EACzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAwB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AA6CjF,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,sBAAsB,EACxC,cAAc,CAAC,EAAE,MAAM,EACvB,2BAA2B,qDAA8C,GAC1E,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAED,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,iBAAiB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAWtB;AAED,wBAAsB,YAAY,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,GAAE,MAA0B;;;GAqB7F;AAED,wBAAsB,0BAA0B,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAIrF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.waitForContainerConnection = exports.summarizeNow = exports.createSummarizer = exports.createSummarizerFromFactory = void 0;
|
|
8
|
+
const aqueduct_1 = require("@fluidframework/aqueduct");
|
|
9
|
+
const common_utils_1 = require("@fluidframework/common-utils");
|
|
10
|
+
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
11
|
+
const container_loader_1 = require("@fluidframework/container-loader");
|
|
12
|
+
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
13
|
+
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
14
|
+
const TestConfigs_1 = require("./TestConfigs");
|
|
15
|
+
const summarizerClientType = "summarizer";
|
|
16
|
+
async function createSummarizerCore(container, loader, summaryVersion) {
|
|
17
|
+
const absoluteUrl = await container.getAbsoluteUrl("");
|
|
18
|
+
if (absoluteUrl === undefined) {
|
|
19
|
+
throw new Error("URL could not be resolved");
|
|
20
|
+
}
|
|
21
|
+
const request = {
|
|
22
|
+
headers: {
|
|
23
|
+
[container_definitions_1.LoaderHeader.cache]: false,
|
|
24
|
+
[container_definitions_1.LoaderHeader.clientDetails]: {
|
|
25
|
+
capabilities: { interactive: false },
|
|
26
|
+
type: summarizerClientType,
|
|
27
|
+
},
|
|
28
|
+
[driver_definitions_1.DriverHeader.summarizingClient]: true,
|
|
29
|
+
[container_definitions_1.LoaderHeader.reconnect]: false,
|
|
30
|
+
[container_definitions_1.LoaderHeader.version]: summaryVersion,
|
|
31
|
+
},
|
|
32
|
+
url: absoluteUrl,
|
|
33
|
+
};
|
|
34
|
+
const summarizerContainer = await loader.resolve(request);
|
|
35
|
+
await waitForContainerConnection(summarizerContainer);
|
|
36
|
+
const fluidObject = await (0, runtime_utils_1.requestFluidObject)(summarizerContainer, { url: "_summarizer" });
|
|
37
|
+
if (fluidObject.ISummarizer === undefined) {
|
|
38
|
+
throw new Error("Fluid object does not implement ISummarizer");
|
|
39
|
+
}
|
|
40
|
+
return fluidObject.ISummarizer;
|
|
41
|
+
}
|
|
42
|
+
const defaultSummaryOptions = {
|
|
43
|
+
summaryConfigOverrides: {
|
|
44
|
+
state: "disableHeuristics",
|
|
45
|
+
maxAckWaitTime: 10000,
|
|
46
|
+
maxOpsSinceLastSummary: 7000,
|
|
47
|
+
initialSummarizerDelayMs: 0,
|
|
48
|
+
summarizerClientElection: false,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
async function createSummarizerFromFactory(provider, container, dataStoreFactory, summaryVersion, containerRuntimeFactoryType = aqueduct_1.ContainerRuntimeFactoryWithDefaultDataStore) {
|
|
52
|
+
const innerRequestHandler = async (request, runtime) => runtime.IFluidHandleContext.resolveHandle(request);
|
|
53
|
+
const runtimeFactory = new containerRuntimeFactoryType(dataStoreFactory, [
|
|
54
|
+
[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],
|
|
55
|
+
], undefined, [innerRequestHandler], { summaryOptions: defaultSummaryOptions });
|
|
56
|
+
const loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], { configProvider: (0, TestConfigs_1.mockConfigProvider)() });
|
|
57
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
58
|
+
}
|
|
59
|
+
exports.createSummarizerFromFactory = createSummarizerFromFactory;
|
|
60
|
+
async function createSummarizer(provider, container, summaryVersion, gcOptions) {
|
|
61
|
+
const testContainerConfig = {
|
|
62
|
+
runtimeOptions: {
|
|
63
|
+
summaryOptions: defaultSummaryOptions,
|
|
64
|
+
gcOptions,
|
|
65
|
+
},
|
|
66
|
+
loaderProps: { configProvider: (0, TestConfigs_1.mockConfigProvider)() },
|
|
67
|
+
};
|
|
68
|
+
const loader = provider.makeTestLoader(testContainerConfig);
|
|
69
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
70
|
+
}
|
|
71
|
+
exports.createSummarizer = createSummarizer;
|
|
72
|
+
async function summarizeNow(summarizer, reason = "end-to-end test") {
|
|
73
|
+
const result = summarizer.summarizeOnDemand({ reason });
|
|
74
|
+
const submitResult = await result.summarySubmitted;
|
|
75
|
+
(0, common_utils_1.assert)(submitResult.success, "on-demand summary should submit");
|
|
76
|
+
(0, common_utils_1.assert)(submitResult.data.stage === "submit", "on-demand summary submitted data stage should be submit");
|
|
77
|
+
(0, common_utils_1.assert)(submitResult.data.summaryTree !== undefined, "summary tree should exist");
|
|
78
|
+
const broadcastResult = await result.summaryOpBroadcasted;
|
|
79
|
+
(0, common_utils_1.assert)(broadcastResult.success, "summary op should be broadcast");
|
|
80
|
+
const ackNackResult = await result.receivedSummaryAckOrNack;
|
|
81
|
+
(0, common_utils_1.assert)(ackNackResult.success, "summary op should be acked");
|
|
82
|
+
await new Promise((resolve) => process.nextTick(resolve));
|
|
83
|
+
return {
|
|
84
|
+
summaryTree: submitResult.data.summaryTree,
|
|
85
|
+
summaryVersion: ackNackResult.data.summaryAckOp.contents.handle,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
exports.summarizeNow = summarizeNow;
|
|
89
|
+
async function waitForContainerConnection(container) {
|
|
90
|
+
if (container.connectionState !== container_loader_1.ConnectionState.Connected) {
|
|
91
|
+
return new Promise((resolve) => container.once("connected", () => resolve()));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.waitForContainerConnection = waitForContainerConnection;
|
|
95
|
+
//# sourceMappingURL=TestSummaryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestSummaryUtils.js","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAuF;AACvF,+DAAsD;AACtD,iFAA8F;AAC9F,uEAAmE;AAOnE,2EAAkE;AAKlE,iEAAmE;AAEnE,+CAAmD;AAEnD,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,KAAK,UAAU,oBAAoB,CAAC,SAAqB,EAAE,MAAmB,EAAE,cAAuB;IACnG,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACvD,IAAI,WAAW,KAAK,SAAS,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAChD;IAED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AC,KAAK,KAAK,QAAQ,EACvC,yDAAyD,CAAC,CAAC;IAC/D,IAAA,qBAAM,EAAC,YAAY,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAEjF,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC;IAC1D,IAAA,qBAAM,EAAC,eAAe,CAAC,OAAO,EAAE,gCAAgC,CAAC,CAAC;IAElE,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC;IAC5D,IAAA,qBAAM,EAAC,aAAa,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;IAE5D,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAE1D,OAAO;QACH,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,WAAW;QAC1C,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM;KAClE,CAAC;AACN,CAAC;AArBD,oCAqBC;AAEM,KAAK,UAAU,0BAA0B,CAAC,SAAqB;IAClE,IAAI,SAAS,CAAC,eAAe,KAAK,kCAAe,CAAC,SAAS,EAAE;QACzD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KACjF;AACL,CAAC;AAJD,gEAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IHostLoader, LoaderHeader } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport {\n IGCRuntimeOptions,\n ISummarizer,\n ISummaryRuntimeOptions,\n} from \"@fluidframework/container-runtime\";\nimport { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport {\n IContainerRuntimeBase,\n IFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\nimport { ITestContainerConfig, ITestObjectProvider } from \"./testObjectProvider\";\nimport { mockConfigProvider } from \"./TestConfigs\";\n\nconst summarizerClientType = \"summarizer\";\n\nasync function createSummarizerCore(container: IContainer, loader: IHostLoader, summaryVersion?: string) {\n const absoluteUrl = await container.getAbsoluteUrl(\"\");\n if (absoluteUrl === undefined) {\n throw new Error(\"URL could not be resolved\");\n }\n\n const request: IRequest = {\n headers: {\n [LoaderHeader.cache]: false,\n [LoaderHeader.clientDetails]: {\n capabilities: { interactive: false },\n type: summarizerClientType,\n },\n [DriverHeader.summarizingClient]: true,\n [LoaderHeader.reconnect]: false,\n [LoaderHeader.version]: summaryVersion,\n },\n url: absoluteUrl,\n };\n const summarizerContainer = await loader.resolve(request);\n await waitForContainerConnection(summarizerContainer);\n\n const fluidObject =\n await requestFluidObject<FluidObject<ISummarizer>>(summarizerContainer, { url: \"_summarizer\" });\n if (fluidObject.ISummarizer === undefined) {\n throw new Error(\"Fluid object does not implement ISummarizer\");\n }\n return fluidObject.ISummarizer;\n}\n\nconst defaultSummaryOptions: ISummaryRuntimeOptions = {\n summaryConfigOverrides: {\n state: \"disableHeuristics\",\n maxAckWaitTime: 10000,\n maxOpsSinceLastSummary: 7000,\n initialSummarizerDelayMs: 0,\n summarizerClientElection: false,\n },\n};\n\nexport async function createSummarizerFromFactory(\n provider: ITestObjectProvider,\n container: IContainer,\n dataStoreFactory: IFluidDataStoreFactory,\n summaryVersion?: string,\n containerRuntimeFactoryType = ContainerRuntimeFactoryWithDefaultDataStore,\n): Promise<ISummarizer> {\n const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n const runtimeFactory = new containerRuntimeFactoryType(\n dataStoreFactory,\n [\n [dataStoreFactory.type, Promise.resolve(dataStoreFactory)],\n ],\n undefined,\n [innerRequestHandler],\n { summaryOptions: defaultSummaryOptions },\n );\n\n const loader = provider.createLoader(\n [[provider.defaultCodeDetails, runtimeFactory]],\n { configProvider: mockConfigProvider() },\n );\n\n return createSummarizerCore(container, loader, summaryVersion);\n}\n\nexport async function createSummarizer(\n provider: ITestObjectProvider,\n container: IContainer,\n summaryVersion?: string,\n gcOptions?: IGCRuntimeOptions,\n): Promise<ISummarizer> {\n const testContainerConfig: ITestContainerConfig = {\n runtimeOptions: {\n summaryOptions: defaultSummaryOptions,\n gcOptions,\n },\n loaderProps: { configProvider: mockConfigProvider() },\n };\n\n const loader = provider.makeTestLoader(testContainerConfig);\n return createSummarizerCore(container, loader, summaryVersion);\n}\n\nexport async function summarizeNow(summarizer: ISummarizer, reason: string = \"end-to-end test\") {\n const result = summarizer.summarizeOnDemand({ reason });\n\n const submitResult = await result.summarySubmitted;\n assert(submitResult.success, \"on-demand summary should submit\");\n assert(submitResult.data.stage === \"submit\",\n \"on-demand summary submitted data stage should be submit\");\n assert(submitResult.data.summaryTree !== undefined, \"summary tree should exist\");\n\n const broadcastResult = await result.summaryOpBroadcasted;\n assert(broadcastResult.success, \"summary op should be broadcast\");\n\n const ackNackResult = await result.receivedSummaryAckOrNack;\n assert(ackNackResult.success, \"summary op should be acked\");\n\n await new Promise((resolve) => process.nextTick(resolve));\n\n return {\n summaryTree: submitResult.data.summaryTree,\n summaryVersion: ackNackResult.data.summaryAckOp.contents.handle,\n };\n}\n\nexport async function waitForContainerConnection(container: IContainer): Promise<void> {\n if (container.connectionState !== ConnectionState.Connected) {\n return new Promise((resolve) => container.once(\"connected\", () => resolve()));\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,7 @@ export * from "./retry";
|
|
|
11
11
|
export * from "./testContainerRuntimeFactory";
|
|
12
12
|
export * from "./testFluidObject";
|
|
13
13
|
export * from "./timeoutUtils";
|
|
14
|
+
export * from "./DriverWrappers";
|
|
15
|
+
export * from "./TestSummaryUtils";
|
|
16
|
+
export * from "./TestConfigs";
|
|
14
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,4 +23,7 @@ __exportStar(require("./retry"), exports);
|
|
|
23
23
|
__exportStar(require("./testContainerRuntimeFactory"), exports);
|
|
24
24
|
__exportStar(require("./testFluidObject"), exports);
|
|
25
25
|
__exportStar(require("./timeoutUtils"), exports);
|
|
26
|
+
__exportStar(require("./DriverWrappers"), exports);
|
|
27
|
+
__exportStar(require("./TestSummaryUtils"), exports);
|
|
28
|
+
__exportStar(require("./TestConfigs"), exports);
|
|
26
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,uDAAqC;AACrC,2DAAyC;AACzC,gDAA8B;AAC9B,oDAAkC;AAClC,0CAAwB;AACxB,gEAA8C;AAC9C,oDAAkC;AAClC,iDAA+B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./interfaces\";\nexport * from \"./testObjectProvider\";\nexport * from \"./loaderContainerTracker\";\nexport * from \"./localLoader\";\nexport * from \"./localCodeLoader\";\nexport * from \"./retry\";\nexport * from \"./testContainerRuntimeFactory\";\nexport * from \"./testFluidObject\";\nexport * from \"./timeoutUtils\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,uDAAqC;AACrC,2DAAyC;AACzC,gDAA8B;AAC9B,oDAAkC;AAClC,0CAAwB;AACxB,gEAA8C;AAC9C,oDAAkC;AAClC,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,gDAA8B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./interfaces\";\nexport * from \"./testObjectProvider\";\nexport * from \"./loaderContainerTracker\";\nexport * from \"./localLoader\";\nexport * from \"./localCodeLoader\";\nexport * from \"./retry\";\nexport * from \"./testContainerRuntimeFactory\";\nexport * from \"./testFluidObject\";\nexport * from \"./timeoutUtils\";\nexport * from \"./DriverWrappers\";\nexport * from \"./TestSummaryUtils\";\nexport * from \"./TestConfigs\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderContainerTracker.d.ts","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAI7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAqB/D,qBAAa,sBAAuB,YAAW,uBAAuB;IAItD,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAHlD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IACrE,OAAO,CAAC,kBAAkB,CAAa;gBAEV,qBAAqB,GAAE,OAAe;IAEnE;;;OAGG;IACI,GAAG,CAAC,UAAU,SAAS,WAAW,EAAE,MAAM,EAAE,UAAU;IAiB7D;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAoBpB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACI,KAAK;IAUZ;;;;;;;;;;OAUG;IACU,kBAAkB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"loaderContainerTracker.d.ts","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAI7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAqB/D,qBAAa,sBAAuB,YAAW,uBAAuB;IAItD,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAHlD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IACrE,OAAO,CAAC,kBAAkB,CAAa;gBAEV,qBAAqB,GAAE,OAAe;IAEnE;;;OAGG;IACI,GAAG,CAAC,UAAU,SAAS,WAAW,EAAE,MAAM,EAAE,UAAU;IAiB7D;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAoBpB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACI,KAAK;IAUZ;;;;;;;;;;OAUG;IACU,kBAAkB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAwD3D;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAyBzB;;;;;OAKG;IACH,OAAO,CAAC,4BAA4B;IA0CpC;;;;;;;OAOG;YACW,qBAAqB;IA6BnC;;;OAGG;YACW,oBAAoB;IAclC;;OAEG;IACI,gBAAgB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAgBnD;;;OAGG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAexD;;;;OAIG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAIxD;;;;OAIG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAIxD;;OAEG;YACW,YAAY;IAqC1B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAyBzB;;OAEG;IACH,OAAO,CAAC,UAAU;IA8DlB;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAIxB"}
|
|
@@ -172,7 +172,8 @@ class LoaderContainerTracker {
|
|
|
172
172
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
173
173
|
debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c).index)}`);
|
|
174
174
|
waitingSequenceNumberSynchronized = false;
|
|
175
|
-
await Promise.all(dirtyContainers.map(async (c) => new Promise((resolve) => c.once("saved", resolve))
|
|
175
|
+
await Promise.all(dirtyContainers.map(async (c) => Promise.race([new Promise((resolve) => c.once("saved", resolve)),
|
|
176
|
+
new Promise((resolve) => c.once("closed", resolve))])));
|
|
176
177
|
}
|
|
177
178
|
// yield a turn to allow side effect of the ops we just processed execute before we check again
|
|
178
179
|
await new Promise((resolve) => { setTimeout(resolve, 0); });
|
|
@@ -1 +1 @@
|
|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AAC,CAAC;YAClE,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;gBAC7C,OAAO,CAAC,GAAG,KAAK,oBAAoB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC/C,OAAO,CAAC,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,UAAwB;QAC1C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACpG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;CACJ;AAtgBD,wDAsgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { Container } from \"@fluidframework/container-loader\";\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n // A short number for debug output\n index: number;\n\n // LoaderContainerTracker paused state\n paused: boolean;\n\n // Tracking trailing no-op that may or may be acked by the server so we can discount them\n // See issue #5629\n startTrailingNoOps: number;\n trailingNoOps: number;\n\n // Track last proposal to ensure no unresolved proposal\n lastProposal: number;\n}\n\nexport class LoaderContainerTracker implements IOpProcessingController {\n private readonly containers = new Map<IContainer, ContainerRecord>();\n private lastProposalSeqNum: number = 0;\n\n constructor(private readonly syncSummarizerClients: boolean = false) {}\n\n /**\n * Add a loader to start to track any container created from them\n * @param loader - loader to start tracking any container created.\n */\n public add<LoaderType extends IHostLoader>(loader: LoaderType) {\n // TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n const patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n const boundFn = fn.bind(loader);\n return async (...args: T[]) => {\n const container = await boundFn(...args);\n this.addContainer(container);\n return container;\n };\n };\n /* eslint-disable @typescript-eslint/unbound-method */\n loader.resolve = patch(loader.resolve);\n loader.createDetachedContainer = patch(loader.createDetachedContainer);\n loader.rehydrateDetachedContainerFromSnapshot = patch(loader.rehydrateDetachedContainerFromSnapshot);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Utility function to add container to be tracked.\n *\n * @param container - container to add\n */\n private addContainer(container: IContainer) {\n // ignore summarizer\n if (!container.deltaManager.clientDetails.capabilities.interactive && !this.syncSummarizerClients) { return; }\n\n // don't add container that is already tracked\n if (this.containers.has(container)) { return; }\n\n const record = {\n index: this.containers.size,\n paused: false,\n startTrailingNoOps: 0,\n trailingNoOps: 0,\n lastProposal: 0,\n };\n this.containers.set(container, record);\n this.trackTrailingNoOps(container, record);\n this.trackLastProposal(container);\n this.setupTrace(container, record.index);\n }\n\n /**\n * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n *\n * @param container - the container to track\n * @param record - the record to update the trailing op information\n */\n private trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n if (msg.type === MessageType.NoOp) {\n // Track the NoOp that was sent.\n if (record.trailingNoOps === 0) {\n // record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n record.startTrailingNoOps = msg.clientSequenceNumber;\n }\n record.trailingNoOps++;\n } else {\n // Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n record.trailingNoOps = 0;\n }\n }\n });\n\n container.deltaManager.inbound.on(\"push\", (message) => {\n // Received the no op back, update the record if we are tracking\n if (message.type === MessageType.NoOp\n && message.clientId === (container as Container).clientId\n && record.trailingNoOps !== 0\n && record.startTrailingNoOps <= message.clientSequenceNumber\n ) {\n // NoOp might have coalesced and skipped ahead some sequence number\n // update the record and skip ahead as well\n const oldStartTrailingNoOps = record.startTrailingNoOps;\n record.startTrailingNoOps = message.clientSequenceNumber + 1;\n record.trailingNoOps -= (record.startTrailingNoOps - oldStartTrailingNoOps);\n }\n });\n\n container.on(\"disconnected\", () => {\n // reset on disconnect.\n record.trailingNoOps = 0;\n });\n }\n\n private trackLastProposal(container: IContainer) {\n container.on(\"codeDetailsProposed\", (value, proposal) => {\n if (proposal.sequenceNumber > this.lastProposalSeqNum) {\n this.lastProposalSeqNum = proposal.sequenceNumber;\n }\n });\n }\n\n /**\n * Reset the tracker, closing all containers and stop tracking them.\n */\n public reset() {\n this.lastProposalSeqNum = 0;\n for (const container of this.containers.keys()) {\n container.close();\n }\n this.containers.clear();\n\n // REVIEW: do we need to unpatch the loaders?\n }\n\n /**\n * Make sure all the tracked containers are synchronized.\n * - No isDirty (non-readonly) containers\n * - No extra clientId in quorum of any container that is not tracked and still opened.\n * - i.e. no pending Join/Leave message.\n * - No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n * - lastSequenceNumber of all container is the same\n * - clientSequenceNumberObserved is the same as clientSequenceNumber sent\n * - this overlaps with !isDirty, but include task scheduler ops.\n * - Trailing NoOp is tracked and don't count as pending ops.\n */\n public async ensureSynchronized(...containers: IContainer[]) {\n const resumed = this.resumeProcessing(...containers);\n\n let waitingSequenceNumberSynchronized = false;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const containersToApply = this.getContainers(containers);\n if (containersToApply.length === 0) { break; }\n\n // Ignore readonly dirty containers, because it can't sent up and nothing can be done about it being dirty\n const dirtyContainers = containersToApply.filter((c) => {\n const { deltaManager, isDirty } = c;\n return deltaManager.readOnlyInfo.readonly !== true && isDirty;\n });\n if (dirtyContainers.length === 0) {\n // Wait for all the leave messages\n const pendingClients = this.getPendingClients(containersToApply);\n if (pendingClients.length === 0) {\n if (this.isSequenceNumberSynchronized(containersToApply)) {\n // done, we are in sync\n break;\n }\n if (!waitingSequenceNumberSynchronized) {\n // Only write it out once\n waitingSequenceNumberSynchronized = true;\n debugWait(\"Waiting for sequence number synchronized\");\n await this.waitForAnyInboundOps(containersToApply);\n }\n } else {\n waitingSequenceNumberSynchronized = false;\n await this.waitForPendingClients(pendingClients);\n }\n } else {\n // Wait for all the containers to be saved\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c)!.index)}`);\n waitingSequenceNumberSynchronized = false;\n await Promise.all(dirtyContainers.map(async (c) => new Promise((resolve) => c.once(\"saved\", resolve))));\n }\n\n // yield a turn to allow side effect of the ops we just processed execute before we check again\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Pause all container that was resumed\n // don't call pause if resumed is empty and pause everything, which is not what we want\n if (resumed.length !== 0) {\n await this.pauseProcessing(...resumed);\n }\n\n debugWait(\"Synchronized\");\n }\n\n /**\n * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * @param containersToApply - the set of containers to check\n */\n private getPendingClients(containersToApply: IContainer[]) {\n // All the clientId we track should be a superset of the quorum, otherwise, we are missing\n // leave messages\n const openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n const openedClientId = openedDocuments.map((container) => (container as Container).clientId);\n\n const pendingClients: [IContainer, Set<string>][] = [];\n containersToApply.forEach((container) => {\n const pendingClientId = new Set<string>();\n const quorum = container.getQuorum();\n quorum.getMembers().forEach((client, clientId) => {\n // ignore summarizer\n if (!client.client.details.capabilities.interactive && !this.syncSummarizerClients) { return; }\n if (!openedClientId.includes(clientId)) {\n pendingClientId.add(clientId);\n }\n });\n\n if (pendingClientId.size !== 0) {\n pendingClients.push([container, pendingClientId]);\n }\n });\n return pendingClients;\n }\n\n /**\n * Utility to check synchronization based on sequence number\n * See ensureSynchronized for more detail\n *\n * @param containersToApply - the set of containers to check\n */\n private isSequenceNumberSynchronized(containersToApply: IContainer[]) {\n // clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n // We need both client sequence number and isDirty check because:\n // - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n // - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n // the ops in the first place, clientSequenceNumber is not assigned\n\n const isClientSequenceNumberSynchronized = containersToApply.every((container) => {\n if (container.deltaManager.readOnlyInfo.readonly === true) {\n // Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n // because we transition to readonly when outbound is not empty or the in transit op got lost\n return true;\n }\n // Note that in read only mode, the op won't be submitted\n let deltaManager = (container.deltaManager as any);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { trailingNoOps } = this.containers.get(container)!;\n // Back-compat: clientSequenceNumber & clientSequenceNumberObserved moved to ConnectionManager in 0.53\n if (!(\"clientSequenceNumber\" in deltaManager)) {\n deltaManager = deltaManager.connectionManager;\n }\n assert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n assert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n return deltaManager.clientSequenceNumber ===\n (deltaManager.clientSequenceNumberObserved as number) + trailingNoOps;\n });\n\n if (!isClientSequenceNumberSynchronized) {\n return false;\n }\n\n const minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n if (minSeqNum < this.lastProposalSeqNum) {\n // There is an unresolved proposal\n return false;\n }\n\n // Check to see if all the container has process the same number of ops.\n const seqNum = containersToApply[0].deltaManager.lastSequenceNumber;\n return containersToApply.every((c) => c.deltaManager.lastSequenceNumber === seqNum);\n }\n\n /**\n * Utility to wait for any clientId in quorum that is NOT associated with any container we\n * tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * Note that this function doesn't account for container that got added after we started waiting\n *\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n const unconnectedClients =\n Array.from(this.containers.keys()).filter((c) => !c.closed && !(c as Container).connected);\n return Promise.all(pendingClients.map(async ([container, pendingClientId]) => {\n return new Promise<void>((resolve) => {\n const cleanup = () => {\n unconnectedClients.forEach((c) => c.off(\"connected\", handler));\n container.getQuorum().off(\"removeMember\", handler);\n };\n const handler = (clientId: string) => {\n pendingClientId.delete(clientId);\n if (pendingClientId.size === 0) {\n cleanup();\n resolve();\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const index = this.containers.get(container)!.index;\n debugWait(`${index}: Waiting for pending clients ${Array.from(pendingClientId.keys())}`);\n unconnectedClients.forEach((c) => c.on(\"connected\", handler));\n container.getQuorum().on(\"removeMember\", handler);\n container.on(\"closed\", () => {\n cleanup();\n resolve();\n });\n });\n }));\n }\n\n /**\n * Utility to wait for any inbound ops from a set of containers\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForAnyInboundOps(containersToApply: IContainer[]) {\n return new Promise<void>((resolve) => {\n const handler = () => {\n containersToApply.map((c) => {\n c.deltaManager.inbound.off(\"push\", handler);\n });\n resolve();\n };\n containersToApply.map((c) => {\n c.deltaManager.inbound.on(\"push\", handler);\n });\n });\n }\n\n /**\n * Resume all queue activities on all paused tracked containers and return them\n */\n public resumeProcessing(...containers: IContainer[]) {\n const resumed: IContainer[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record?.paused === true) {\n debugWait(`${record.index}: container resumed`);\n container.deltaManager.inbound.resume();\n container.deltaManager.outbound.resume();\n resumed.push(container);\n record.paused = false;\n }\n }\n return resumed;\n }\n\n /**\n * Pause all queue activities on the containers given, or all tracked containers\n * Any containers given that is not tracked will be ignored.\n */\n public async pauseProcessing(...containers: IContainer[]) {\n const pauseP: Promise<void>[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record !== undefined && !record.paused) {\n debugWait(`${record.index}: container paused`);\n pauseP.push(container.deltaManager.inbound.pause());\n pauseP.push(container.deltaManager.outbound.pause());\n record.paused = true;\n }\n }\n await Promise.all(pauseP);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * inbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processIncoming(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.inbound);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * outbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processOutgoing(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.outbound);\n }\n\n /**\n * Implementation of processIncoming and processOutgoing\n */\n private async processQueue<U>(containers: IContainer[], getQueue: (container: IContainer) => IDeltaQueue<U>) {\n await this.pauseProcessing(...containers);\n const resumed: IDeltaQueue<U>[] = [];\n\n const containersToApply = this.getContainers(containers);\n const inflightTracker = new Map<IContainer, number>();\n const cleanup: (() => void)[] = [];\n for (const container of containersToApply) {\n const queue = getQueue(container);\n\n // track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n // to make sure they are sequenced.\n cleanup.push(this.setupInOutTracker(container, inflightTracker));\n queue.resume();\n resumed.push(queue);\n }\n\n while (resumed.some((queue) => !queue.idle)) {\n debugWait(\"Wait until queue is idle\");\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Make sure all the op that we sent out are acked first\n // This is no op if we are processing incoming\n if (inflightTracker.size) {\n debugWait(\"Wait for inflight ops\");\n do {\n await this.waitForAnyInboundOps(containersToApply);\n } while (inflightTracker.size);\n }\n\n // remove the handlers\n cleanup.forEach((clean) => clean());\n\n await Promise.all(resumed.map(async (queue) => queue.pause()));\n }\n\n /**\n * Utility to set up listener to track the outbound ops until it round trip back\n * Returns a function to remove the handler after it is done.\n *\n * @param container - the container to setup\n * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n */\n private setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n const outHandler = (messages: IDocumentMessage[]) => {\n for (const message of messages) {\n if (message.type !== MessageType.NoOp) {\n inflightTracker.set(container, message.clientSequenceNumber);\n }\n }\n };\n const inHandler = (message: ISequencedDocumentMessage) => {\n if (message.type !== MessageType.NoOp\n && message.clientId === (container as Container).clientId\n && inflightTracker.get(container) === message.clientSequenceNumber) {\n inflightTracker.delete(container);\n }\n };\n\n container.deltaManager.outbound.on(\"op\", outHandler);\n container.deltaManager.inbound.on(\"push\", inHandler);\n\n return () => {\n container.deltaManager.outbound.off(\"op\", outHandler);\n container.deltaManager.inbound.off(\"push\", inHandler);\n };\n }\n\n /**\n * Setup debug traces for connection and ops\n */\n private setupTrace(container: IContainer, index: number) {\n if (debugOp.enabled) {\n const getContentsString = (type: string, msgContents: any) => {\n try {\n if (type !== MessageType.Operation) {\n if (typeof msgContents === \"string\") { return msgContents; }\n return JSON.stringify(msgContents);\n }\n let address = \"\";\n\n // contents comes in the wire as JSON string (\"push\" event)\n // But already parsed when apply (\"op\" event)\n let contents = typeof msgContents === \"string\" ?\n JSON.parse(msgContents) : msgContents;\n while (contents !== undefined && contents !== null) {\n if (contents.contents?.address !== undefined) {\n address += `/${contents.contents.address}`;\n contents = contents.contents.contents;\n } else if (contents.content?.address !== undefined) {\n address += `/${contents.content.address}`;\n contents = contents.content.contents;\n } else {\n break;\n }\n }\n if (address) {\n return `${address} ${JSON.stringify(contents)}`;\n }\n return JSON.stringify(contents);\n } catch (e: any) {\n return `${e.message}: ${e.stack}`;\n }\n };\n debugOp(`${index}: ADD: clientId: ${(container as Container).clientId}`);\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n debugOp(`${index}: OUT: `\n + `cli: ${msg.clientSequenceNumber.toString().padStart(3)} `\n + `rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n }\n });\n const getInboundHandler = (type: string) => {\n return (msg: ISequencedDocumentMessage) => {\n const clientSeq = msg.clientId === (container as Container).clientId ?\n `cli: ${msg.clientSequenceNumber.toString().padStart(3)}` : \" \";\n debugOp(`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} `\n + `${clientSeq} min: ${msg.minimumSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n };\n };\n container.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n container.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n container.deltaManager.on(\"connect\", (details) => {\n debugOp(`${index}: CON: clientId: ${details.clientId}`);\n });\n container.deltaManager.on(\"disconnect\", (reason) => {\n debugOp(`${index}: DIS: ${reason}`);\n });\n }\n }\n\n /**\n * Filter out the opened containers based on param.\n * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n * all open containers.\n */\n private getContainers(containers: IContainer[]) {\n const containersToApply = containers.length === 0 ? Array.from(this.containers.keys()) : containers;\n return containersToApply.filter((container) => !container.closed);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAGtD,+EAAgH;AAChH,mCAAgC;AAGhC,MAAM,OAAO,GAAG,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,MAAM,SAAS,GAAG,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAkBvC,MAAa,sBAAsB;IAI/B,YAA6B,wBAAiC,KAAK;QAAtC,0BAAqB,GAArB,q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AAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC/C,OAAO,CAAC,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,UAAwB;QAC1C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACpG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;CACJ;AAzgBD,wDAygBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { Container } from \"@fluidframework/container-loader\";\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n // A short number for debug output\n index: number;\n\n // LoaderContainerTracker paused state\n paused: boolean;\n\n // Tracking trailing no-op that may or may be acked by the server so we can discount them\n // See issue #5629\n startTrailingNoOps: number;\n trailingNoOps: number;\n\n // Track last proposal to ensure no unresolved proposal\n lastProposal: number;\n}\n\nexport class LoaderContainerTracker implements IOpProcessingController {\n private readonly containers = new Map<IContainer, ContainerRecord>();\n private lastProposalSeqNum: number = 0;\n\n constructor(private readonly syncSummarizerClients: boolean = false) {}\n\n /**\n * Add a loader to start to track any container created from them\n * @param loader - loader to start tracking any container created.\n */\n public add<LoaderType extends IHostLoader>(loader: LoaderType) {\n // TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n const patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n const boundFn = fn.bind(loader);\n return async (...args: T[]) => {\n const container = await boundFn(...args);\n this.addContainer(container);\n return container;\n };\n };\n /* eslint-disable @typescript-eslint/unbound-method */\n loader.resolve = patch(loader.resolve);\n loader.createDetachedContainer = patch(loader.createDetachedContainer);\n loader.rehydrateDetachedContainerFromSnapshot = patch(loader.rehydrateDetachedContainerFromSnapshot);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Utility function to add container to be tracked.\n *\n * @param container - container to add\n */\n private addContainer(container: IContainer) {\n // ignore summarizer\n if (!container.deltaManager.clientDetails.capabilities.interactive && !this.syncSummarizerClients) { return; }\n\n // don't add container that is already tracked\n if (this.containers.has(container)) { return; }\n\n const record = {\n index: this.containers.size,\n paused: false,\n startTrailingNoOps: 0,\n trailingNoOps: 0,\n lastProposal: 0,\n };\n this.containers.set(container, record);\n this.trackTrailingNoOps(container, record);\n this.trackLastProposal(container);\n this.setupTrace(container, record.index);\n }\n\n /**\n * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n *\n * @param container - the container to track\n * @param record - the record to update the trailing op information\n */\n private trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n if (msg.type === MessageType.NoOp) {\n // Track the NoOp that was sent.\n if (record.trailingNoOps === 0) {\n // record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n record.startTrailingNoOps = msg.clientSequenceNumber;\n }\n record.trailingNoOps++;\n } else {\n // Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n record.trailingNoOps = 0;\n }\n }\n });\n\n container.deltaManager.inbound.on(\"push\", (message) => {\n // Received the no op back, update the record if we are tracking\n if (message.type === MessageType.NoOp\n && message.clientId === (container as Container).clientId\n && record.trailingNoOps !== 0\n && record.startTrailingNoOps <= message.clientSequenceNumber\n ) {\n // NoOp might have coalesced and skipped ahead some sequence number\n // update the record and skip ahead as well\n const oldStartTrailingNoOps = record.startTrailingNoOps;\n record.startTrailingNoOps = message.clientSequenceNumber + 1;\n record.trailingNoOps -= (record.startTrailingNoOps - oldStartTrailingNoOps);\n }\n });\n\n container.on(\"disconnected\", () => {\n // reset on disconnect.\n record.trailingNoOps = 0;\n });\n }\n\n private trackLastProposal(container: IContainer) {\n container.on(\"codeDetailsProposed\", (value, proposal) => {\n if (proposal.sequenceNumber > this.lastProposalSeqNum) {\n this.lastProposalSeqNum = proposal.sequenceNumber;\n }\n });\n }\n\n /**\n * Reset the tracker, closing all containers and stop tracking them.\n */\n public reset() {\n this.lastProposalSeqNum = 0;\n for (const container of this.containers.keys()) {\n container.close();\n }\n this.containers.clear();\n\n // REVIEW: do we need to unpatch the loaders?\n }\n\n /**\n * Make sure all the tracked containers are synchronized.\n * - No isDirty (non-readonly) containers\n * - No extra clientId in quorum of any container that is not tracked and still opened.\n * - i.e. no pending Join/Leave message.\n * - No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n * - lastSequenceNumber of all container is the same\n * - clientSequenceNumberObserved is the same as clientSequenceNumber sent\n * - this overlaps with !isDirty, but include task scheduler ops.\n * - Trailing NoOp is tracked and don't count as pending ops.\n */\n public async ensureSynchronized(...containers: IContainer[]) {\n const resumed = this.resumeProcessing(...containers);\n\n let waitingSequenceNumberSynchronized = false;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const containersToApply = this.getContainers(containers);\n if (containersToApply.length === 0) { break; }\n\n // Ignore readonly dirty containers, because it can't sent up and nothing can be done about it being dirty\n const dirtyContainers = containersToApply.filter((c) => {\n const { deltaManager, isDirty } = c;\n return deltaManager.readOnlyInfo.readonly !== true && isDirty;\n });\n if (dirtyContainers.length === 0) {\n // Wait for all the leave messages\n const pendingClients = this.getPendingClients(containersToApply);\n if (pendingClients.length === 0) {\n if (this.isSequenceNumberSynchronized(containersToApply)) {\n // done, we are in sync\n break;\n }\n if (!waitingSequenceNumberSynchronized) {\n // Only write it out once\n waitingSequenceNumberSynchronized = true;\n debugWait(\"Waiting for sequence number synchronized\");\n await this.waitForAnyInboundOps(containersToApply);\n }\n } else {\n waitingSequenceNumberSynchronized = false;\n await this.waitForPendingClients(pendingClients);\n }\n } else {\n // Wait for all the containers to be saved\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c)!.index)}`);\n waitingSequenceNumberSynchronized = false;\n await Promise.all(dirtyContainers.map(async (c) => Promise.race(\n [new Promise((resolve) => c.once(\"saved\", resolve)),\n new Promise((resolve) => c.once(\"closed\", resolve))],\n )));\n }\n\n // yield a turn to allow side effect of the ops we just processed execute before we check again\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Pause all container that was resumed\n // don't call pause if resumed is empty and pause everything, which is not what we want\n if (resumed.length !== 0) {\n await this.pauseProcessing(...resumed);\n }\n\n debugWait(\"Synchronized\");\n }\n\n /**\n * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * @param containersToApply - the set of containers to check\n */\n private getPendingClients(containersToApply: IContainer[]) {\n // All the clientId we track should be a superset of the quorum, otherwise, we are missing\n // leave messages\n const openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n const openedClientId = openedDocuments.map((container) => (container as Container).clientId);\n\n const pendingClients: [IContainer, Set<string>][] = [];\n containersToApply.forEach((container) => {\n const pendingClientId = new Set<string>();\n const quorum = container.getQuorum();\n quorum.getMembers().forEach((client, clientId) => {\n // ignore summarizer\n if (!client.client.details.capabilities.interactive && !this.syncSummarizerClients) { return; }\n if (!openedClientId.includes(clientId)) {\n pendingClientId.add(clientId);\n }\n });\n\n if (pendingClientId.size !== 0) {\n pendingClients.push([container, pendingClientId]);\n }\n });\n return pendingClients;\n }\n\n /**\n * Utility to check synchronization based on sequence number\n * See ensureSynchronized for more detail\n *\n * @param containersToApply - the set of containers to check\n */\n private isSequenceNumberSynchronized(containersToApply: IContainer[]) {\n // clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n // We need both client sequence number and isDirty check because:\n // - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n // - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n // the ops in the first place, clientSequenceNumber is not assigned\n\n const isClientSequenceNumberSynchronized = containersToApply.every((container) => {\n if (container.deltaManager.readOnlyInfo.readonly === true) {\n // Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n // because we transition to readonly when outbound is not empty or the in transit op got lost\n return true;\n }\n // Note that in read only mode, the op won't be submitted\n let deltaManager = (container.deltaManager as any);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { trailingNoOps } = this.containers.get(container)!;\n // Back-compat: clientSequenceNumber & clientSequenceNumberObserved moved to ConnectionManager in 0.53\n if (!(\"clientSequenceNumber\" in deltaManager)) {\n deltaManager = deltaManager.connectionManager;\n }\n assert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n assert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n return deltaManager.clientSequenceNumber ===\n (deltaManager.clientSequenceNumberObserved as number) + trailingNoOps;\n });\n\n if (!isClientSequenceNumberSynchronized) {\n return false;\n }\n\n const minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n if (minSeqNum < this.lastProposalSeqNum) {\n // There is an unresolved proposal\n return false;\n }\n\n // Check to see if all the container has process the same number of ops.\n const seqNum = containersToApply[0].deltaManager.lastSequenceNumber;\n return containersToApply.every((c) => c.deltaManager.lastSequenceNumber === seqNum);\n }\n\n /**\n * Utility to wait for any clientId in quorum that is NOT associated with any container we\n * tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * Note that this function doesn't account for container that got added after we started waiting\n *\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n const unconnectedClients =\n Array.from(this.containers.keys()).filter((c) => !c.closed && !(c as Container).connected);\n return Promise.all(pendingClients.map(async ([container, pendingClientId]) => {\n return new Promise<void>((resolve) => {\n const cleanup = () => {\n unconnectedClients.forEach((c) => c.off(\"connected\", handler));\n container.getQuorum().off(\"removeMember\", handler);\n };\n const handler = (clientId: string) => {\n pendingClientId.delete(clientId);\n if (pendingClientId.size === 0) {\n cleanup();\n resolve();\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const index = this.containers.get(container)!.index;\n debugWait(`${index}: Waiting for pending clients ${Array.from(pendingClientId.keys())}`);\n unconnectedClients.forEach((c) => c.on(\"connected\", handler));\n container.getQuorum().on(\"removeMember\", handler);\n container.on(\"closed\", () => {\n cleanup();\n resolve();\n });\n });\n }));\n }\n\n /**\n * Utility to wait for any inbound ops from a set of containers\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForAnyInboundOps(containersToApply: IContainer[]) {\n return new Promise<void>((resolve) => {\n const handler = () => {\n containersToApply.map((c) => {\n c.deltaManager.inbound.off(\"push\", handler);\n });\n resolve();\n };\n containersToApply.map((c) => {\n c.deltaManager.inbound.on(\"push\", handler);\n });\n });\n }\n\n /**\n * Resume all queue activities on all paused tracked containers and return them\n */\n public resumeProcessing(...containers: IContainer[]) {\n const resumed: IContainer[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record?.paused === true) {\n debugWait(`${record.index}: container resumed`);\n container.deltaManager.inbound.resume();\n container.deltaManager.outbound.resume();\n resumed.push(container);\n record.paused = false;\n }\n }\n return resumed;\n }\n\n /**\n * Pause all queue activities on the containers given, or all tracked containers\n * Any containers given that is not tracked will be ignored.\n */\n public async pauseProcessing(...containers: IContainer[]) {\n const pauseP: Promise<void>[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record !== undefined && !record.paused) {\n debugWait(`${record.index}: container paused`);\n pauseP.push(container.deltaManager.inbound.pause());\n pauseP.push(container.deltaManager.outbound.pause());\n record.paused = true;\n }\n }\n await Promise.all(pauseP);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * inbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processIncoming(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.inbound);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * outbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processOutgoing(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.outbound);\n }\n\n /**\n * Implementation of processIncoming and processOutgoing\n */\n private async processQueue<U>(containers: IContainer[], getQueue: (container: IContainer) => IDeltaQueue<U>) {\n await this.pauseProcessing(...containers);\n const resumed: IDeltaQueue<U>[] = [];\n\n const containersToApply = this.getContainers(containers);\n const inflightTracker = new Map<IContainer, number>();\n const cleanup: (() => void)[] = [];\n for (const container of containersToApply) {\n const queue = getQueue(container);\n\n // track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n // to make sure they are sequenced.\n cleanup.push(this.setupInOutTracker(container, inflightTracker));\n queue.resume();\n resumed.push(queue);\n }\n\n while (resumed.some((queue) => !queue.idle)) {\n debugWait(\"Wait until queue is idle\");\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Make sure all the op that we sent out are acked first\n // This is no op if we are processing incoming\n if (inflightTracker.size) {\n debugWait(\"Wait for inflight ops\");\n do {\n await this.waitForAnyInboundOps(containersToApply);\n } while (inflightTracker.size);\n }\n\n // remove the handlers\n cleanup.forEach((clean) => clean());\n\n await Promise.all(resumed.map(async (queue) => queue.pause()));\n }\n\n /**\n * Utility to set up listener to track the outbound ops until it round trip back\n * Returns a function to remove the handler after it is done.\n *\n * @param container - the container to setup\n * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n */\n private setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n const outHandler = (messages: IDocumentMessage[]) => {\n for (const message of messages) {\n if (message.type !== MessageType.NoOp) {\n inflightTracker.set(container, message.clientSequenceNumber);\n }\n }\n };\n const inHandler = (message: ISequencedDocumentMessage) => {\n if (message.type !== MessageType.NoOp\n && message.clientId === (container as Container).clientId\n && inflightTracker.get(container) === message.clientSequenceNumber) {\n inflightTracker.delete(container);\n }\n };\n\n container.deltaManager.outbound.on(\"op\", outHandler);\n container.deltaManager.inbound.on(\"push\", inHandler);\n\n return () => {\n container.deltaManager.outbound.off(\"op\", outHandler);\n container.deltaManager.inbound.off(\"push\", inHandler);\n };\n }\n\n /**\n * Setup debug traces for connection and ops\n */\n private setupTrace(container: IContainer, index: number) {\n if (debugOp.enabled) {\n const getContentsString = (type: string, msgContents: any) => {\n try {\n if (type !== MessageType.Operation) {\n if (typeof msgContents === \"string\") { return msgContents; }\n return JSON.stringify(msgContents);\n }\n let address = \"\";\n\n // contents comes in the wire as JSON string (\"push\" event)\n // But already parsed when apply (\"op\" event)\n let contents = typeof msgContents === \"string\" ?\n JSON.parse(msgContents) : msgContents;\n while (contents !== undefined && contents !== null) {\n if (contents.contents?.address !== undefined) {\n address += `/${contents.contents.address}`;\n contents = contents.contents.contents;\n } else if (contents.content?.address !== undefined) {\n address += `/${contents.content.address}`;\n contents = contents.content.contents;\n } else {\n break;\n }\n }\n if (address) {\n return `${address} ${JSON.stringify(contents)}`;\n }\n return JSON.stringify(contents);\n } catch (e: any) {\n return `${e.message}: ${e.stack}`;\n }\n };\n debugOp(`${index}: ADD: clientId: ${(container as Container).clientId}`);\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n debugOp(`${index}: OUT: `\n + `cli: ${msg.clientSequenceNumber.toString().padStart(3)} `\n + `rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n }\n });\n const getInboundHandler = (type: string) => {\n return (msg: ISequencedDocumentMessage) => {\n const clientSeq = msg.clientId === (container as Container).clientId ?\n `cli: ${msg.clientSequenceNumber.toString().padStart(3)}` : \" \";\n debugOp(`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} `\n + `${clientSeq} min: ${msg.minimumSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n };\n };\n container.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n container.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n container.deltaManager.on(\"connect\", (details) => {\n debugOp(`${index}: CON: clientId: ${details.clientId}`);\n });\n container.deltaManager.on(\"disconnect\", (reason) => {\n debugOp(`${index}: DIS: ${reason}`);\n });\n }\n }\n\n /**\n * Filter out the opened containers based on param.\n * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n * all open containers.\n */\n private getContainers(containers: IContainer[]) {\n const containersToApply = containers.length === 0 ? Array.from(this.containers.keys()) : containers;\n return containersToApply.filter((container) => !container.closed);\n }\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/test-utils";
|
|
8
|
-
export declare const pkgVersion = "1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.1.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/test-utils";
|
|
11
|
-
exports.pkgVersion = "1.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.1.0.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.0.0\";\n"]}
|
|
@@ -101,6 +101,7 @@ export declare class TestObjectProvider implements ITestObjectProvider {
|
|
|
101
101
|
*/
|
|
102
102
|
constructor(LoaderConstructor: typeof Loader, driver: ITestDriver, createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
|
|
103
103
|
get logger(): EventAndErrorTrackingLogger;
|
|
104
|
+
set logger(logger: EventAndErrorTrackingLogger);
|
|
104
105
|
get documentServiceFactory(): IDocumentServiceFactory;
|
|
105
106
|
get urlResolver(): IUrlResolver;
|
|
106
107
|
get documentId(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACvH,OAAO,EACH,YAAY,EACZ,MAAM,EAET,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEzG,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AAEvF,OAAO,EAAgC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAO3D,MAAM,WAAW,uBAAuB;IACpC,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,gBAAgB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,mBAAmB;IAChC,qBAAqB,EAAE,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C,CAAC,EAC9D,WAAW,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;IAmBvC;;;;;;;;OAQG;IACU,eAAe,CAAC,UAAU,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;IAkBhF,aAAa,CACtB,UAAU,EAAE,eAAe,EAC3B,WAAW,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EACnC,aAAa,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAKxD;;;;OAIG;IACI,cAAc,CAAC,mBAAmB,CAAC,EAAE,oBAAoB;IAOhE;;;;OAIG;IACU,iBAAiB,CAAC,mBAAmB,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkB/F;;;;;OAKG;IACU,iBAAiB,CAC1B,mBAAmB,CAAC,EAAE,oBAAoB,EAC1C,aAAa,CAAC,EAAE,cAAc,GAC/B,OAAO,CAAC,UAAU,CAAC;IAWf,KAAK;IAaC,kBAAkB;IAIlB,sBAAsB,CAAC,SAAS,EAAE,UAAU;IAYzD,gBAAgB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS;IAI/C,2BAA2B,CAAC,qBAAqB,GAAE,OAAe;CAI5E;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,2BAA2B,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,qBAa9G"}
|
|
@@ -140,6 +140,9 @@ class TestObjectProvider {
|
|
|
140
140
|
}
|
|
141
141
|
return this._logger;
|
|
142
142
|
}
|
|
143
|
+
set logger(logger) {
|
|
144
|
+
this._logger = logger;
|
|
145
|
+
}
|
|
143
146
|
get documentServiceFactory() {
|
|
144
147
|
if (!this._documentServiceFactory) {
|
|
145
148
|
this._documentServiceFactory = this.driver.createDocumentServiceFactory();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA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EAAE;QACtB,OAAO;KACV;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,2BAA2B,EAAE,CAAC;IACrD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;AACL,CAAC;AAbD,wEAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer, IHostLoader, IFluidCodeDetails } from \"@fluidframework/container-definitions\";\nimport { ITelemetryGenericEvent, ITelemetryBaseLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport {\n ILoaderProps,\n Loader,\n waitContainerToCatchUp as waitContainerToCatchUp_original,\n} from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { ChildLogger, MultiSinkLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\nimport { createAndAttachContainer } from \"./localLoader\";\nimport { ChannelFactoryRegistry } from \"./testFluidObject\";\n\nconst defaultCodeDetails: IFluidCodeDetails = {\n package: \"defaultTestPackage\",\n config: {},\n};\n\nexport interface IOpProcessingController {\n processIncoming(...containers: IContainer[]): Promise<void>;\n processOutgoing(...containers: IContainer[]): Promise<void>;\n pauseProcessing(...containers: IContainer[]): Promise<void>;\n resumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ): IHostLoader;\n createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;\n loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer>;\n\n /**\n * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n */\n makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;\n /**\n *\n * @param url - Resolved container URL\n */\n updateDocumentId(url: IResolvedUrl | undefined): void;\n\n logger: ITelemetryBaseLogger;\n documentServiceFactory: IDocumentServiceFactory;\n urlResolver: IUrlResolver;\n defaultCodeDetails: IFluidCodeDetails;\n opProcessingController: IOpProcessingController;\n\n ensureSynchronized(): Promise<void>;\n reset(): void;\n\n documentId: string;\n driver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n Primed, // default\n Test,\n}\n\nexport interface ITestContainerConfig {\n /** TestFluidDataObject instead of PrimedDataStore */\n fluidDataObjectType?: DataObjectFactoryType;\n\n /** An array of channel name and DDS factory pair to create on container creation time */\n registry?: ChannelFactoryRegistry;\n\n /** Container runtime options for the container instance */\n runtimeOptions?: IContainerRuntimeOptions;\n\n /** Loader options for the loader used to create containers */\n loaderProps?: Partial<ILoaderProps>;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n get(): string;\n update(resolvedUrl?: IResolvedUrl): void;\n reset(): void;\n}\n\n/**\n * Document ID is treated differently by test drivers. The key difference is in generating\n * a new container ID and accessing the container in multi-instance test cases.\n */\nfunction getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {\n let documentId = createDocumentId();\n switch (type) {\n case \"odsp\":\n return {\n get: () => documentId,\n update: () => { }, // do not update the document ID in odsp test cases\n reset: () => { documentId = createDocumentId(); },\n };\n default:\n return {\n get: () => documentId,\n update: (resolvedUrl?: IResolvedUrl) => {\n // Extract the document ID from the resolved container's URL and reset the ID property\n ensureFluidResolvedUrl(resolvedUrl);\n documentId = resolvedUrl.id ?? documentId;\n },\n reset: () => { documentId = createDocumentId(); },\n };\n }\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n */\nexport class EventAndErrorTrackingLogger extends TelemetryLogger {\n constructor(private readonly baseLogger: ITelemetryBaseLogger) {\n super();\n }\n\n private readonly expectedEvents: ({ index: number; event: ITelemetryGenericEvent | undefined; } | undefined)[] = [];\n private readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n public registerExpectedEvent(... orderedExpectedEvents: ITelemetryGenericEvent[]) {\n if (this.expectedEvents.length !== 0) {\n // we don't have to error here. just no reason not to. given the events must be\n // ordered it could be tricky to figure out problems around multiple registrations.\n throw new Error(\n \"Expected events already registered.\\n\"\n + \"Call reportAndClearTrackedEvents to clear them before registering more\");\n }\n this.expectedEvents.push(... orderedExpectedEvents.map((event, index) => ({ index, event })));\n }\n\n send(event: ITelemetryBaseEvent): void {\n const ee = this.expectedEvents[0]?.event;\n if (ee?.eventName === event.eventName) {\n let matches = true;\n for (const key of Object.keys(ee)) {\n if (ee[key] !== event[key]) {\n matches = false;\n break;\n }\n }\n if (matches) {\n // we found an expected event\n // so remove it from the list of expected events\n // and if it is an error, change it to generic\n // this helps keep our telemetry clear of\n // expected errors.\n this.expectedEvents.shift();\n if (event.category === \"error\") {\n event.category = \"generic\";\n }\n }\n }\n if (event.category === \"error\") {\n this.unexpectedErrors.push(event);\n }\n\n this.baseLogger.send(event);\n }\n\n public reportAndClearTrackedEvents() {\n const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n return {\n expectedNotFound,\n unexpectedErrors,\n };\n }\n}\n\n/**\n * Shared base class for test object provider. Contain code for loader and container creation and loading\n */\nexport class TestObjectProvider implements ITestObjectProvider {\n private _loaderContainerTracker = new LoaderContainerTracker();\n private _documentServiceFactory: IDocumentServiceFactory | undefined;\n private _urlResolver: IUrlResolver | undefined;\n private _logger: EventAndErrorTrackingLogger | undefined;\n private readonly _documentIdStrategy: IDocumentIdStrategy;\n // Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n private _documentCreated = false;\n\n /**\n * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n * and factory for TestFluidObject\n */\n constructor(\n public readonly LoaderConstructor: typeof Loader,\n public readonly driver: ITestDriver,\n public readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint,\n ) {\n this._documentIdStrategy = getDocumentIdStrategy(driver.type);\n }\n\n get logger(): EventAndErrorTrackingLogger {\n if (this._logger === undefined) {\n this._logger = new EventAndErrorTrackingLogger(\n ChildLogger.create(getTestLogger?.(), undefined,\n {\n all: {\n driverType: this.driver.type,\n driverEndpointName: this.driver.endpointName,\n driverTenantName: this.driver.tenantName,\n driverUserIndex: this.driver.userIndex,\n },\n }));\n }\n return this._logger;\n }\n\n get documentServiceFactory() {\n if (!this._documentServiceFactory) {\n this._documentServiceFactory = this.driver.createDocumentServiceFactory();\n }\n return this._documentServiceFactory;\n }\n\n get urlResolver() {\n if (!this._urlResolver) {\n this._urlResolver = this.driver.createUrlResolver();\n }\n return this._urlResolver;\n }\n\n get documentId() {\n return this._documentIdStrategy.get();\n }\n\n get defaultCodeDetails() {\n return defaultCodeDetails;\n }\n\n get opProcessingController(): IOpProcessingController {\n return this._loaderContainerTracker;\n }\n\n /**\n * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ) {\n const multiSinkLogger = new MultiSinkLogger();\n multiSinkLogger.addLogger(this.logger);\n if (loaderProps?.logger !== undefined) {\n multiSinkLogger.addLogger(loaderProps.logger);\n }\n\n const loader = new this.LoaderConstructor({\n ... loaderProps,\n logger: multiSinkLogger,\n codeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n urlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n documentServiceFactory: loaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n });\n this._loaderContainerTracker.add(loader);\n return loader;\n }\n\n /**\n * Create a container using a default document id and code details.\n * Container created is automatically added to the OpProcessingController to manage op flow\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadContainer\");\n }\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n const container = await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId),\n );\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n public async loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader): Promise<IContainer> {\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n return loader.resolve({ url: await this.driver.createContainerUrl(this.documentId), headers: requestHeader });\n }\n\n /**\n * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n * @param testContainerConfig - optional configuring the test Container\n */\n public makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n return this.createLoader(\n [[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n testContainerConfig?.loaderProps,\n );\n }\n\n /**\n * Make a container using a default document id and code details\n * Container loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n */\n public async makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer> {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadTestContainer\");\n }\n const loader = this.makeTestLoader(testContainerConfig);\n const container =\n await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId));\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n /**\n * Load a container using a default document id and code details.\n * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n * @param requestHeader - optional headers to be supplied to the loader\n */\n public async loadTestContainer(\n testContainerConfig?: ITestContainerConfig,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer> {\n const loader = this.makeTestLoader(testContainerConfig);\n const container = await loader.resolve({\n url: await this.driver.createContainerUrl(this.documentId),\n headers: requestHeader,\n });\n await this.waitContainerToCatchUp(container);\n\n return container;\n }\n\n public reset() {\n this._loaderContainerTracker.reset();\n this._documentServiceFactory = undefined;\n this._urlResolver = undefined;\n this._documentIdStrategy.reset();\n const logError = getUnexpectedLogErrorException(this._logger);\n if (logError) {\n throw logError;\n }\n this._logger = undefined;\n this._documentCreated = false;\n }\n\n public async ensureSynchronized() {\n return this._loaderContainerTracker.ensureSynchronized();\n }\n\n public async waitContainerToCatchUp(container: IContainer) {\n // The original waitContainerToCatchUp() from container loader uses either Container.resume()\n // or Container.connect() as part of its implementation. However, resume() was deprecated\n // and eventually replaced with connect(). To avoid issues during LTS compatibility testing\n // with older container versions issues, we use resume() when connect() is unavailable.\n if ((container as any).connect === undefined) {\n (container as any).connect = (container as any).resume;\n }\n\n return waitContainerToCatchUp_original(container);\n }\n\n updateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n this._documentIdStrategy.update(resolvedUrl);\n }\n\n public resetLoaderContainerTracker(syncSummarizerClients: boolean = false) {\n this._loaderContainerTracker.reset();\n this._loaderContainerTracker = new LoaderContainerTracker(syncSummarizerClients);\n }\n}\n\nexport function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string) {\n if (logger === undefined) {\n return;\n }\n const results = logger.reportAndClearTrackedEvents();\n if (results.unexpectedErrors.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);\n }\n if (results.expectedNotFound.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"testObj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,+CAAsB,CAAC,qBAAqB,CAAC,CAAC;IACrF,CAAC;CACJ;AAhOD,gDAgOC;AAED,SAAgB,8BAA8B,CAAC,MAA+C,EAAE,MAAe;IAC3G,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO;KACV;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,2BAA2B,EAAE,CAAC;IACrD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;AACL,CAAC;AAbD,wEAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer, IHostLoader, IFluidCodeDetails } from \"@fluidframework/container-definitions\";\nimport { ITelemetryGenericEvent, ITelemetryBaseLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport {\n ILoaderProps,\n Loader,\n waitContainerToCatchUp as waitContainerToCatchUp_original,\n} from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { ChildLogger, MultiSinkLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\nimport { createAndAttachContainer } from \"./localLoader\";\nimport { ChannelFactoryRegistry } from \"./testFluidObject\";\n\nconst defaultCodeDetails: IFluidCodeDetails = {\n package: \"defaultTestPackage\",\n config: {},\n};\n\nexport interface IOpProcessingController {\n processIncoming(...containers: IContainer[]): Promise<void>;\n processOutgoing(...containers: IContainer[]): Promise<void>;\n pauseProcessing(...containers: IContainer[]): Promise<void>;\n resumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ): IHostLoader;\n createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;\n loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer>;\n\n /**\n * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n */\n makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;\n /**\n *\n * @param url - Resolved container URL\n */\n updateDocumentId(url: IResolvedUrl | undefined): void;\n\n logger: ITelemetryBaseLogger;\n documentServiceFactory: IDocumentServiceFactory;\n urlResolver: IUrlResolver;\n defaultCodeDetails: IFluidCodeDetails;\n opProcessingController: IOpProcessingController;\n\n ensureSynchronized(): Promise<void>;\n reset(): void;\n\n documentId: string;\n driver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n Primed, // default\n Test,\n}\n\nexport interface ITestContainerConfig {\n /** TestFluidDataObject instead of PrimedDataStore */\n fluidDataObjectType?: DataObjectFactoryType;\n\n /** An array of channel name and DDS factory pair to create on container creation time */\n registry?: ChannelFactoryRegistry;\n\n /** Container runtime options for the container instance */\n runtimeOptions?: IContainerRuntimeOptions;\n\n /** Loader options for the loader used to create containers */\n loaderProps?: Partial<ILoaderProps>;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n get(): string;\n update(resolvedUrl?: IResolvedUrl): void;\n reset(): void;\n}\n\n/**\n * Document ID is treated differently by test drivers. The key difference is in generating\n * a new container ID and accessing the container in multi-instance test cases.\n */\nfunction getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {\n let documentId = createDocumentId();\n switch (type) {\n case \"odsp\":\n return {\n get: () => documentId,\n update: () => { }, // do not update the document ID in odsp test cases\n reset: () => { documentId = createDocumentId(); },\n };\n default:\n return {\n get: () => documentId,\n update: (resolvedUrl?: IResolvedUrl) => {\n // Extract the document ID from the resolved container's URL and reset the ID property\n ensureFluidResolvedUrl(resolvedUrl);\n documentId = resolvedUrl.id ?? documentId;\n },\n reset: () => { documentId = createDocumentId(); },\n };\n }\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n */\nexport class EventAndErrorTrackingLogger extends TelemetryLogger {\n constructor(private readonly baseLogger: ITelemetryBaseLogger) {\n super();\n }\n\n private readonly expectedEvents: ({ index: number; event: ITelemetryGenericEvent | undefined; } | undefined)[] = [];\n private readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n public registerExpectedEvent(... orderedExpectedEvents: ITelemetryGenericEvent[]) {\n if (this.expectedEvents.length !== 0) {\n // we don't have to error here. just no reason not to. given the events must be\n // ordered it could be tricky to figure out problems around multiple registrations.\n throw new Error(\n \"Expected events already registered.\\n\"\n + \"Call reportAndClearTrackedEvents to clear them before registering more\");\n }\n this.expectedEvents.push(... orderedExpectedEvents.map((event, index) => ({ index, event })));\n }\n\n send(event: ITelemetryBaseEvent): void {\n const ee = this.expectedEvents[0]?.event;\n if (ee?.eventName === event.eventName) {\n let matches = true;\n for (const key of Object.keys(ee)) {\n if (ee[key] !== event[key]) {\n matches = false;\n break;\n }\n }\n if (matches) {\n // we found an expected event\n // so remove it from the list of expected events\n // and if it is an error, change it to generic\n // this helps keep our telemetry clear of\n // expected errors.\n this.expectedEvents.shift();\n if (event.category === \"error\") {\n event.category = \"generic\";\n }\n }\n }\n if (event.category === \"error\") {\n this.unexpectedErrors.push(event);\n }\n\n this.baseLogger.send(event);\n }\n\n public reportAndClearTrackedEvents() {\n const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n return {\n expectedNotFound,\n unexpectedErrors,\n };\n }\n}\n\n/**\n * Shared base class for test object provider. Contain code for loader and container creation and loading\n */\nexport class TestObjectProvider implements ITestObjectProvider {\n private _loaderContainerTracker = new LoaderContainerTracker();\n private _documentServiceFactory: IDocumentServiceFactory | undefined;\n private _urlResolver: IUrlResolver | undefined;\n private _logger: EventAndErrorTrackingLogger | undefined;\n private readonly _documentIdStrategy: IDocumentIdStrategy;\n // Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n private _documentCreated = false;\n\n /**\n * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n * and factory for TestFluidObject\n */\n constructor(\n public readonly LoaderConstructor: typeof Loader,\n public readonly driver: ITestDriver,\n public readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint,\n ) {\n this._documentIdStrategy = getDocumentIdStrategy(driver.type);\n }\n\n get logger(): EventAndErrorTrackingLogger {\n if (this._logger === undefined) {\n this._logger = new EventAndErrorTrackingLogger(\n ChildLogger.create(getTestLogger?.(), undefined,\n {\n all: {\n driverType: this.driver.type,\n driverEndpointName: this.driver.endpointName,\n driverTenantName: this.driver.tenantName,\n driverUserIndex: this.driver.userIndex,\n },\n }));\n }\n return this._logger;\n }\n\n set logger(logger: EventAndErrorTrackingLogger) {\n this._logger = logger;\n }\n\n get documentServiceFactory() {\n if (!this._documentServiceFactory) {\n this._documentServiceFactory = this.driver.createDocumentServiceFactory();\n }\n return this._documentServiceFactory;\n }\n\n get urlResolver() {\n if (!this._urlResolver) {\n this._urlResolver = this.driver.createUrlResolver();\n }\n return this._urlResolver;\n }\n\n get documentId() {\n return this._documentIdStrategy.get();\n }\n\n get defaultCodeDetails() {\n return defaultCodeDetails;\n }\n\n get opProcessingController(): IOpProcessingController {\n return this._loaderContainerTracker;\n }\n\n /**\n * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ) {\n const multiSinkLogger = new MultiSinkLogger();\n multiSinkLogger.addLogger(this.logger);\n if (loaderProps?.logger !== undefined) {\n multiSinkLogger.addLogger(loaderProps.logger);\n }\n\n const loader = new this.LoaderConstructor({\n ... loaderProps,\n logger: multiSinkLogger,\n codeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n urlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n documentServiceFactory: loaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n });\n this._loaderContainerTracker.add(loader);\n return loader;\n }\n\n /**\n * Create a container using a default document id and code details.\n * Container created is automatically added to the OpProcessingController to manage op flow\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadContainer\");\n }\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n const container = await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId),\n );\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n public async loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader): Promise<IContainer> {\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n return loader.resolve({ url: await this.driver.createContainerUrl(this.documentId), headers: requestHeader });\n }\n\n /**\n * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n * @param testContainerConfig - optional configuring the test Container\n */\n public makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n return this.createLoader(\n [[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n testContainerConfig?.loaderProps,\n );\n }\n\n /**\n * Make a container using a default document id and code details\n * Container loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n */\n public async makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer> {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadTestContainer\");\n }\n const loader = this.makeTestLoader(testContainerConfig);\n const container =\n await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId));\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n /**\n * Load a container using a default document id and code details.\n * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n * @param requestHeader - optional headers to be supplied to the loader\n */\n public async loadTestContainer(\n testContainerConfig?: ITestContainerConfig,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer> {\n const loader = this.makeTestLoader(testContainerConfig);\n const container = await loader.resolve({\n url: await this.driver.createContainerUrl(this.documentId),\n headers: requestHeader,\n });\n await this.waitContainerToCatchUp(container);\n\n return container;\n }\n\n public reset() {\n this._loaderContainerTracker.reset();\n this._documentServiceFactory = undefined;\n this._urlResolver = undefined;\n this._documentIdStrategy.reset();\n const logError = getUnexpectedLogErrorException(this._logger);\n if (logError) {\n throw logError;\n }\n this._logger = undefined;\n this._documentCreated = false;\n }\n\n public async ensureSynchronized() {\n return this._loaderContainerTracker.ensureSynchronized();\n }\n\n public async waitContainerToCatchUp(container: IContainer) {\n // The original waitContainerToCatchUp() from container loader uses either Container.resume()\n // or Container.connect() as part of its implementation. However, resume() was deprecated\n // and eventually replaced with connect(). To avoid issues during LTS compatibility testing\n // with older container versions issues, we use resume() when connect() is unavailable.\n if ((container as any).connect === undefined) {\n (container as any).connect = (container as any).resume;\n }\n\n return waitContainerToCatchUp_original(container);\n }\n\n updateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n this._documentIdStrategy.update(resolvedUrl);\n }\n\n public resetLoaderContainerTracker(syncSummarizerClients: boolean = false) {\n this._loaderContainerTracker.reset();\n this._loaderContainerTracker = new LoaderContainerTracker(syncSummarizerClients);\n }\n}\n\nexport function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string) {\n if (logger === undefined) {\n return;\n }\n const results = logger.reportAndClearTrackedEvents();\n if (results.unexpectedErrors.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);\n }\n if (results.expectedNotFound.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);\n }\n}\n"]}
|
package/dist/timeoutUtils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { Container } from "@fluidframework/container-loader";
|
|
5
6
|
export declare const defaultTimeoutDurationMs = 250;
|
|
6
7
|
export interface TimeoutWithError {
|
|
7
8
|
durationMs?: number;
|
|
@@ -14,5 +15,6 @@ export interface TimeoutWithValue<T = void> {
|
|
|
14
15
|
value: T;
|
|
15
16
|
}
|
|
16
17
|
export declare function timeoutAwait<T = void>(promise: PromiseLike<T>, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
|
|
18
|
+
export declare function ensureContainerConnected(container: Container): Promise<void>;
|
|
17
19
|
export declare function timeoutPromise<T = void>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
|
|
18
20
|
//# sourceMappingURL=timeoutUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutUtils.d.ts","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,IAAI;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MA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I,CAAC,CAIlF;AAED,wBAAsB,cAAc,CAAC,CAAC,GAAG,IAAI,EACzC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,EAChG,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,GAC5D,OAAO,CAAC,CAAC,CAAC,CA0BZ"}
|
package/dist/timeoutUtils.js
CHANGED
|
@@ -4,12 +4,18 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = void 0;
|
|
7
|
+
exports.timeoutPromise = exports.ensureContainerConnected = exports.timeoutAwait = exports.defaultTimeoutDurationMs = void 0;
|
|
8
8
|
exports.defaultTimeoutDurationMs = 250;
|
|
9
9
|
async function timeoutAwait(promise, timeoutOptions = {}) {
|
|
10
10
|
return Promise.race([promise, timeoutPromise(() => { }, timeoutOptions)]);
|
|
11
11
|
}
|
|
12
12
|
exports.timeoutAwait = timeoutAwait;
|
|
13
|
+
async function ensureContainerConnected(container) {
|
|
14
|
+
if (!container.connected) {
|
|
15
|
+
return timeoutPromise((resolve) => container.once("connected", () => resolve()));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ensureContainerConnected = ensureContainerConnected;
|
|
13
19
|
async function timeoutPromise(executor, timeoutOptions = {}) {
|
|
14
20
|
var _a;
|
|
15
21
|
const timeout = timeoutOptions.durationMs !== undefined
|
package/dist/timeoutUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
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,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EACnF,OAAO,CAAC,CAAC;QAEb,QAAQ,CACJ,CAAC,KAAK,EAAE,EAAE;YACN,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACP,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AA7BD,wCA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Container } from \"@fluidframework/container-loader\";\n\nexport const defaultTimeoutDurationMs = 250;\n\nexport interface TimeoutWithError {\n durationMs?: number;\n reject?: true;\n errorMsg?: string;\n}\nexport interface TimeoutWithValue<T = void> {\n durationMs?: number;\n reject: false;\n value: T;\n}\n\nexport async function timeoutAwait<T = void>(\n promise: PromiseLike<T>,\n timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n) {\n return Promise.race([promise, timeoutPromise<T>(() => { }, timeoutOptions)]);\n}\n\nexport async function ensureContainerConnected(container: Container): Promise<void> {\n if (!container.connected) {\n return timeoutPromise((resolve) => container.once(\"connected\", () => resolve()));\n }\n}\n\nexport async function timeoutPromise<T = void>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n const timeout =\n timeoutOptions.durationMs !== undefined\n && Number.isFinite(timeoutOptions.durationMs)\n && timeoutOptions.durationMs > 0\n ? timeoutOptions.durationMs : defaultTimeoutDurationMs;\n // create the timeout error outside the async task, so it's callstack includes\n // the original call site, this makes it easier to debug\n const err = timeoutOptions.reject === false\n ? undefined\n : new Error(`${timeoutOptions.errorMsg ?? \"Timed out\"}(${timeout}ms)`);\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(\n () => timeoutOptions.reject === false ? resolve(timeoutOptions.value) : reject(err),\n timeout);\n\n executor(\n (value) => {\n clearTimeout(timer);\n resolve(value);\n },\n (reason) => {\n clearTimeout(timer);\n reject(reason);\n });\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/test-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-internal.1.0.0",
|
|
4
4
|
"description": "Utilities for Fluid tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -55,36 +55,37 @@
|
|
|
55
55
|
"temp-directory": "nyc/.nyc_output"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@fluidframework/aqueduct": "^1.
|
|
58
|
+
"@fluidframework/aqueduct": "^2.0.0-internal.1.0.0",
|
|
59
59
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
60
|
-
"@fluidframework/common-utils": "^0.
|
|
61
|
-
"@fluidframework/container-definitions": "^1.
|
|
62
|
-
"@fluidframework/container-loader": "^1.
|
|
63
|
-
"@fluidframework/container-runtime": "^1.
|
|
64
|
-
"@fluidframework/container-runtime-definitions": "^1.
|
|
65
|
-
"@fluidframework/core-interfaces": "^1.
|
|
66
|
-
"@fluidframework/datastore": "^1.
|
|
67
|
-
"@fluidframework/datastore-definitions": "^1.
|
|
68
|
-
"@fluidframework/driver-definitions": "^1.
|
|
69
|
-
"@fluidframework/driver-utils": "^1.
|
|
70
|
-
"@fluidframework/local-driver": "^1.
|
|
71
|
-
"@fluidframework/map": "^1.
|
|
72
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
73
|
-
"@fluidframework/request-handler": "^1.
|
|
74
|
-
"@fluidframework/routerlicious-driver": "^1.
|
|
75
|
-
"@fluidframework/runtime-definitions": "^1.
|
|
76
|
-
"@fluidframework/runtime-utils": "^1.
|
|
77
|
-
"@fluidframework/telemetry-utils": "^1.
|
|
78
|
-
"@fluidframework/test-driver-definitions": "^1.
|
|
79
|
-
"@fluidframework/test-runtime-utils": "^1.
|
|
60
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
61
|
+
"@fluidframework/container-definitions": "^2.0.0-internal.1.0.0",
|
|
62
|
+
"@fluidframework/container-loader": "^2.0.0-internal.1.0.0",
|
|
63
|
+
"@fluidframework/container-runtime": "^2.0.0-internal.1.0.0",
|
|
64
|
+
"@fluidframework/container-runtime-definitions": "^2.0.0-internal.1.0.0",
|
|
65
|
+
"@fluidframework/core-interfaces": "^2.0.0-internal.1.0.0",
|
|
66
|
+
"@fluidframework/datastore": "^2.0.0-internal.1.0.0",
|
|
67
|
+
"@fluidframework/datastore-definitions": "^2.0.0-internal.1.0.0",
|
|
68
|
+
"@fluidframework/driver-definitions": "^2.0.0-internal.1.0.0",
|
|
69
|
+
"@fluidframework/driver-utils": "^2.0.0-internal.1.0.0",
|
|
70
|
+
"@fluidframework/local-driver": "^2.0.0-internal.1.0.0",
|
|
71
|
+
"@fluidframework/map": "^2.0.0-internal.1.0.0",
|
|
72
|
+
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
73
|
+
"@fluidframework/request-handler": "^2.0.0-internal.1.0.0",
|
|
74
|
+
"@fluidframework/routerlicious-driver": "^2.0.0-internal.1.0.0",
|
|
75
|
+
"@fluidframework/runtime-definitions": "^2.0.0-internal.1.0.0",
|
|
76
|
+
"@fluidframework/runtime-utils": "^2.0.0-internal.1.0.0",
|
|
77
|
+
"@fluidframework/telemetry-utils": "^2.0.0-internal.1.0.0",
|
|
78
|
+
"@fluidframework/test-driver-definitions": "^2.0.0-internal.1.0.0",
|
|
79
|
+
"@fluidframework/test-runtime-utils": "^2.0.0-internal.1.0.0",
|
|
80
|
+
"best-random": "^1.0.0",
|
|
80
81
|
"debug": "^4.1.1",
|
|
81
82
|
"uuid": "^8.3.1"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
85
|
"@fluidframework/build-common": "^0.24.0",
|
|
85
|
-
"@fluidframework/build-tools": "^0.
|
|
86
|
+
"@fluidframework/build-tools": "^0.3.1000",
|
|
86
87
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
87
|
-
"@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils
|
|
88
|
+
"@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@^1.0.0",
|
|
88
89
|
"@microsoft/api-extractor": "^7.22.2",
|
|
89
90
|
"@rushstack/eslint-config": "^2.5.1",
|
|
90
91
|
"@types/diff": "^3.5.1",
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
"typescript-formatter": "7.1.0"
|
|
104
105
|
},
|
|
105
106
|
"typeValidation": {
|
|
106
|
-
"version": "
|
|
107
|
+
"version": "2.0.0",
|
|
107
108
|
"broken": {}
|
|
108
109
|
}
|
|
109
110
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
7
|
+
import {
|
|
8
|
+
IDocumentService,
|
|
9
|
+
IDocumentServiceFactory,
|
|
10
|
+
IDocumentStorageService,
|
|
11
|
+
IResolvedUrl,
|
|
12
|
+
ISummaryContext,
|
|
13
|
+
} from "@fluidframework/driver-definitions";
|
|
14
|
+
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Wraps the given IDocumentStorageService to override the `uploadSummaryWithContext` method. It calls the
|
|
18
|
+
* `uploadSummaryCb` whenever a summary is uploaded by the client. The summary context can be updated in the
|
|
19
|
+
* callback before it is uploaded to the server.
|
|
20
|
+
*/
|
|
21
|
+
export function wrapDocumentStorageService(
|
|
22
|
+
innerDocStorageService: IDocumentStorageService,
|
|
23
|
+
uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,
|
|
24
|
+
) {
|
|
25
|
+
const outerDocStorageService = Object.create(innerDocStorageService) as IDocumentStorageService;
|
|
26
|
+
outerDocStorageService.uploadSummaryWithContext = async (
|
|
27
|
+
summary: ISummaryTree,
|
|
28
|
+
context: ISummaryContext,
|
|
29
|
+
): Promise<string> => {
|
|
30
|
+
const newContext = uploadSummaryCb(summary, context);
|
|
31
|
+
return innerDocStorageService.uploadSummaryWithContext(summary, newContext);
|
|
32
|
+
};
|
|
33
|
+
return outerDocStorageService;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Wraps the given IDocumentService to override the `connectToStorage` method. The intent is to plumb the
|
|
38
|
+
* `uploadSummaryCb` to the IDocumentStorageService so that it is called whenever a summary is uploaded by
|
|
39
|
+
* the client.
|
|
40
|
+
* The document storage service that is created in `connectToStorage` is wrapped by calling `wrapDocumentStorageService`
|
|
41
|
+
* to pass in the `uploadSummaryCb`.
|
|
42
|
+
*/
|
|
43
|
+
export function wrapDocumentService(
|
|
44
|
+
innerDocService: IDocumentService,
|
|
45
|
+
uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,
|
|
46
|
+
) {
|
|
47
|
+
const outerDocService = Object.create(innerDocService) as IDocumentService;
|
|
48
|
+
outerDocService.connectToStorage = async (): Promise<IDocumentStorageService> => {
|
|
49
|
+
const storageService = await innerDocService.connectToStorage();
|
|
50
|
+
return wrapDocumentStorageService(storageService, uploadSummaryCb);
|
|
51
|
+
};
|
|
52
|
+
return outerDocService;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Wraps the given IDocumentServiceFactory to override the `createDocumentService` method. The intent is to plumb
|
|
57
|
+
* the `uploadSummaryCb` all the way to the IDocumentStorageService so that it is called whenever a summary is
|
|
58
|
+
* uploaded by the client.
|
|
59
|
+
* The document service that is created in `createDocumentService` is wrapped by calling `wrapDocumentService` to
|
|
60
|
+
* pass in the `uploadSummaryCb`.
|
|
61
|
+
*/
|
|
62
|
+
export function wrapDocumentServiceFactory(
|
|
63
|
+
innerDocServiceFactory: IDocumentServiceFactory,
|
|
64
|
+
uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,
|
|
65
|
+
) {
|
|
66
|
+
const outerDocServiceFactory = Object.create(innerDocServiceFactory) as IDocumentServiceFactory;
|
|
67
|
+
outerDocServiceFactory.createDocumentService = async (
|
|
68
|
+
resolvedUrl: IResolvedUrl,
|
|
69
|
+
logger?: ITelemetryBaseLogger,
|
|
70
|
+
clientIsSummarizer?: boolean,
|
|
71
|
+
): Promise<IDocumentService> => {
|
|
72
|
+
const documentService = await innerDocServiceFactory.createDocumentService(
|
|
73
|
+
resolvedUrl, logger, clientIsSummarizer);
|
|
74
|
+
return wrapDocumentService(documentService, uploadSummaryCb);
|
|
75
|
+
};
|
|
76
|
+
return outerDocServiceFactory;
|
|
77
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ConfigTypes, IConfigProviderBase } from "@fluidframework/telemetry-utils";
|
|
7
|
+
|
|
8
|
+
export const mockConfigProvider = ((settings: Record<string, ConfigTypes> = {}): IConfigProviderBase => {
|
|
9
|
+
settings["Fluid.GarbageCollection.TrackGCState"] = "true";
|
|
10
|
+
settings["Fluid.GarbageCollection.WriteDataAtRoot"] = "true";
|
|
11
|
+
return {
|
|
12
|
+
getRawConfig: (name: string): ConfigTypes => settings[name],
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct";
|
|
7
|
+
import { assert } from "@fluidframework/common-utils";
|
|
8
|
+
import { IContainer, IHostLoader, LoaderHeader } from "@fluidframework/container-definitions";
|
|
9
|
+
import { ConnectionState } from "@fluidframework/container-loader";
|
|
10
|
+
import {
|
|
11
|
+
IGCRuntimeOptions,
|
|
12
|
+
ISummarizer,
|
|
13
|
+
ISummaryRuntimeOptions,
|
|
14
|
+
} from "@fluidframework/container-runtime";
|
|
15
|
+
import { FluidObject, IRequest } from "@fluidframework/core-interfaces";
|
|
16
|
+
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
17
|
+
import {
|
|
18
|
+
IContainerRuntimeBase,
|
|
19
|
+
IFluidDataStoreFactory,
|
|
20
|
+
} from "@fluidframework/runtime-definitions";
|
|
21
|
+
import { requestFluidObject } from "@fluidframework/runtime-utils";
|
|
22
|
+
import { ITestContainerConfig, ITestObjectProvider } from "./testObjectProvider";
|
|
23
|
+
import { mockConfigProvider } from "./TestConfigs";
|
|
24
|
+
|
|
25
|
+
const summarizerClientType = "summarizer";
|
|
26
|
+
|
|
27
|
+
async function createSummarizerCore(container: IContainer, loader: IHostLoader, summaryVersion?: string) {
|
|
28
|
+
const absoluteUrl = await container.getAbsoluteUrl("");
|
|
29
|
+
if (absoluteUrl === undefined) {
|
|
30
|
+
throw new Error("URL could not be resolved");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const request: IRequest = {
|
|
34
|
+
headers: {
|
|
35
|
+
[LoaderHeader.cache]: false,
|
|
36
|
+
[LoaderHeader.clientDetails]: {
|
|
37
|
+
capabilities: { interactive: false },
|
|
38
|
+
type: summarizerClientType,
|
|
39
|
+
},
|
|
40
|
+
[DriverHeader.summarizingClient]: true,
|
|
41
|
+
[LoaderHeader.reconnect]: false,
|
|
42
|
+
[LoaderHeader.version]: summaryVersion,
|
|
43
|
+
},
|
|
44
|
+
url: absoluteUrl,
|
|
45
|
+
};
|
|
46
|
+
const summarizerContainer = await loader.resolve(request);
|
|
47
|
+
await waitForContainerConnection(summarizerContainer);
|
|
48
|
+
|
|
49
|
+
const fluidObject =
|
|
50
|
+
await requestFluidObject<FluidObject<ISummarizer>>(summarizerContainer, { url: "_summarizer" });
|
|
51
|
+
if (fluidObject.ISummarizer === undefined) {
|
|
52
|
+
throw new Error("Fluid object does not implement ISummarizer");
|
|
53
|
+
}
|
|
54
|
+
return fluidObject.ISummarizer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const defaultSummaryOptions: ISummaryRuntimeOptions = {
|
|
58
|
+
summaryConfigOverrides: {
|
|
59
|
+
state: "disableHeuristics",
|
|
60
|
+
maxAckWaitTime: 10000,
|
|
61
|
+
maxOpsSinceLastSummary: 7000,
|
|
62
|
+
initialSummarizerDelayMs: 0,
|
|
63
|
+
summarizerClientElection: false,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export async function createSummarizerFromFactory(
|
|
68
|
+
provider: ITestObjectProvider,
|
|
69
|
+
container: IContainer,
|
|
70
|
+
dataStoreFactory: IFluidDataStoreFactory,
|
|
71
|
+
summaryVersion?: string,
|
|
72
|
+
containerRuntimeFactoryType = ContainerRuntimeFactoryWithDefaultDataStore,
|
|
73
|
+
): Promise<ISummarizer> {
|
|
74
|
+
const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>
|
|
75
|
+
runtime.IFluidHandleContext.resolveHandle(request);
|
|
76
|
+
const runtimeFactory = new containerRuntimeFactoryType(
|
|
77
|
+
dataStoreFactory,
|
|
78
|
+
[
|
|
79
|
+
[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],
|
|
80
|
+
],
|
|
81
|
+
undefined,
|
|
82
|
+
[innerRequestHandler],
|
|
83
|
+
{ summaryOptions: defaultSummaryOptions },
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const loader = provider.createLoader(
|
|
87
|
+
[[provider.defaultCodeDetails, runtimeFactory]],
|
|
88
|
+
{ configProvider: mockConfigProvider() },
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function createSummarizer(
|
|
95
|
+
provider: ITestObjectProvider,
|
|
96
|
+
container: IContainer,
|
|
97
|
+
summaryVersion?: string,
|
|
98
|
+
gcOptions?: IGCRuntimeOptions,
|
|
99
|
+
): Promise<ISummarizer> {
|
|
100
|
+
const testContainerConfig: ITestContainerConfig = {
|
|
101
|
+
runtimeOptions: {
|
|
102
|
+
summaryOptions: defaultSummaryOptions,
|
|
103
|
+
gcOptions,
|
|
104
|
+
},
|
|
105
|
+
loaderProps: { configProvider: mockConfigProvider() },
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const loader = provider.makeTestLoader(testContainerConfig);
|
|
109
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function summarizeNow(summarizer: ISummarizer, reason: string = "end-to-end test") {
|
|
113
|
+
const result = summarizer.summarizeOnDemand({ reason });
|
|
114
|
+
|
|
115
|
+
const submitResult = await result.summarySubmitted;
|
|
116
|
+
assert(submitResult.success, "on-demand summary should submit");
|
|
117
|
+
assert(submitResult.data.stage === "submit",
|
|
118
|
+
"on-demand summary submitted data stage should be submit");
|
|
119
|
+
assert(submitResult.data.summaryTree !== undefined, "summary tree should exist");
|
|
120
|
+
|
|
121
|
+
const broadcastResult = await result.summaryOpBroadcasted;
|
|
122
|
+
assert(broadcastResult.success, "summary op should be broadcast");
|
|
123
|
+
|
|
124
|
+
const ackNackResult = await result.receivedSummaryAckOrNack;
|
|
125
|
+
assert(ackNackResult.success, "summary op should be acked");
|
|
126
|
+
|
|
127
|
+
await new Promise((resolve) => process.nextTick(resolve));
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
summaryTree: submitResult.data.summaryTree,
|
|
131
|
+
summaryVersion: ackNackResult.data.summaryAckOp.contents.handle,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export async function waitForContainerConnection(container: IContainer): Promise<void> {
|
|
136
|
+
if (container.connectionState !== ConnectionState.Connected) {
|
|
137
|
+
return new Promise((resolve) => container.once("connected", () => resolve()));
|
|
138
|
+
}
|
|
139
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -195,7 +195,10 @@ export class LoaderContainerTracker implements IOpProcessingController {
|
|
|
195
195
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
196
196
|
debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c)!.index)}`);
|
|
197
197
|
waitingSequenceNumberSynchronized = false;
|
|
198
|
-
await Promise.all(dirtyContainers.map(async (c) =>
|
|
198
|
+
await Promise.all(dirtyContainers.map(async (c) => Promise.race(
|
|
199
|
+
[new Promise((resolve) => c.once("saved", resolve)),
|
|
200
|
+
new Promise((resolve) => c.once("closed", resolve))],
|
|
201
|
+
)));
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
// yield a turn to allow side effect of the ops we just processed execute before we check again
|
package/src/packageVersion.ts
CHANGED
|
@@ -231,6 +231,10 @@ export class TestObjectProvider implements ITestObjectProvider {
|
|
|
231
231
|
return this._logger;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
set logger(logger: EventAndErrorTrackingLogger) {
|
|
235
|
+
this._logger = logger;
|
|
236
|
+
}
|
|
237
|
+
|
|
234
238
|
get documentServiceFactory() {
|
|
235
239
|
if (!this._documentServiceFactory) {
|
|
236
240
|
this._documentServiceFactory = this.driver.createDocumentServiceFactory();
|
package/src/timeoutUtils.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { Container } from "@fluidframework/container-loader";
|
|
7
|
+
|
|
6
8
|
export const defaultTimeoutDurationMs = 250;
|
|
7
9
|
|
|
8
10
|
export interface TimeoutWithError {
|
|
@@ -23,6 +25,12 @@ export async function timeoutAwait<T = void>(
|
|
|
23
25
|
return Promise.race([promise, timeoutPromise<T>(() => { }, timeoutOptions)]);
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
export async function ensureContainerConnected(container: Container): Promise<void> {
|
|
29
|
+
if (!container.connected) {
|
|
30
|
+
return timeoutPromise((resolve) => container.once("connected", () => resolve()));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
export async function timeoutPromise<T = void>(
|
|
27
35
|
executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,
|
|
28
36
|
timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},
|
package/tsconfig.json
CHANGED