@fluidframework/test-utils 2.0.0-internal.2.3.1 → 2.0.0-internal.2.4.1
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/TestSummaryUtils.d.ts +0 -1
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +3 -9
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/containerUtils.d.ts +38 -0
- package/dist/containerUtils.d.ts.map +1 -0
- package/dist/containerUtils.js +56 -0
- package/dist/containerUtils.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/testContainerRuntimeFactory.js +1 -2
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testObjectProvider.d.ts +2 -0
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.d.ts +1 -2
- package/dist/timeoutUtils.d.ts.map +1 -1
- package/dist/timeoutUtils.js +1 -7
- package/dist/timeoutUtils.js.map +1 -1
- package/package.json +28 -26
- package/src/TestSummaryUtils.ts +1 -7
- package/src/containerUtils.ts +59 -0
- package/src/index.ts +4 -2
- package/src/packageVersion.ts +1 -1
- package/src/testContainerRuntimeFactory.ts +1 -1
- package/src/testObjectProvider.ts +3 -0
- package/src/timeoutUtils.ts +2 -8
|
@@ -24,5 +24,4 @@ export declare function summarizeNow(summarizer: ISummarizer, reason?: string):
|
|
|
24
24
|
summaryVersion: string;
|
|
25
25
|
summaryRefSeq: number;
|
|
26
26
|
}>;
|
|
27
|
-
export declare function waitForContainerConnection(container: IContainer): Promise<void>;
|
|
28
27
|
//# sourceMappingURL=TestSummaryUtils.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAC9F,OAAO,EACH,iBAAiB,EACjB,WAAW,EAEd,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEH,sBAAsB,EACtB,kCAAkC,EACrC,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAwB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAgDjF,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,sBAAsB,EACxC,cAAc,CAAC,EAAE,MAAM,EACvB,2BAA2B,qDAA8C,EACzE,eAAe,CAAC,EAAE,kCAAkC,GACrD,OAAO,CAAC,WAAW,CAAC,CAoBtB;AAED,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,iBAAiB,EAC7B,cAAc,GAAE,mBAA0C,EAC1D,MAAM,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAUtB;AAED,wBAAsB,6BAA6B,CAC/C,QAAQ,EAAE,mBAAmB,EAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,iBAAiB,EAC7B,cAAc,GAAE,mBAA0C,EAC1D,MAAM,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,WAAW,CAAC;CAAE,CAAC,CAU9D;AACD;;;EAGE;AACF,wBAAsB,YAAY,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,GAAE,MAA0B;;;;GAsB7F"}
|
package/dist/TestSummaryUtils.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.summarizeNow = exports.createSummarizerWithContainer = exports.createSummarizer = exports.createSummarizerFromFactory = void 0;
|
|
8
8
|
const aqueduct_1 = require("@fluidframework/aqueduct");
|
|
9
9
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
10
10
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
11
|
-
const container_loader_1 = require("@fluidframework/container-loader");
|
|
12
11
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
13
12
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
14
13
|
const TestConfigs_1 = require("./TestConfigs");
|
|
14
|
+
const containerUtils_1 = require("./containerUtils");
|
|
15
15
|
const summarizerClientType = "summarizer";
|
|
16
16
|
async function createSummarizerCore(absoluteUrl, loader, summaryVersion) {
|
|
17
17
|
if (absoluteUrl === undefined) {
|
|
@@ -30,7 +30,7 @@ async function createSummarizerCore(absoluteUrl, loader, summaryVersion) {
|
|
|
30
30
|
url: absoluteUrl,
|
|
31
31
|
};
|
|
32
32
|
const summarizerContainer = await loader.resolve(request);
|
|
33
|
-
await waitForContainerConnection(summarizerContainer);
|
|
33
|
+
await (0, containerUtils_1.waitForContainerConnection)(summarizerContainer);
|
|
34
34
|
const fluidObject = await (0, runtime_utils_1.requestFluidObject)(summarizerContainer, { url: "_summarizer" });
|
|
35
35
|
if (fluidObject.ISummarizer === undefined) {
|
|
36
36
|
throw new Error("Fluid object does not implement ISummarizer");
|
|
@@ -98,10 +98,4 @@ async function summarizeNow(summarizer, reason = "end-to-end test") {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
exports.summarizeNow = summarizeNow;
|
|
101
|
-
async function waitForContainerConnection(container) {
|
|
102
|
-
if (container.connectionState !== container_loader_1.ConnectionState.Connected) {
|
|
103
|
-
return new Promise((resolve) => container.once("connected", () => resolve()));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.waitForContainerConnection = waitForContainerConnection;
|
|
107
101
|
//# sourceMappingURL=TestSummaryUtils.js.map
|
|
@@ -1 +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;AAMlE,iEAAmE;AAInE,+CAAmD;AAEnD,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,KAAK,UAAU,oBAAoB,CAAC,WAA+B,EAAE,MAAmB,EAAE,cAAuB;IAC7G,IAAI,WAAW,KAAK,SAAS,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAChD;IAED,MAAM,OAAO,GAAa;QACtB,OAAO,EAAE;YACL,CAAC,oCAAY,CAAC,KAAK,CAAC,EAAE,KAAK;YAC3B,CAAC,oCAAY,CAAC,aAAa,CAAC,EAAE;gBAC1B,YAAY,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;gBACpC,IAAI,EAAE,oBAAoB;aAC7B;YACD,CAAC,iCAAY,CAAC,iBAAiB,CAAC,EAAE,IAAI;Y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,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 NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ITestContainerConfig, ITestObjectProvider } from \"./testObjectProvider\";\nimport { mockConfigProvider } from \"./TestConfigs\";\n\nconst summarizerClientType = \"summarizer\";\n\nasync function createSummarizerCore(absoluteUrl: string | undefined, loader: IHostLoader, summaryVersion?: string) {\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.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\n return {\n container: summarizerContainer,\n summarizer: fluidObject.ISummarizer,\n };\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 registryEntries?: NamedFluidDataStoreRegistryEntries,\n): Promise<ISummarizer> {\n const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n const runtimeFactory = new containerRuntimeFactoryType(\n dataStoreFactory,\n registryEntries ??\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 const absoluteUrl = await container.getAbsoluteUrl(\"\");\n return (await createSummarizerCore(absoluteUrl, loader, summaryVersion)).summarizer;\n}\n\nexport async function createSummarizer(\n provider: ITestObjectProvider,\n container: IContainer,\n summaryVersion?: string,\n gcOptions?: IGCRuntimeOptions,\n configProvider: IConfigProviderBase = mockConfigProvider(),\n logger?: ITelemetryBaseLogger,\n): Promise<ISummarizer> {\n const absoluteUrl = await container.getAbsoluteUrl(\"\");\n return (await createSummarizerWithContainer(\n provider,\n absoluteUrl,\n summaryVersion,\n gcOptions,\n configProvider,\n logger,\n )).summarizer;\n}\n\nexport async function createSummarizerWithContainer(\n provider: ITestObjectProvider,\n absoluteUrl: string | undefined,\n summaryVersion?: string,\n gcOptions?: IGCRuntimeOptions,\n configProvider: IConfigProviderBase = mockConfigProvider(),\n logger?: ITelemetryBaseLogger,\n): Promise<{ container: IContainer; summarizer: ISummarizer; }> {\n const testContainerConfig: ITestContainerConfig = {\n runtimeOptions: {\n summaryOptions: defaultSummaryOptions,\n gcOptions,\n },\n loaderProps: { configProvider, logger },\n };\n const loader = provider.makeTestLoader(testContainerConfig);\n return createSummarizerCore(absoluteUrl, loader, summaryVersion);\n}\n/**\n * Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the\n * submitted summary.\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 summaryRefSeq: submitResult.data.referenceSequenceNumber,\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"]}
|
|
1
|
+
{"version":3,"file":"TestSummaryUtils.js","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAuF;AACvF,+DAAsD;AACtD,iFAA8F;AAO9F,2EAAkE;AAMlE,iEAAmE;AAInE,+CAAmD;AACnD,qDAA8D;AAE9D,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,KAAK,UAAU,oBAAoB,CAAC,WAA+B,EAAE,MAAmB,EAAE,cAAuB;IAC7G,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1C,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM;QAC/D,aAAa,EAAE,YAAY,CAAC,IAAI,CAAC,uBAAuB;KAC3D,CAAC;AACN,CAAC;AAtBD,oCAsBC","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 {\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 NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ITestContainerConfig, ITestObjectProvider } from \"./testObjectProvider\";\nimport { mockConfigProvider } from \"./TestConfigs\";\nimport { waitForContainerConnection } from \"./containerUtils\";\n\nconst summarizerClientType = \"summarizer\";\n\nasync function createSummarizerCore(absoluteUrl: string | undefined, loader: IHostLoader, summaryVersion?: string) {\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.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\n return {\n container: summarizerContainer,\n summarizer: fluidObject.ISummarizer,\n };\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 registryEntries?: NamedFluidDataStoreRegistryEntries,\n): Promise<ISummarizer> {\n const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n const runtimeFactory = new containerRuntimeFactoryType(\n dataStoreFactory,\n registryEntries ??\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 const absoluteUrl = await container.getAbsoluteUrl(\"\");\n return (await createSummarizerCore(absoluteUrl, loader, summaryVersion)).summarizer;\n}\n\nexport async function createSummarizer(\n provider: ITestObjectProvider,\n container: IContainer,\n summaryVersion?: string,\n gcOptions?: IGCRuntimeOptions,\n configProvider: IConfigProviderBase = mockConfigProvider(),\n logger?: ITelemetryBaseLogger,\n): Promise<ISummarizer> {\n const absoluteUrl = await container.getAbsoluteUrl(\"\");\n return (await createSummarizerWithContainer(\n provider,\n absoluteUrl,\n summaryVersion,\n gcOptions,\n configProvider,\n logger,\n )).summarizer;\n}\n\nexport async function createSummarizerWithContainer(\n provider: ITestObjectProvider,\n absoluteUrl: string | undefined,\n summaryVersion?: string,\n gcOptions?: IGCRuntimeOptions,\n configProvider: IConfigProviderBase = mockConfigProvider(),\n logger?: ITelemetryBaseLogger,\n): Promise<{ container: IContainer; summarizer: ISummarizer; }> {\n const testContainerConfig: ITestContainerConfig = {\n runtimeOptions: {\n summaryOptions: defaultSummaryOptions,\n gcOptions,\n },\n loaderProps: { configProvider, logger },\n };\n const loader = provider.makeTestLoader(testContainerConfig);\n return createSummarizerCore(absoluteUrl, loader, summaryVersion);\n}\n/**\n * Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the\n * submitted summary.\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 summaryRefSeq: submitResult.data.referenceSequenceNumber,\n };\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IContainer } from "@fluidframework/container-definitions";
|
|
6
|
+
import { Container } from "@fluidframework/container-loader";
|
|
7
|
+
import { TimeoutWithError } from "./timeoutUtils";
|
|
8
|
+
/**
|
|
9
|
+
* Waits for the specified container to emit a 'connected' event.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Use waitForContainerConnection instead.
|
|
12
|
+
* Note that an upcoming release will change the default parameters on that function to:
|
|
13
|
+
* - failOnContainerClose = true
|
|
14
|
+
* - timeoutOptions.durationMs = 1s
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensureContainerConnected(container: Container): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Utility function to wait for the specified Container to be in Connected state.
|
|
19
|
+
* If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits
|
|
20
|
+
* its 'connected' event.
|
|
21
|
+
* If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
22
|
+
* before a 'connected' event.
|
|
23
|
+
* @param container - The container to wait for.
|
|
24
|
+
* @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
25
|
+
* before a 'connected' event.
|
|
26
|
+
* Defaults to false (but this will change in an upcoming version).
|
|
27
|
+
* @param timeoutOptions - Options related to the behavior of the timeout.
|
|
28
|
+
* If not provided, no timeout will be applied and the promise will wait indefinitely for the Container to emit its
|
|
29
|
+
* 'connected' (or 'closed, if failOnContainerClose === true) event.
|
|
30
|
+
* @returns A Promise that resolves when the specified container emits a 'connected' event (or immediately if the
|
|
31
|
+
* Container is already connected).
|
|
32
|
+
* If failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event, the Promise
|
|
33
|
+
* is rejected with the error from the 'closed' event, if any.
|
|
34
|
+
* If timeoutOptions is provided, the Promise will reject if the container hasn't emmited a relevant event before
|
|
35
|
+
* timeoutOptions.durationMs (which defaults to 250ms if left undefined).
|
|
36
|
+
*/
|
|
37
|
+
export declare function waitForContainerConnection(container: IContainer, failOnContainerClose?: boolean, timeoutOptions?: TimeoutWithError): Promise<void>;
|
|
38
|
+
//# sourceMappingURL=containerUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerUtils.d.ts","sourceRoot":"","sources":["../src/containerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAmB,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAmC,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEnF;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAIlF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,0BAA0B,CAC5C,SAAS,EAAE,UAAU,EACrB,oBAAoB,GAAE,OAAe,EACrC,cAAc,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYpD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.ensureContainerConnected = void 0;
|
|
8
|
+
const container_loader_1 = require("@fluidframework/container-loader");
|
|
9
|
+
const timeoutUtils_1 = require("./timeoutUtils");
|
|
10
|
+
/**
|
|
11
|
+
* Waits for the specified container to emit a 'connected' event.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated Use waitForContainerConnection instead.
|
|
14
|
+
* Note that an upcoming release will change the default parameters on that function to:
|
|
15
|
+
* - failOnContainerClose = true
|
|
16
|
+
* - timeoutOptions.durationMs = 1s
|
|
17
|
+
*/
|
|
18
|
+
async function ensureContainerConnected(container) {
|
|
19
|
+
if (!container.connected) {
|
|
20
|
+
return (0, timeoutUtils_1.timeoutPromise)((resolve) => container.once("connected", () => resolve()));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ensureContainerConnected = ensureContainerConnected;
|
|
24
|
+
/**
|
|
25
|
+
* Utility function to wait for the specified Container to be in Connected state.
|
|
26
|
+
* If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits
|
|
27
|
+
* its 'connected' event.
|
|
28
|
+
* If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
29
|
+
* before a 'connected' event.
|
|
30
|
+
* @param container - The container to wait for.
|
|
31
|
+
* @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
32
|
+
* before a 'connected' event.
|
|
33
|
+
* Defaults to false (but this will change in an upcoming version).
|
|
34
|
+
* @param timeoutOptions - Options related to the behavior of the timeout.
|
|
35
|
+
* If not provided, no timeout will be applied and the promise will wait indefinitely for the Container to emit its
|
|
36
|
+
* 'connected' (or 'closed, if failOnContainerClose === true) event.
|
|
37
|
+
* @returns A Promise that resolves when the specified container emits a 'connected' event (or immediately if the
|
|
38
|
+
* Container is already connected).
|
|
39
|
+
* If failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event, the Promise
|
|
40
|
+
* is rejected with the error from the 'closed' event, if any.
|
|
41
|
+
* If timeoutOptions is provided, the Promise will reject if the container hasn't emmited a relevant event before
|
|
42
|
+
* timeoutOptions.durationMs (which defaults to 250ms if left undefined).
|
|
43
|
+
*/
|
|
44
|
+
async function waitForContainerConnection(container, failOnContainerClose = false, timeoutOptions) {
|
|
45
|
+
if (container.connectionState !== container_loader_1.ConnectionState.Connected) {
|
|
46
|
+
const executor = (resolve, reject) => {
|
|
47
|
+
container.once("connected", () => resolve());
|
|
48
|
+
if (failOnContainerClose) {
|
|
49
|
+
container.once("closed", (error) => reject(error));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return timeoutOptions === undefined ? new Promise(executor) : (0, timeoutUtils_1.timeoutPromise)(executor, timeoutOptions);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.waitForContainerConnection = waitForContainerConnection;
|
|
56
|
+
//# sourceMappingURL=containerUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerUtils.js","sourceRoot":"","sources":["../src/containerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAA8E;AAC9E,iDAAmF;AAEnF;;;;;;;GAOG;AACI,KAAK,UAAU,wBAAwB,CAAC,SAAoB;IAC/D,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;QACtB,OAAO,IAAA,6BAAc,EAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KACpF;AACL,CAAC;AAJD,4DAIC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,0BAA0B,CAC5C,SAAqB,EACrB,uBAAgC,KAAK,EACrC,cAAiC;IACjC,IAAI,SAAS,CAAC,eAAe,KAAK,kCAAe,CAAC,SAAS,EAAE;QAEzD,MAAM,QAAQ,GAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;YAC5C,IAAI,oBAAoB,EAAE;gBACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aACvD;QACL,CAAC,CAAC;QAEF,OAAO,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;KAC1G;AACL,CAAC;AAfD,gEAeC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer } from \"@fluidframework/container-definitions\";\nimport { ConnectionState, Container } from \"@fluidframework/container-loader\";\nimport { PromiseExecutor, timeoutPromise, TimeoutWithError } from \"./timeoutUtils\";\n\n/**\n * Waits for the specified container to emit a 'connected' event.\n *\n * @deprecated Use waitForContainerConnection instead.\n * Note that an upcoming release will change the default parameters on that function to:\n * - failOnContainerClose = true\n * - timeoutOptions.durationMs = 1s\n */\nexport async function ensureContainerConnected(container: Container): Promise<void> {\n if (!container.connected) {\n return timeoutPromise((resolve) => container.once(\"connected\", () => resolve()));\n }\n}\n\n/**\n * Utility function to wait for the specified Container to be in Connected state.\n * If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits\n * its 'connected' event.\n * If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * @param container - The container to wait for.\n * @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * Defaults to false (but this will change in an upcoming version).\n * @param timeoutOptions - Options related to the behavior of the timeout.\n * If not provided, no timeout will be applied and the promise will wait indefinitely for the Container to emit its\n * 'connected' (or 'closed, if failOnContainerClose === true) event.\n * @returns A Promise that resolves when the specified container emits a 'connected' event (or immediately if the\n * Container is already connected).\n * If failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event, the Promise\n * is rejected with the error from the 'closed' event, if any.\n * If timeoutOptions is provided, the Promise will reject if the container hasn't emmited a relevant event before\n * timeoutOptions.durationMs (which defaults to 250ms if left undefined).\n */\nexport async function waitForContainerConnection(\n container: IContainer,\n failOnContainerClose: boolean = false,\n timeoutOptions?: TimeoutWithError): Promise<void> {\n if (container.connectionState !== ConnectionState.Connected) {\n\n const executor: PromiseExecutor = (resolve, reject) => {\n container.once(\"connected\", () => resolve())\n if (failOnContainerClose) {\n container.once(\"closed\", (error) => reject(error));\n }\n };\n\n return timeoutOptions === undefined ? new Promise(executor) : timeoutPromise(executor, timeoutOptions);\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { mockConfigProvider } from "./TestConfigs";
|
|
|
12
12
|
export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory } from "./testContainerRuntimeFactory";
|
|
13
13
|
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from "./testFluidObject";
|
|
14
14
|
export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, getUnexpectedLogErrorException, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, } from "./testObjectProvider";
|
|
15
|
-
export { createSummarizer, createSummarizerFromFactory, createSummarizerWithContainer, summarizeNow,
|
|
16
|
-
export { defaultTimeoutDurationMs,
|
|
15
|
+
export { createSummarizer, createSummarizerFromFactory, createSummarizerWithContainer, summarizeNow, } from "./TestSummaryUtils";
|
|
16
|
+
export { defaultTimeoutDurationMs, timeoutAwait, timeoutPromise, TimeoutWithError, TimeoutWithValue, } from "./timeoutUtils";
|
|
17
|
+
export { ensureContainerConnected, waitForContainerConnection, } from "./containerUtils";
|
|
17
18
|
//# 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,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,s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AAc,EACd,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,wBAAwB,EACxB,0BAA0B,GAC7B,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.waitForContainerConnection = exports.ensureContainerConnected = exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = exports.summarizeNow = exports.createSummarizerWithContainer = exports.createSummarizerFromFactory = exports.createSummarizer = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.mockConfigProvider = exports.retryWithEventualValue = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = exports.wrapDocumentStorageService = exports.wrapDocumentServiceFactory = exports.wrapDocumentService = void 0;
|
|
8
8
|
var DriverWrappers_1 = require("./DriverWrappers");
|
|
9
9
|
Object.defineProperty(exports, "wrapDocumentService", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentService; } });
|
|
10
10
|
Object.defineProperty(exports, "wrapDocumentServiceFactory", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentServiceFactory; } });
|
|
@@ -37,10 +37,11 @@ Object.defineProperty(exports, "createSummarizer", { enumerable: true, get: func
|
|
|
37
37
|
Object.defineProperty(exports, "createSummarizerFromFactory", { enumerable: true, get: function () { return TestSummaryUtils_1.createSummarizerFromFactory; } });
|
|
38
38
|
Object.defineProperty(exports, "createSummarizerWithContainer", { enumerable: true, get: function () { return TestSummaryUtils_1.createSummarizerWithContainer; } });
|
|
39
39
|
Object.defineProperty(exports, "summarizeNow", { enumerable: true, get: function () { return TestSummaryUtils_1.summarizeNow; } });
|
|
40
|
-
Object.defineProperty(exports, "waitForContainerConnection", { enumerable: true, get: function () { return TestSummaryUtils_1.waitForContainerConnection; } });
|
|
41
40
|
var timeoutUtils_1 = require("./timeoutUtils");
|
|
42
41
|
Object.defineProperty(exports, "defaultTimeoutDurationMs", { enumerable: true, get: function () { return timeoutUtils_1.defaultTimeoutDurationMs; } });
|
|
43
|
-
Object.defineProperty(exports, "ensureContainerConnected", { enumerable: true, get: function () { return timeoutUtils_1.ensureContainerConnected; } });
|
|
44
42
|
Object.defineProperty(exports, "timeoutAwait", { enumerable: true, get: function () { return timeoutUtils_1.timeoutAwait; } });
|
|
45
43
|
Object.defineProperty(exports, "timeoutPromise", { enumerable: true, get: function () { return timeoutUtils_1.timeoutPromise; } });
|
|
44
|
+
var containerUtils_1 = require("./containerUtils");
|
|
45
|
+
Object.defineProperty(exports, "ensureContainerConnected", { enumerable: true, get: function () { return containerUtils_1.ensureContainerConnected; } });
|
|
46
|
+
Object.defineProperty(exports, "waitForContainerConnection", { enumerable: true, get: function () { return containerUtils_1.waitForContainerConnection; } });
|
|
46
47
|
//# 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,mDAA+G;AAAtG,qHAAA,mBAAmB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAEpF,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,qDAAgG;AAAtE,kHAAA,eAAe,OAAA;AACzC,6CAAuE;AAA9D,uHAAA,wBAAwB,OAAA;AAAE,2GAAA,YAAY,OAAA;AAC/C,iCAAiD;AAAxC,+GAAA,sBAAsB,OAAA;AAC/B,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAC3B,6EAA+G;AAAtG,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IlB,mDAG0B;AAFtB,0HAAA,wBAAwB,OAAA;AACxB,4HAAA,0BAA0B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { wrapDocumentService, wrapDocumentServiceFactory, wrapDocumentStorageService } from \"./DriverWrappers\";\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nexport { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from \"./localCodeLoader\";\nexport { createAndAttachContainer, createLoader } from \"./localLoader\";\nexport { retryWithEventualValue } from \"./retry\";\nexport { mockConfigProvider } from \"./TestConfigs\";\nexport { createTestContainerRuntimeFactory, TestContainerRuntimeFactory } from \"./testContainerRuntimeFactory\";\nexport { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from \"./testFluidObject\";\nexport {\n createDocumentId,\n DataObjectFactoryType,\n EventAndErrorTrackingLogger,\n getUnexpectedLogErrorException,\n IOpProcessingController,\n ITestContainerConfig,\n ITestObjectProvider,\n TestObjectProvider,\n} from \"./testObjectProvider\";\nexport {\n createSummarizer,\n createSummarizerFromFactory,\n createSummarizerWithContainer,\n summarizeNow,\n} from \"./TestSummaryUtils\";\nexport {\n defaultTimeoutDurationMs,\n timeoutAwait,\n timeoutPromise,\n TimeoutWithError,\n TimeoutWithValue,\n} from \"./timeoutUtils\";\nexport {\n ensureContainerConnected,\n waitForContainerConnection,\n} from \"./containerUtils\";\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 = "2.0.0-internal.2.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.2.4.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
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 = "2.0.0-internal.2.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.2.4.1";
|
|
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,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.2.
|
|
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.2.4.1\";\n"]}
|
|
@@ -41,8 +41,7 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
|
|
|
41
41
|
const runtime = await containerRuntimeCtor.load(context, [
|
|
42
42
|
["default", Promise.resolve(this.dataStoreFactory)],
|
|
43
43
|
[this.type, Promise.resolve(this.dataStoreFactory)],
|
|
44
|
-
], (0, request_handler_1.buildRuntimeRequestHandler)((0, aqueduct_1.defaultRouteRequestHandler)("default"), ...this.requestHandlers), this.runtimeOptions,
|
|
45
|
-
existing);
|
|
44
|
+
], (0, request_handler_1.buildRuntimeRequestHandler)((0, aqueduct_1.defaultRouteRequestHandler)("default"), ...this.requestHandlers), this.runtimeOptions, context.scope, existing);
|
|
46
45
|
return runtime;
|
|
47
46
|
}
|
|
48
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,qEAEmE;AAEnE,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAAC,oBAA6C,EAAE,EAAE;IAC/F,OAAO,KAAM,SAAQ,oCAAoB;QACrC,YACW,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YAC9C,cAAc,EAAE;gBACZ,sBAAsB,kCACf,+CAA2B,GAC3B;oBACC,wBAAwB,EAAE,CAAC;iBAC9B,CACJ;aACJ;SACJ,EACM,kBAA2C,EAAE;YAEpD,KAAK,EAAE,CAAC;YAdD,SAAI,GAAJ,IAAI,CAAQ;YACZ,qBAAgB,GAAhB,gBAAgB,CAAwB;YACxC,mBAAc,GAAd,cAAc,CASpB;YACM,oBAAe,GAAf,eAAe,CAA8B;QAGxD,CAAC;QAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;YACvD,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;YAChF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;YACxG,MAAM,WAAW,CAAC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,CAA8B;QAGxD,CAAC;QAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;YACvD,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;YAChF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;YACxG,MAAM,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;QAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;YAC1D,yCAAyC;YACzC,oFAAoF;YACpF,MAAM,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,aAAa,CACf,OAA0B,EAC1B,QAAiB;YAEjB,MAAM,OAAO,GAAqB,MAAM,oBAAoB,CAAC,IAAI,CAC7D,OAAO,EACP;gBACI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACnD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACtD,EACD,IAAA,4CAA0B,EACtB,IAAA,qCAA0B,EAAC,SAAS,CAAC,EACrC,GAAG,IAAI,CAAC,eAAe,CAC1B,EACD,IAAI,CAAC,cAAc,EACnB,OAAO,CAAC,KAAK,EACb,QAAQ,CACX,CAAC;YAEF,OAAO,OAAO,CAAC;QACnB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAtDW,QAAA,iCAAiC,qCAsD5C;AAEF;;GAEG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport {\n ContainerRuntime,\n IContainerRuntimeOptions,\n DefaultSummaryConfiguration,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n buildRuntimeRequestHandler,\n RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n */\nexport const createTestContainerRuntimeFactory = (containerRuntimeCtor: typeof ContainerRuntime) => {\n return class extends RuntimeFactoryHelper {\n constructor(\n public type: string,\n public dataStoreFactory: IFluidDataStoreFactory,\n public runtimeOptions: IContainerRuntimeOptions = {\n summaryOptions: {\n summaryConfigOverrides: {\n ...DefaultSummaryConfiguration,\n ...{\n initialSummarizerDelayMs: 0,\n },\n },\n },\n },\n public requestHandlers: RuntimeRequestHandler[] = [],\n ) {\n super();\n }\n\n public async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n const rootContext = runtime.createDetachedRootDataStore([this.type], \"default\");\n const rootRuntime = await this.dataStoreFactory.instantiateDataStore(rootContext, /* existing */ false);\n await rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\n }\n\n public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n // Validate we can load root data stores.\n // We should be able to load any data store that was created in initializeFirstTime!\n await runtime.getRootDataStore(\"default\");\n }\n\n async preInitialize(\n context: IContainerContext,\n existing: boolean,\n ): Promise<IRuntime & IContainerRuntime> {\n const runtime: ContainerRuntime = await containerRuntimeCtor.load(\n context,\n [\n [\"default\", Promise.resolve(this.dataStoreFactory)],\n [this.type, Promise.resolve(this.dataStoreFactory)],\n ],\n buildRuntimeRequestHandler(\n defaultRouteRequestHandler(\"default\"),\n ...this.requestHandlers,\n ),\n this.runtimeOptions,\n context.scope,\n existing,\n );\n\n return runtime;\n }\n };\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
|
|
@@ -56,6 +56,8 @@ export interface ITestContainerConfig {
|
|
|
56
56
|
registry?: ChannelFactoryRegistry;
|
|
57
57
|
/** Container runtime options for the container instance */
|
|
58
58
|
runtimeOptions?: IContainerRuntimeOptions;
|
|
59
|
+
/** Whether this runtime should be instantiated using a mixed-in attributor class */
|
|
60
|
+
enableAttribution?: boolean;
|
|
59
61
|
/** Loader options for the loader used to create containers */
|
|
60
62
|
loaderProps?: Partial<ILoaderProps>;
|
|
61
63
|
}
|
|
@@ -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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AE,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(timeoutDuration?: number): 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 /** Even if these error events are logged, tests should still be allowed to pass */\n private readonly allowedErrors: string[] = [\n // This log was removed in current version as unnecessary, but it's still present in previous versions\n \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n ];\n\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 if (this.allowedErrors.includes(event.eventName)) {\n event.category = \"generic\";\n } else {\n this.unexpectedErrors.push(event);\n }\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(timeoutDuration?: number): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !timeoutDuration\n ? this._loaderContainerTracker.ensureSynchronized()\n : this._loaderContainerTracker.ensureSynchronizedWithTimeout?.(timeoutDuration);\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":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uEAI0C;AAI1C,+DAAsE;AAEtE,+BAAkC;AAClC,qEAAgG;AAChG,qEAAkE;AAClE,uDAAqE;AACrE,+CAAyD;AAGzD,MAAM,kBAAkB,GAAsB;IAC1C,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,EAAE;CACb,CAAC;AAgDF,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC7B,qEAAM,CAAA;IACN,iEAAI,CAAA;AACR,CAAC,EAHW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAGhC;AAmBM,MAAM,gBAAgB,GAAG,GAAW,EAAE,CAAC,IAAA,SAAI,GAAE,CAAC;AAAxC,QAAA,gBAAgB,oBAAwB;AAQrD;;;GAGG;AACH,SAAS,qBAAqB,CAAC,IAAsB;IACjD,IAAI,UAAU,GAAG,IAAA,wBAAgB,GAAE,CAAC;IACpC,QAAQ,IAAI,EAAE;QACV,KAAK,MAAM;YACP,OAAO;gBACH,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU;gBACrB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;gBACjB,KAAK,EAAE,GAAG,EAAE,GAAG,UAAU,GAAG,IAAA,wBAAgB,GAAE,CAAC,CAAC,CAAC;aACpD,CAAC;QACN;YACI,OAAO;gBACH,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU;gBACrB,MAAM,EAAE,CAAC,WAA0B,EAAE,EAAE;;oBACnC,sFAAsF;oBACtF,IAAA,qCAAsB,EAAC,WAAW,CAAC,CAAC;oBACpC,UAAU,GAAG,MAAA,WAAW,CAAC,EAAE,mCAAI,UAAU,CAAC;gBAC9C,CAAC;gBACD,KAAK,EAAE,GAAG,EAAE,GAAG,UAAU,GAAG,I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ft 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(timeoutDuration?: number): 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 /** Whether this runtime should be instantiated using a mixed-in attributor class */\n enableAttribution?: boolean;\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 /** Even if these error events are logged, tests should still be allowed to pass */\n private readonly allowedErrors: string[] = [\n // This log was removed in current version as unnecessary, but it's still present in previous versions\n \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n ];\n\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 if (this.allowedErrors.includes(event.eventName)) {\n event.category = \"generic\";\n } else {\n this.unexpectedErrors.push(event);\n }\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(timeoutDuration?: number): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !timeoutDuration\n ? this._loaderContainerTracker.ensureSynchronized()\n : this._loaderContainerTracker.ensureSynchronizedWithTimeout?.(timeoutDuration);\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,7 +2,6 @@
|
|
|
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";
|
|
6
5
|
export declare const defaultTimeoutDurationMs = 250;
|
|
7
6
|
export interface TimeoutWithError {
|
|
8
7
|
durationMs?: number;
|
|
@@ -14,7 +13,7 @@ export interface TimeoutWithValue<T = void> {
|
|
|
14
13
|
reject: false;
|
|
15
14
|
value: T;
|
|
16
15
|
}
|
|
16
|
+
export declare type PromiseExecutor<T = void> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
|
|
17
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>;
|
|
19
18
|
export declare function timeoutPromise<T = void>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
|
|
20
19
|
//# sourceMappingURL=timeoutUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutUtils.d.ts","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
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,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACZ;AAED,oBAAY,eAAe,CAAC,CAAC,GAAG,IAAI,IAAI,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,CAAC;AAE/H,wBAAsB,YAAY,CAAC,CAAC,GAAG,IAAI,EACvC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,cAG9D;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,18 +4,12 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.timeoutPromise = exports.
|
|
7
|
+
exports.timeoutPromise = 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;
|
|
19
13
|
async function timeoutPromise(executor, timeoutOptions = {}) {
|
|
20
14
|
var _a;
|
|
21
15
|
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
|
+
{"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAerC,KAAK,UAAU,YAAY,CAC9B,OAAuB,EACvB,iBAAyD,EAAE;IAE3D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,cAAc,CAAI,GAAG,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AALD,oCAKC;AAEM,KAAK,UAAU,cAAc,CAChC,QAAgG,EAChG,iBAAyD,EAAE;;IAE3D,MAAM,OAAO,GACT,cAAc,CAAC,UAAU,KAAK,SAAS;WACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC;WAC1C,cAAc,CAAC,UAAU,GAAG,CAAC;QAC5B,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,gCAAwB,CAAC;IAC/D,6EAA6E;IAC7E,wDAAwD;IACxD,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,KAAK,KAAK;QACvC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,MAAA,cAAc,CAAC,QAAQ,mCAAI,WAAW,IAAI,OAAO,KAAK,CAAC,CAAC;IAC3E,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,UAAU,CACpB,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,KAAK,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\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 type PromiseExecutor<T = void> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;\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 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 its 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": "2.0.0-internal.2.
|
|
3
|
+
"version": "2.0.0-internal.2.4.1",
|
|
4
4
|
"description": "Utilities for Fluid tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -57,44 +57,45 @@
|
|
|
57
57
|
"temp-directory": "nyc/.nyc_output"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@fluidframework/aqueduct": ">=2.0.0-internal.2.
|
|
60
|
+
"@fluidframework/aqueduct": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
61
61
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
62
62
|
"@fluidframework/common-utils": "^1.0.0",
|
|
63
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.2.
|
|
64
|
-
"@fluidframework/container-loader": ">=2.0.0-internal.2.
|
|
65
|
-
"@fluidframework/container-runtime": ">=2.0.0-internal.2.
|
|
66
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.
|
|
67
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.2.
|
|
68
|
-
"@fluidframework/datastore": ">=2.0.0-internal.2.
|
|
69
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.2.
|
|
70
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.2.
|
|
71
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.2.
|
|
72
|
-
"@fluidframework/local-driver": ">=2.0.0-internal.2.
|
|
73
|
-
"@fluidframework/map": ">=2.0.0-internal.2.
|
|
63
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
64
|
+
"@fluidframework/container-loader": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
65
|
+
"@fluidframework/container-runtime": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
66
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
67
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
68
|
+
"@fluidframework/datastore": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
69
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
70
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
71
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
72
|
+
"@fluidframework/local-driver": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
73
|
+
"@fluidframework/map": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
74
74
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
75
|
-
"@fluidframework/request-handler": ">=2.0.0-internal.2.
|
|
76
|
-
"@fluidframework/routerlicious-driver": ">=2.0.0-internal.2.
|
|
77
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.2.
|
|
78
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.2.
|
|
79
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.2.
|
|
80
|
-
"@fluidframework/test-driver-definitions": ">=2.0.0-internal.2.
|
|
81
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.
|
|
75
|
+
"@fluidframework/request-handler": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
76
|
+
"@fluidframework/routerlicious-driver": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
77
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
78
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
79
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
80
|
+
"@fluidframework/test-driver-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
81
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
|
|
82
82
|
"best-random": "^1.0.0",
|
|
83
83
|
"debug": "^4.1.1",
|
|
84
84
|
"uuid": "^8.3.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@fluid-tools/build-cli": "^0.
|
|
87
|
+
"@fluid-tools/build-cli": "^0.8.0",
|
|
88
88
|
"@fluidframework/build-common": "^1.1.0",
|
|
89
|
-
"@fluidframework/build-tools": "^0.
|
|
89
|
+
"@fluidframework/build-tools": "^0.8.0",
|
|
90
90
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
91
|
-
"@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.0.0-internal.2.
|
|
91
|
+
"@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.0.0-internal.2.4.0",
|
|
92
92
|
"@microsoft/api-extractor": "^7.22.2",
|
|
93
93
|
"@rushstack/eslint-config": "^2.5.1",
|
|
94
94
|
"@types/diff": "^3.5.1",
|
|
95
95
|
"@types/mocha": "^9.1.1",
|
|
96
|
-
"@types/node": "^14.18.
|
|
96
|
+
"@types/node": "^14.18.36",
|
|
97
97
|
"@types/random-js": "^1.0.31",
|
|
98
|
+
"@types/uuid": "^8.3.0",
|
|
98
99
|
"concurrently": "^6.2.0",
|
|
99
100
|
"copyfiles": "^2.4.1",
|
|
100
101
|
"diff": "^3.5.0",
|
|
@@ -107,8 +108,9 @@
|
|
|
107
108
|
"typescript": "~4.5.5"
|
|
108
109
|
},
|
|
109
110
|
"typeValidation": {
|
|
110
|
-
"version": "2.0.0-internal.2.
|
|
111
|
-
"
|
|
111
|
+
"version": "2.0.0-internal.2.4.0",
|
|
112
|
+
"previousVersionStyle": "previousPatch",
|
|
113
|
+
"baselineRange": "2.0.0-internal.2.4.0",
|
|
112
114
|
"broken": {}
|
|
113
115
|
}
|
|
114
116
|
}
|
package/src/TestSummaryUtils.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct";
|
|
7
7
|
import { assert } from "@fluidframework/common-utils";
|
|
8
8
|
import { IContainer, IHostLoader, LoaderHeader } from "@fluidframework/container-definitions";
|
|
9
|
-
import { ConnectionState } from "@fluidframework/container-loader";
|
|
10
9
|
import {
|
|
11
10
|
IGCRuntimeOptions,
|
|
12
11
|
ISummarizer,
|
|
@@ -24,6 +23,7 @@ import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
|
|
|
24
23
|
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
25
24
|
import { ITestContainerConfig, ITestObjectProvider } from "./testObjectProvider";
|
|
26
25
|
import { mockConfigProvider } from "./TestConfigs";
|
|
26
|
+
import { waitForContainerConnection } from "./containerUtils";
|
|
27
27
|
|
|
28
28
|
const summarizerClientType = "summarizer";
|
|
29
29
|
|
|
@@ -162,9 +162,3 @@ export async function summarizeNow(summarizer: ISummarizer, reason: string = "en
|
|
|
162
162
|
summaryRefSeq: submitResult.data.referenceSequenceNumber,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
export async function waitForContainerConnection(container: IContainer): Promise<void> {
|
|
167
|
-
if (container.connectionState !== ConnectionState.Connected) {
|
|
168
|
-
return new Promise((resolve) => container.once("connected", () => resolve()));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IContainer } from "@fluidframework/container-definitions";
|
|
7
|
+
import { ConnectionState, Container } from "@fluidframework/container-loader";
|
|
8
|
+
import { PromiseExecutor, timeoutPromise, TimeoutWithError } from "./timeoutUtils";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Waits for the specified container to emit a 'connected' event.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated Use waitForContainerConnection instead.
|
|
14
|
+
* Note that an upcoming release will change the default parameters on that function to:
|
|
15
|
+
* - failOnContainerClose = true
|
|
16
|
+
* - timeoutOptions.durationMs = 1s
|
|
17
|
+
*/
|
|
18
|
+
export async function ensureContainerConnected(container: Container): Promise<void> {
|
|
19
|
+
if (!container.connected) {
|
|
20
|
+
return timeoutPromise((resolve) => container.once("connected", () => resolve()));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Utility function to wait for the specified Container to be in Connected state.
|
|
26
|
+
* If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits
|
|
27
|
+
* its 'connected' event.
|
|
28
|
+
* If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
29
|
+
* before a 'connected' event.
|
|
30
|
+
* @param container - The container to wait for.
|
|
31
|
+
* @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
32
|
+
* before a 'connected' event.
|
|
33
|
+
* Defaults to false (but this will change in an upcoming version).
|
|
34
|
+
* @param timeoutOptions - Options related to the behavior of the timeout.
|
|
35
|
+
* If not provided, no timeout will be applied and the promise will wait indefinitely for the Container to emit its
|
|
36
|
+
* 'connected' (or 'closed, if failOnContainerClose === true) event.
|
|
37
|
+
* @returns A Promise that resolves when the specified container emits a 'connected' event (or immediately if the
|
|
38
|
+
* Container is already connected).
|
|
39
|
+
* If failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event, the Promise
|
|
40
|
+
* is rejected with the error from the 'closed' event, if any.
|
|
41
|
+
* If timeoutOptions is provided, the Promise will reject if the container hasn't emmited a relevant event before
|
|
42
|
+
* timeoutOptions.durationMs (which defaults to 250ms if left undefined).
|
|
43
|
+
*/
|
|
44
|
+
export async function waitForContainerConnection(
|
|
45
|
+
container: IContainer,
|
|
46
|
+
failOnContainerClose: boolean = false,
|
|
47
|
+
timeoutOptions?: TimeoutWithError): Promise<void> {
|
|
48
|
+
if (container.connectionState !== ConnectionState.Connected) {
|
|
49
|
+
|
|
50
|
+
const executor: PromiseExecutor = (resolve, reject) => {
|
|
51
|
+
container.once("connected", () => resolve())
|
|
52
|
+
if (failOnContainerClose) {
|
|
53
|
+
container.once("closed", (error) => reject(error));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return timeoutOptions === undefined ? new Promise(executor) : timeoutPromise(executor, timeoutOptions);
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -27,13 +27,15 @@ export {
|
|
|
27
27
|
createSummarizerFromFactory,
|
|
28
28
|
createSummarizerWithContainer,
|
|
29
29
|
summarizeNow,
|
|
30
|
-
waitForContainerConnection,
|
|
31
30
|
} from "./TestSummaryUtils";
|
|
32
31
|
export {
|
|
33
32
|
defaultTimeoutDurationMs,
|
|
34
|
-
ensureContainerConnected,
|
|
35
33
|
timeoutAwait,
|
|
36
34
|
timeoutPromise,
|
|
37
35
|
TimeoutWithError,
|
|
38
36
|
TimeoutWithValue,
|
|
39
37
|
} from "./timeoutUtils";
|
|
38
|
+
export {
|
|
39
|
+
ensureContainerConnected,
|
|
40
|
+
waitForContainerConnection,
|
|
41
|
+
} from "./containerUtils";
|
package/src/packageVersion.ts
CHANGED
|
@@ -88,6 +88,9 @@ export interface ITestContainerConfig {
|
|
|
88
88
|
/** Container runtime options for the container instance */
|
|
89
89
|
runtimeOptions?: IContainerRuntimeOptions;
|
|
90
90
|
|
|
91
|
+
/** Whether this runtime should be instantiated using a mixed-in attributor class */
|
|
92
|
+
enableAttribution?: boolean;
|
|
93
|
+
|
|
91
94
|
/** Loader options for the loader used to create containers */
|
|
92
95
|
loaderProps?: Partial<ILoaderProps>;
|
|
93
96
|
}
|
package/src/timeoutUtils.ts
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Container } from "@fluidframework/container-loader";
|
|
7
|
-
|
|
8
6
|
export const defaultTimeoutDurationMs = 250;
|
|
9
7
|
|
|
10
8
|
export interface TimeoutWithError {
|
|
@@ -18,6 +16,8 @@ export interface TimeoutWithValue<T = void> {
|
|
|
18
16
|
value: T;
|
|
19
17
|
}
|
|
20
18
|
|
|
19
|
+
export type PromiseExecutor<T = void> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
|
|
20
|
+
|
|
21
21
|
export async function timeoutAwait<T = void>(
|
|
22
22
|
promise: PromiseLike<T>,
|
|
23
23
|
timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},
|
|
@@ -25,12 +25,6 @@ export async function timeoutAwait<T = void>(
|
|
|
25
25
|
return Promise.race([promise, timeoutPromise<T>(() => { }, timeoutOptions)]);
|
|
26
26
|
}
|
|
27
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
|
-
|
|
34
28
|
export async function timeoutPromise<T = void>(
|
|
35
29
|
executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,
|
|
36
30
|
timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},
|