@fluidframework/test-utils 2.0.0-internal.5.4.0 → 2.0.0-internal.6.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/test-utils",
3
- "version": "2.0.0-internal.5.4.0",
3
+ "version": "2.0.0-internal.6.1.0",
4
4
  "description": "Utilities for Fluid tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -35,38 +35,38 @@
35
35
  "temp-directory": "nyc/.nyc_output"
36
36
  },
37
37
  "dependencies": {
38
- "@fluidframework/aqueduct": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
38
+ "@fluidframework/aqueduct": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
39
39
  "@fluidframework/common-utils": "^1.1.1",
40
- "@fluidframework/container-definitions": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
41
- "@fluidframework/container-loader": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
42
- "@fluidframework/container-runtime": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
43
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
44
- "@fluidframework/core-interfaces": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
45
- "@fluidframework/datastore": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
46
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
47
- "@fluidframework/driver-definitions": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
48
- "@fluidframework/driver-utils": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
49
- "@fluidframework/local-driver": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
50
- "@fluidframework/map": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
40
+ "@fluidframework/container-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
41
+ "@fluidframework/container-loader": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
42
+ "@fluidframework/container-runtime": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
43
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
44
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
45
+ "@fluidframework/datastore": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
46
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
47
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
48
+ "@fluidframework/driver-utils": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
49
+ "@fluidframework/local-driver": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
50
+ "@fluidframework/map": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
51
51
  "@fluidframework/protocol-definitions": "^1.1.0",
52
- "@fluidframework/request-handler": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
53
- "@fluidframework/routerlicious-driver": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
54
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
55
- "@fluidframework/runtime-utils": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
56
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
57
- "@fluidframework/test-driver-definitions": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
58
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
52
+ "@fluidframework/request-handler": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
53
+ "@fluidframework/routerlicious-driver": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
54
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
55
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
56
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
57
+ "@fluidframework/test-driver-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
58
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
59
59
  "best-random": "^1.0.0",
60
60
  "debug": "^4.1.1",
61
61
  "uuid": "^8.3.1"
62
62
  },
63
63
  "devDependencies": {
64
- "@fluid-tools/build-cli": "^0.21.0",
65
- "@fluidframework/build-common": "^1.2.0",
66
- "@fluidframework/build-tools": "^0.21.0",
64
+ "@fluid-tools/build-cli": "^0.22.0",
65
+ "@fluidframework/build-common": "^2.0.0",
66
+ "@fluidframework/build-tools": "^0.22.0",
67
67
  "@fluidframework/eslint-config-fluid": "^2.0.0",
68
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.5.4.0 <2.0.0-internal.5.5.0",
69
- "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.0.0-internal.5.2.0",
68
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
69
+ "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.0.0-internal.6.0.0",
70
70
  "@microsoft/api-extractor": "^7.34.4",
71
71
  "@types/debug": "^4.1.5",
72
72
  "@types/diff": "^3.5.1",
@@ -90,12 +90,7 @@
90
90
  "typescript": "~4.5.5"
91
91
  },
92
92
  "typeValidation": {
93
- "broken": {
94
- "RemovedFunctionDeclaration_createSummarizerWithTestConfig": {
95
- "forwardCompat": false,
96
- "backCompat": false
97
- }
98
- }
93
+ "broken": {}
99
94
  },
100
95
  "scripts": {
101
96
  "build": "fluid-build . --task build",
@@ -66,7 +66,7 @@ async function createSummarizerCore(
66
66
  const defaultSummaryOptions: ISummaryRuntimeOptions = {
67
67
  summaryConfigOverrides: {
68
68
  state: "disableHeuristics",
69
- maxAckWaitTime: 10000,
69
+ maxAckWaitTime: 20000, // Some of the AFR tests take a long time to ack.
70
70
  maxOpsSinceLastSummary: 7000,
71
71
  initialSummarizerDelayMs: 0,
72
72
  },
@@ -142,7 +142,9 @@ export async function summarizeNow(summarizer: ISummarizer, reason: string = "en
142
142
 
143
143
  const submitResult = await timeoutAwait(result.summarySubmitted);
144
144
  if (!submitResult.success) {
145
- submitResult.error.data = submitResult.data;
145
+ if (typeof submitResult.error !== "string") {
146
+ submitResult.error.data = submitResult.data;
147
+ }
146
148
  throw submitResult.error;
147
149
  }
148
150
  assert(
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/test-utils";
9
- export const pkgVersion = "2.0.0-internal.5.4.0";
9
+ export const pkgVersion = "2.0.0-internal.6.1.0";
@@ -52,7 +52,8 @@ export const createTestContainerRuntimeFactory = (
52
52
  public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {
53
53
  // Validate we can load root data stores.
54
54
  // We should be able to load any data store that was created in initializeFirstTime!
55
- await runtime.getRootDataStore("default");
55
+ await (runtime.getAliasedDataStoreEntryPoint?.("default") ??
56
+ runtime.getRootDataStore("default"));
56
57
  }
57
58
 
58
59
  async preInitialize(
@@ -8,7 +8,6 @@ import {
8
8
  IRequest,
9
9
  IResponse,
10
10
  IFluidHandle,
11
- IFluidRouter,
12
11
  FluidObject,
13
12
  IProvideFluidRouter,
14
13
  } from "@fluidframework/core-interfaces";
@@ -32,20 +31,7 @@ import { ITestFluidObject } from "./interfaces";
32
31
  * The shared objects can be retrieved by passing the key of the entry to getSharedObject.
33
32
  * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
34
33
  */
35
- export class TestFluidObject implements ITestFluidObject, IFluidRouter {
36
- public static async load(
37
- runtime: IFluidDataStoreRuntime,
38
- channel: IFluidDataStoreChannel,
39
- context: IFluidDataStoreContext,
40
- factoryEntries: Map<string, IChannelFactory>,
41
- existing: boolean,
42
- ) {
43
- const fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);
44
- await fluidObject.initialize(existing);
45
-
46
- return fluidObject;
47
- }
48
-
34
+ export class TestFluidObject implements ITestFluidObject {
49
35
  public get ITestFluidObject() {
50
36
  return this;
51
37
  }
@@ -54,6 +40,9 @@ export class TestFluidObject implements ITestFluidObject, IFluidRouter {
54
40
  return this;
55
41
  }
56
42
 
43
+ /**
44
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
45
+ */
57
46
  public get IFluidRouter() {
58
47
  return this;
59
48
  }
@@ -64,6 +53,7 @@ export class TestFluidObject implements ITestFluidObject, IFluidRouter {
64
53
 
65
54
  public root!: ISharedMap;
66
55
  private readonly innerHandle: IFluidHandle<this>;
56
+ private initializeP: Promise<void> | undefined;
67
57
 
68
58
  /**
69
59
  * Creates a new TestFluidObject.
@@ -100,23 +90,39 @@ export class TestFluidObject implements ITestFluidObject, IFluidRouter {
100
90
  throw new Error(`Shared object with id ${id} not found.`);
101
91
  }
102
92
 
93
+ /**
94
+ * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
95
+ */
103
96
  public async request(request: IRequest): Promise<IResponse> {
104
97
  return defaultFluidObjectRequestHandler(this, request);
105
98
  }
106
99
 
107
- private async initialize(existing: boolean) {
108
- if (!existing) {
109
- this.root = SharedMap.create(this.runtime, "root");
100
+ public async initialize(existing: boolean) {
101
+ const doInitialization = async () => {
102
+ if (!existing) {
103
+ this.root = SharedMap.create(this.runtime, "root");
104
+
105
+ this.factoryEntriesMap.forEach(
106
+ (sharedObjectFactory: IChannelFactory, key: string) => {
107
+ const sharedObject = this.runtime.createChannel(
108
+ key,
109
+ sharedObjectFactory.type,
110
+ );
111
+ this.root.set(key, sharedObject.handle);
112
+ },
113
+ );
110
114
 
111
- this.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {
112
- const sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);
113
- this.root.set(key, sharedObject.handle);
114
- });
115
+ this.root.bindToContext();
116
+ }
115
117
 
116
- this.root.bindToContext();
118
+ this.root = (await this.runtime.getChannel("root")) as ISharedMap;
119
+ };
120
+
121
+ if (this.initializeP === undefined) {
122
+ this.initializeP = doInitialization();
117
123
  }
118
124
 
119
- this.root = (await this.runtime.getChannel("root")) as ISharedMap;
125
+ return this.initializeP;
120
126
  }
121
127
  }
122
128
 
@@ -178,18 +184,16 @@ export class TestFluidObjectFactory implements IFluidDataStoreFactory {
178
184
  dataTypes.set(sharedMapFactory.type, sharedMapFactory);
179
185
 
180
186
  // Add the object factories to the list to be sent to data store runtime.
181
- for (const entry of this.factoryEntries) {
182
- const factory = entry[1];
187
+ for (const [, factory] of this.factoryEntries) {
183
188
  dataTypes.set(factory.type, factory);
184
189
  }
185
190
 
186
191
  // Create a map from the factory entries with entries that don't have the id as undefined. This will be
187
192
  // passed to the Fluid object.
188
193
  const factoryEntriesMapForObject = new Map<string, IChannelFactory>();
189
- for (const entry of this.factoryEntries) {
190
- const id = entry[0];
194
+ for (const [id, factory] of this.factoryEntries) {
191
195
  if (id !== undefined) {
192
- factoryEntriesMapForObject.set(id, entry[1]);
196
+ factoryEntriesMapForObject.set(id, factory);
193
197
  }
194
198
  }
195
199
 
@@ -205,20 +209,22 @@ export class TestFluidObjectFactory implements IFluidDataStoreFactory {
205
209
  },
206
210
  );
207
211
 
208
- return new runtimeClass(
212
+ const runtime = new runtimeClass(context, dataTypes, existing, async () => {
213
+ await instance.initialize(true);
214
+ return instance;
215
+ });
216
+
217
+ const instance: TestFluidObject = new TestFluidObject(
218
+ runtime, // runtime
219
+ runtime, // channel
209
220
  context,
210
- dataTypes,
211
- existing,
212
- async (dataStoreRuntime: IFluidDataStoreRuntime) =>
213
- TestFluidObject.load(
214
- dataStoreRuntime,
215
- // This works because 'runtime' is an instance of runtimeClass (which is a FluidDataStoreRuntime and
216
- // thus implements IFluidDataStoreChannel) which passes itself as the parameter to this function.
217
- dataStoreRuntime as FluidDataStoreRuntime,
218
- context,
219
- factoryEntriesMapForObject,
220
- existing,
221
- ),
221
+ factoryEntriesMapForObject,
222
222
  );
223
+
224
+ if (!existing) {
225
+ await instance.initialize(false);
226
+ }
227
+
228
+ return runtime;
223
229
  }
224
230
  }
@@ -29,11 +29,7 @@ import {
29
29
  } from "@fluidframework/driver-definitions";
30
30
  import { ITestDriver, TestDriverTypes } from "@fluidframework/test-driver-definitions";
31
31
  import { v4 as uuid } from "uuid";
32
- import {
33
- createChildLogger,
34
- createMultiSinkLogger,
35
- TelemetryLogger,
36
- } from "@fluidframework/telemetry-utils";
32
+ import { createChildLogger, createMultiSinkLogger } from "@fluidframework/telemetry-utils";
37
33
  import { LoaderContainerTracker } from "./loaderContainerTracker";
38
34
  import { fluidEntryPoint, LocalCodeLoader } from "./localCodeLoader";
39
35
  import { createAndAttachContainer } from "./localLoader";
@@ -164,7 +160,7 @@ function getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {
164
160
  * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
165
161
  * any expected events that have not occurred.
166
162
  */
167
- export class EventAndErrorTrackingLogger extends TelemetryLogger {
163
+ export class EventAndErrorTrackingLogger implements ITelemetryBaseLogger {
168
164
  /**
169
165
  * Even if these error events are logged, tests should still be allowed to pass
170
166
  * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
@@ -179,9 +175,7 @@ export class EventAndErrorTrackingLogger extends TelemetryLogger {
179
175
  { eventName: "fluid:telemetry:OpPerf:OpRoundtripTime" },
180
176
  ];
181
177
 
182
- constructor(private readonly baseLogger: ITelemetryBaseLogger) {
183
- super();
184
- }
178
+ constructor(private readonly baseLogger: ITelemetryBaseLogger) {}
185
179
 
186
180
  private readonly expectedEvents: (
187
181
  | { index: number; event: ITelemetryGenericEvent | undefined }