@fluidframework/test-utils 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +8 -10
- package/README.md +41 -11
- package/api-extractor.json +2 -2
- package/dist/DriverWrappers.d.ts.map +1 -1
- package/dist/DriverWrappers.js.map +1 -1
- package/dist/TestConfigs.d.ts.map +1 -1
- package/dist/TestConfigs.js +3 -2
- package/dist/TestConfigs.js.map +1 -1
- package/dist/TestSummaryUtils.d.ts +15 -4
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +23 -17
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/containerUtils.d.ts +1 -2
- package/dist/containerUtils.d.ts.map +1 -1
- package/dist/containerUtils.js +4 -2
- package/dist/containerUtils.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/loaderContainerTracker.d.ts.map +1 -1
- package/dist/loaderContainerTracker.js +37 -27
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/localCodeLoader.d.ts.map +1 -1
- package/dist/localCodeLoader.js.map +1 -1
- package/dist/localLoader.d.ts.map +1 -1
- package/dist/localLoader.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/retry.d.ts.map +1 -1
- package/dist/retry.js.map +1 -1
- package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactory.js +2 -1
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +7 -3
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testObjectProvider.d.ts +4 -1
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +28 -11
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.d.ts.map +1 -1
- package/dist/timeoutUtils.js +4 -3
- package/dist/timeoutUtils.js.map +1 -1
- package/package.json +66 -55
- package/prettier.config.cjs +1 -1
- package/src/DriverWrappers.ts +40 -37
- package/src/TestConfigs.ts +9 -7
- package/src/TestSummaryUtils.ts +113 -119
- package/src/containerUtils.ts +20 -18
- package/src/index.ts +24 -25
- package/src/interfaces.ts +10 -7
- package/src/loaderContainerTracker.ts +627 -565
- package/src/localCodeLoader.ts +85 -77
- package/src/localLoader.ts +24 -24
- package/src/packageVersion.ts +1 -1
- package/src/retry.ts +31 -25
- package/src/testContainerRuntimeFactory.ts +59 -56
- package/src/testFluidObject.ts +168 -152
- package/src/testObjectProvider.ts +445 -384
- package/src/timeoutUtils.ts +174 -154
- package/tsconfig.json +9 -16
package/src/DriverWrappers.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
IDocumentService,
|
|
9
|
+
IDocumentServiceFactory,
|
|
10
|
+
IDocumentStorageService,
|
|
11
|
+
IResolvedUrl,
|
|
12
|
+
ISummaryContext,
|
|
13
13
|
} from "@fluidframework/driver-definitions";
|
|
14
14
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
15
15
|
|
|
@@ -19,18 +19,18 @@ import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
|
19
19
|
* callback before it is uploaded to the server.
|
|
20
20
|
*/
|
|
21
21
|
export function wrapDocumentStorageService(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
innerDocStorageService: IDocumentStorageService,
|
|
23
|
+
uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,
|
|
24
24
|
) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
const outerDocStorageService = Object.create(innerDocStorageService) as IDocumentStorageService;
|
|
26
|
+
outerDocStorageService.uploadSummaryWithContext = async (
|
|
27
|
+
summary: ISummaryTree,
|
|
28
|
+
context: ISummaryContext,
|
|
29
|
+
): Promise<string> => {
|
|
30
|
+
const newContext = uploadSummaryCb(summary, context);
|
|
31
|
+
return innerDocStorageService.uploadSummaryWithContext(summary, newContext);
|
|
32
|
+
};
|
|
33
|
+
return outerDocStorageService;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -41,15 +41,15 @@ export function wrapDocumentStorageService(
|
|
|
41
41
|
* to pass in the `uploadSummaryCb`.
|
|
42
42
|
*/
|
|
43
43
|
export function wrapDocumentService(
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
innerDocService: IDocumentService,
|
|
45
|
+
uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,
|
|
46
46
|
) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const outerDocService = Object.create(innerDocService) as IDocumentService;
|
|
48
|
+
outerDocService.connectToStorage = async (): Promise<IDocumentStorageService> => {
|
|
49
|
+
const storageService = await innerDocService.connectToStorage();
|
|
50
|
+
return wrapDocumentStorageService(storageService, uploadSummaryCb);
|
|
51
|
+
};
|
|
52
|
+
return outerDocService;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -60,18 +60,21 @@ export function wrapDocumentService(
|
|
|
60
60
|
* pass in the `uploadSummaryCb`.
|
|
61
61
|
*/
|
|
62
62
|
export function wrapDocumentServiceFactory(
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
innerDocServiceFactory: IDocumentServiceFactory,
|
|
64
|
+
uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext,
|
|
65
65
|
) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
const outerDocServiceFactory = Object.create(innerDocServiceFactory) as IDocumentServiceFactory;
|
|
67
|
+
outerDocServiceFactory.createDocumentService = async (
|
|
68
|
+
resolvedUrl: IResolvedUrl,
|
|
69
|
+
logger?: ITelemetryBaseLogger,
|
|
70
|
+
clientIsSummarizer?: boolean,
|
|
71
|
+
): Promise<IDocumentService> => {
|
|
72
|
+
const documentService = await innerDocServiceFactory.createDocumentService(
|
|
73
|
+
resolvedUrl,
|
|
74
|
+
logger,
|
|
75
|
+
clientIsSummarizer,
|
|
76
|
+
);
|
|
77
|
+
return wrapDocumentService(documentService, uploadSummaryCb);
|
|
78
|
+
};
|
|
79
|
+
return outerDocServiceFactory;
|
|
77
80
|
}
|
package/src/TestConfigs.ts
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
import { ConfigTypes, IConfigProviderBase } from "@fluidframework/telemetry-utils";
|
|
7
7
|
|
|
8
|
-
export const mockConfigProvider = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export const mockConfigProvider = (
|
|
9
|
+
settings: Record<string, ConfigTypes> = {},
|
|
10
|
+
): IConfigProviderBase => {
|
|
11
|
+
settings["Fluid.GarbageCollection.TrackGCState"] = "true";
|
|
12
|
+
settings["Fluid.GarbageCollection.WriteDataAtRoot"] = "true";
|
|
13
|
+
return {
|
|
14
|
+
getRawConfig: (name: string): ConfigTypes => settings[name],
|
|
15
|
+
};
|
|
16
|
+
};
|
package/src/TestSummaryUtils.ts
CHANGED
|
@@ -7,16 +7,16 @@ import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqu
|
|
|
7
7
|
import { assert } from "@fluidframework/common-utils";
|
|
8
8
|
import { IContainer, IHostLoader, LoaderHeader } from "@fluidframework/container-definitions";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
IGCRuntimeOptions,
|
|
11
|
+
ISummarizer,
|
|
12
|
+
ISummaryRuntimeOptions,
|
|
13
13
|
} from "@fluidframework/container-runtime";
|
|
14
14
|
import { FluidObject, IRequest } from "@fluidframework/core-interfaces";
|
|
15
15
|
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
IContainerRuntimeBase,
|
|
18
|
+
IFluidDataStoreFactory,
|
|
19
|
+
NamedFluidDataStoreRegistryEntries,
|
|
20
20
|
} from "@fluidframework/runtime-definitions";
|
|
21
21
|
import { requestFluidObject } from "@fluidframework/runtime-utils";
|
|
22
22
|
import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
|
|
@@ -28,137 +28,131 @@ import { timeoutAwait } from "./timeoutUtils";
|
|
|
28
28
|
|
|
29
29
|
const summarizerClientType = "summarizer";
|
|
30
30
|
|
|
31
|
-
async function createSummarizerCore(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
31
|
+
async function createSummarizerCore(
|
|
32
|
+
container: IContainer,
|
|
33
|
+
loader: IHostLoader,
|
|
34
|
+
summaryVersion?: string,
|
|
35
|
+
) {
|
|
36
|
+
const absoluteUrl = await container.getAbsoluteUrl("");
|
|
37
|
+
if (absoluteUrl === undefined) {
|
|
38
|
+
throw new Error("URL could not be resolved");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const request: IRequest = {
|
|
42
|
+
headers: {
|
|
43
|
+
[LoaderHeader.cache]: false,
|
|
44
|
+
[LoaderHeader.clientDetails]: {
|
|
45
|
+
capabilities: { interactive: false },
|
|
46
|
+
type: summarizerClientType,
|
|
47
|
+
},
|
|
48
|
+
[DriverHeader.summarizingClient]: true,
|
|
49
|
+
[LoaderHeader.version]: summaryVersion,
|
|
50
|
+
},
|
|
51
|
+
url: absoluteUrl,
|
|
52
|
+
};
|
|
53
|
+
const summarizerContainer = await loader.resolve(request);
|
|
54
|
+
await waitForContainerConnection(summarizerContainer);
|
|
55
|
+
|
|
56
|
+
const fluidObject = await requestFluidObject<FluidObject<ISummarizer>>(summarizerContainer, {
|
|
57
|
+
url: "_summarizer",
|
|
58
|
+
});
|
|
59
|
+
if (fluidObject.ISummarizer === undefined) {
|
|
60
|
+
throw new Error("Fluid object does not implement ISummarizer");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
container: summarizerContainer,
|
|
65
|
+
summarizer: fluidObject.ISummarizer,
|
|
66
|
+
};
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
const defaultSummaryOptions: ISummaryRuntimeOptions = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
summaryConfigOverrides: {
|
|
71
|
+
state: "disableHeuristics",
|
|
72
|
+
maxAckWaitTime: 10000,
|
|
73
|
+
maxOpsSinceLastSummary: 7000,
|
|
74
|
+
initialSummarizerDelayMs: 0,
|
|
75
|
+
},
|
|
70
76
|
};
|
|
71
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Creates a summarizer client from the given container and data store factory, and returns the summarizer client's
|
|
80
|
+
* IContainer and ISummarizer.
|
|
81
|
+
* The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
|
|
82
|
+
*/
|
|
72
83
|
export async function createSummarizerFromFactory(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
): Promise<ISummarizer> {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
[[provider.defaultCodeDetails, runtimeFactory]],
|
|
95
|
-
{ configProvider: mockConfigProvider() },
|
|
96
|
-
);
|
|
97
|
-
const absoluteUrl = await container.getAbsoluteUrl("");
|
|
98
|
-
return (await createSummarizerCore(absoluteUrl, loader, summaryVersion)).summarizer;
|
|
84
|
+
provider: ITestObjectProvider,
|
|
85
|
+
container: IContainer,
|
|
86
|
+
dataStoreFactory: IFluidDataStoreFactory,
|
|
87
|
+
summaryVersion?: string,
|
|
88
|
+
containerRuntimeFactoryType = ContainerRuntimeFactoryWithDefaultDataStore,
|
|
89
|
+
registryEntries?: NamedFluidDataStoreRegistryEntries,
|
|
90
|
+
): Promise<{ container: IContainer; summarizer: ISummarizer }> {
|
|
91
|
+
const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>
|
|
92
|
+
runtime.IFluidHandleContext.resolveHandle(request);
|
|
93
|
+
const runtimeFactory = new containerRuntimeFactoryType(
|
|
94
|
+
dataStoreFactory,
|
|
95
|
+
registryEntries ?? [[dataStoreFactory.type, Promise.resolve(dataStoreFactory)]],
|
|
96
|
+
undefined,
|
|
97
|
+
[innerRequestHandler],
|
|
98
|
+
{ summaryOptions: defaultSummaryOptions },
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], {
|
|
102
|
+
configProvider: mockConfigProvider(),
|
|
103
|
+
});
|
|
104
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
99
105
|
}
|
|
100
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Creates a summarizer client from the given container and returns the summarizer client's IContainer and ISummarizer.
|
|
109
|
+
* The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
|
|
110
|
+
*/
|
|
101
111
|
export async function createSummarizer(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
): Promise<ISummarizer> {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
provider: ITestObjectProvider,
|
|
113
|
+
container: IContainer,
|
|
114
|
+
summaryVersion?: string,
|
|
115
|
+
gcOptions?: IGCRuntimeOptions,
|
|
116
|
+
configProvider: IConfigProviderBase = mockConfigProvider(),
|
|
117
|
+
logger?: ITelemetryBaseLogger,
|
|
118
|
+
): Promise<{ container: IContainer; summarizer: ISummarizer }> {
|
|
119
|
+
const testContainerConfig: ITestContainerConfig = {
|
|
120
|
+
runtimeOptions: {
|
|
121
|
+
summaryOptions: defaultSummaryOptions,
|
|
122
|
+
gcOptions,
|
|
123
|
+
},
|
|
124
|
+
loaderProps: { configProvider, logger },
|
|
125
|
+
};
|
|
126
|
+
const loader = provider.makeTestLoader(testContainerConfig);
|
|
127
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
118
128
|
}
|
|
119
129
|
|
|
120
|
-
export async function createSummarizerWithContainer(
|
|
121
|
-
provider: ITestObjectProvider,
|
|
122
|
-
absoluteUrl: string | undefined,
|
|
123
|
-
summaryVersion?: string,
|
|
124
|
-
gcOptions?: IGCRuntimeOptions,
|
|
125
|
-
configProvider: IConfigProviderBase = mockConfigProvider(),
|
|
126
|
-
logger?: ITelemetryBaseLogger,
|
|
127
|
-
): Promise<{ container: IContainer; summarizer: ISummarizer; }> {
|
|
128
|
-
const testContainerConfig: ITestContainerConfig = {
|
|
129
|
-
runtimeOptions: {
|
|
130
|
-
summaryOptions: defaultSummaryOptions,
|
|
131
|
-
gcOptions,
|
|
132
|
-
},
|
|
133
|
-
loaderProps: { configProvider, logger },
|
|
134
|
-
};
|
|
135
|
-
const loader = provider.makeTestLoader(testContainerConfig);
|
|
136
|
-
return createSummarizerCore(absoluteUrl, loader, summaryVersion);
|
|
137
|
-
}
|
|
138
130
|
/**
|
|
139
131
|
* Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the
|
|
140
132
|
* submitted summary.
|
|
141
|
-
*/
|
|
133
|
+
*/
|
|
142
134
|
export async function summarizeNow(summarizer: ISummarizer, reason: string = "end-to-end test") {
|
|
143
|
-
|
|
135
|
+
const result = summarizer.summarizeOnDemand({ reason });
|
|
144
136
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
const submitResult = await timeoutAwait(result.summarySubmitted);
|
|
138
|
+
assert(submitResult.success, "on-demand summary should submit");
|
|
139
|
+
assert(
|
|
140
|
+
submitResult.data.stage === "submit",
|
|
141
|
+
"on-demand summary submitted data stage should be submit",
|
|
142
|
+
);
|
|
143
|
+
assert(submitResult.data.summaryTree !== undefined, "summary tree should exist");
|
|
150
144
|
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
const broadcastResult = await timeoutAwait(result.summaryOpBroadcasted);
|
|
146
|
+
assert(broadcastResult.success, "summary op should be broadcast");
|
|
153
147
|
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
const ackNackResult = await timeoutAwait(result.receivedSummaryAckOrNack);
|
|
149
|
+
assert(ackNackResult.success, "summary op should be acked");
|
|
156
150
|
|
|
157
|
-
|
|
151
|
+
await new Promise((resolve) => process.nextTick(resolve));
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
return {
|
|
154
|
+
summaryTree: submitResult.data.summaryTree,
|
|
155
|
+
summaryVersion: ackNackResult.data.summaryAckOp.contents.handle,
|
|
156
|
+
summaryRefSeq: submitResult.data.referenceSequenceNumber,
|
|
157
|
+
};
|
|
164
158
|
}
|
package/src/containerUtils.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IContainer } from "@fluidframework/container-definitions";
|
|
7
|
-
import { ConnectionState
|
|
7
|
+
import { ConnectionState } from "@fluidframework/container-loader";
|
|
8
8
|
import { PromiseExecutor, timeoutPromise, TimeoutWithError } from "./timeoutUtils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,10 +15,10 @@ import { PromiseExecutor, timeoutPromise, TimeoutWithError } from "./timeoutUtil
|
|
|
15
15
|
* - failOnContainerClose = true
|
|
16
16
|
* - timeoutOptions.durationMs = 1s
|
|
17
17
|
*/
|
|
18
|
-
export async function ensureContainerConnected(container:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export async function ensureContainerConnected(container: IContainer): Promise<void> {
|
|
19
|
+
if (container.connectionState !== ConnectionState.Connected) {
|
|
20
|
+
return timeoutPromise((resolve) => container.once("connected", () => resolve()));
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -42,18 +42,20 @@ export async function ensureContainerConnected(container: Container): Promise<vo
|
|
|
42
42
|
* timeoutOptions.durationMs (which defaults to 250ms if left undefined).
|
|
43
43
|
*/
|
|
44
44
|
export async function waitForContainerConnection(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
container: IContainer,
|
|
46
|
+
failOnContainerClose: boolean = false,
|
|
47
|
+
timeoutOptions?: TimeoutWithError,
|
|
48
|
+
): Promise<void> {
|
|
49
|
+
if (container.connectionState !== ConnectionState.Connected) {
|
|
50
|
+
const executor: PromiseExecutor = (resolve, reject) => {
|
|
51
|
+
container.once("connected", () => resolve());
|
|
52
|
+
if (failOnContainerClose) {
|
|
53
|
+
container.once("closed", (error) => reject(error));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return timeoutOptions === undefined ? new Promise(executor) : timeoutPromise(executor, timeoutOptions);
|
|
58
|
-
}
|
|
57
|
+
return timeoutOptions === undefined
|
|
58
|
+
? new Promise(executor)
|
|
59
|
+
: timeoutPromise(executor, timeoutOptions);
|
|
60
|
+
}
|
|
59
61
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,39 +3,38 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
wrapDocumentService,
|
|
8
|
+
wrapDocumentServiceFactory,
|
|
9
|
+
wrapDocumentStorageService,
|
|
10
|
+
} from "./DriverWrappers";
|
|
7
11
|
export { IProvideTestFluidObject, ITestFluidObject } from "./interfaces";
|
|
8
12
|
export { LoaderContainerTracker } from "./loaderContainerTracker";
|
|
9
13
|
export { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from "./localCodeLoader";
|
|
10
14
|
export { createAndAttachContainer, createLoader } from "./localLoader";
|
|
11
15
|
export { retryWithEventualValue } from "./retry";
|
|
12
16
|
export { mockConfigProvider } from "./TestConfigs";
|
|
13
|
-
export {
|
|
17
|
+
export {
|
|
18
|
+
createTestContainerRuntimeFactory,
|
|
19
|
+
TestContainerRuntimeFactory,
|
|
20
|
+
} from "./testContainerRuntimeFactory";
|
|
14
21
|
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from "./testFluidObject";
|
|
15
22
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
createDocumentId,
|
|
24
|
+
DataObjectFactoryType,
|
|
25
|
+
EventAndErrorTrackingLogger,
|
|
26
|
+
getUnexpectedLogErrorException,
|
|
27
|
+
IOpProcessingController,
|
|
28
|
+
ITestContainerConfig,
|
|
29
|
+
ITestObjectProvider,
|
|
30
|
+
TestObjectProvider,
|
|
24
31
|
} from "./testObjectProvider";
|
|
32
|
+
export { createSummarizer, createSummarizerFromFactory, summarizeNow } from "./TestSummaryUtils";
|
|
25
33
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
defaultTimeoutDurationMs,
|
|
33
|
-
timeoutAwait,
|
|
34
|
-
timeoutPromise,
|
|
35
|
-
TimeoutWithError,
|
|
36
|
-
TimeoutWithValue,
|
|
34
|
+
defaultTimeoutDurationMs,
|
|
35
|
+
timeoutAwait,
|
|
36
|
+
timeoutPromise,
|
|
37
|
+
TimeoutWithError,
|
|
38
|
+
TimeoutWithValue,
|
|
37
39
|
} from "./timeoutUtils";
|
|
38
|
-
export {
|
|
39
|
-
ensureContainerConnected,
|
|
40
|
-
waitForContainerConnection,
|
|
41
|
-
} from "./containerUtils";
|
|
40
|
+
export { ensureContainerConnected, waitForContainerConnection } from "./containerUtils";
|
package/src/interfaces.ts
CHANGED
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
7
7
|
import { ISharedMap } from "@fluidframework/map";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
IFluidDataStoreContext,
|
|
10
|
+
IFluidDataStoreChannel,
|
|
11
|
+
} from "@fluidframework/runtime-definitions";
|
|
9
12
|
import { IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
10
13
|
|
|
11
14
|
export interface IProvideTestFluidObject {
|
|
12
|
-
|
|
15
|
+
readonly ITestFluidObject: ITestFluidObject;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
root: ISharedMap;
|
|
20
|
+
readonly runtime: IFluidDataStoreRuntime;
|
|
21
|
+
readonly channel: IFluidDataStoreChannel;
|
|
22
|
+
readonly context: IFluidDataStoreContext;
|
|
23
|
+
getSharedObject<T = any>(id: string): Promise<T>;
|
|
21
24
|
}
|