@fluidframework/test-utils 2.0.0-internal.6.4.0 → 2.0.0-internal.7.0.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/TestSummaryUtils.d.ts.map +1 -1
  3. package/dist/TestSummaryUtils.js +10 -7
  4. package/dist/TestSummaryUtils.js.map +1 -1
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +3 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/localCodeLoader.d.ts +2 -2
  10. package/dist/localCodeLoader.d.ts.map +1 -1
  11. package/dist/localCodeLoader.js +8 -1
  12. package/dist/localCodeLoader.js.map +1 -1
  13. package/dist/packageVersion.d.ts +1 -1
  14. package/dist/packageVersion.js +1 -1
  15. package/dist/packageVersion.js.map +1 -1
  16. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  17. package/dist/testContainerRuntimeFactory.js +8 -3
  18. package/dist/testContainerRuntimeFactory.js.map +1 -1
  19. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +22 -0
  20. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
  21. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +24 -0
  22. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -0
  23. package/dist/testFluidObject.d.ts +1 -1
  24. package/dist/testFluidObject.d.ts.map +1 -1
  25. package/dist/testFluidObject.js +21 -19
  26. package/dist/testFluidObject.js.map +1 -1
  27. package/dist/testObjectProvider.d.ts +0 -2
  28. package/dist/testObjectProvider.d.ts.map +1 -1
  29. package/dist/testObjectProvider.js +4 -29
  30. package/dist/testObjectProvider.js.map +1 -1
  31. package/dist/timeoutUtils.d.ts +1 -1
  32. package/dist/timeoutUtils.d.ts.map +1 -1
  33. package/dist/timeoutUtils.js +7 -7
  34. package/dist/timeoutUtils.js.map +1 -1
  35. package/dist/tsdoc-metadata.json +1 -1
  36. package/package.json +27 -27
  37. package/src/TestSummaryUtils.ts +13 -12
  38. package/src/index.ts +1 -0
  39. package/src/localCodeLoader.ts +6 -5
  40. package/src/packageVersion.ts +1 -1
  41. package/src/testContainerRuntimeFactory.ts +5 -2
  42. package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +50 -0
  43. package/src/testFluidObject.ts +4 -3
  44. package/src/testObjectProvider.ts +3 -41
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAA4E;AAQ5E,yDAImC;AACnC,6CAA4D;AAO5D,2DAAoD;AAGpD;;;;GAIG;AACH,MAAa,eAAe;IAwB3B;;;;;;OAMG;IACH,YACiB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,iBAA+C;QAHhD,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAEhE,IAAI,CAAC,WAAW,GAAG,IAAI,6BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,CAAC;IArCD,IAAW,gBAAgB;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAsBD;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAU,EAAU;QAC/C,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACrE;QAED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,gDAAgD,CAChD,CAAC;YACF,OAAO,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC,CACD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAoB,IAAI,eAAe,CACpD,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE;YACd,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAtED,wDAsEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport {\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tFluidObject,\n\tIProvideFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidObjectHandle,\n\tFluidDataStoreRuntime,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ITestFluidObject } from \"./interfaces\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n */\nexport class TestFluidObject implements ITestFluidObject {\n\tpublic get ITestFluidObject() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get handle(): IFluidHandle<this> {\n\t\treturn this.innerHandle;\n\t}\n\n\tpublic root!: ISharedMap;\n\tprivate readonly innerHandle: IFluidHandle<this>;\n\tprivate initializeP: Promise<void> | undefined;\n\n\t/**\n\t * Creates a new TestFluidObject.\n\t * @param runtime - The data store runtime.\n\t * @param context - The data store context.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n\t * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n\t */\n\tconstructor(\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly channel: IFluidDataStoreChannel,\n\t\tpublic readonly context: IFluidDataStoreContext,\n\t\tprivate readonly factoryEntriesMap: Map<string, IChannelFactory>,\n\t) {\n\t\tthis.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getSharedObject<T = any>(id: string): Promise<T> {\n\t\tif (this.factoryEntriesMap === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tfor (const key of this.factoryEntriesMap.keys()) {\n\t\t\tif (key === id) {\n\t\t\t\tconst handle = this.root.get<IFluidHandle>(id);\n\t\t\t\treturn handle?.get() as unknown as T;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Shared object with id ${id} not found.`);\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn defaultFluidObjectRequestHandler(this, request);\n\t}\n\n\tpublic async initialize(existing: boolean) {\n\t\tconst doInitialization = async () => {\n\t\t\tif (!existing) {\n\t\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\t\tthis.factoryEntriesMap.forEach(\n\t\t\t\t\t(sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\t\tconst sharedObject = this.runtime.createChannel(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tsharedObjectFactory.type,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tthis.root.bindToContext();\n\t\t\t}\n\n\t\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t\t};\n\n\t\tif (this.initializeP === undefined) {\n\t\t\tthis.initializeP = doInitialization();\n\t\t}\n\n\t\treturn this.initializeP;\n\t}\n}\n\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n *\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n *\n * @privateRemarks Beware that using this class generally forfeits some compatibility coverage\n * `describeCompat` aims to provide:\n * `SharedMap`s always reference the current version of SharedMap.\n * AB#4670 tracks improving this situation.\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a new TestFluidObjectFactory.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n\t * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n\t * for it.\n\t */\n\tconstructor(\n\t\tprivate readonly factoryEntries: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\tconst dataTypes = new Map<string, IChannelFactory>();\n\n\t\t// Add SharedMap's factory which will be used to create the root map.\n\t\tconst sharedMapFactory = SharedMap.getFactory();\n\t\tdataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n\t\t// Add the object factories to the list to be sent to data store runtime.\n\t\tfor (const [, factory] of this.factoryEntries) {\n\t\t\tdataTypes.set(factory.type, factory);\n\t\t}\n\n\t\t// Create a map from the factory entries with entries that don't have the id as undefined. This will be\n\t\t// passed to the Fluid object.\n\t\tconst factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n\t\tfor (const [id, factory] of this.factoryEntries) {\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, factory);\n\t\t\t}\n\t\t}\n\n\t\tconst runtimeClass = mixinRequestHandler(\n\t\t\tasync (request: IRequest, rt: FluidDataStoreRuntime) => {\n\t\t\t\tconst maybeRouter: FluidObject<IProvideFluidRouter> | undefined =\n\t\t\t\t\tawait rt.entryPoint?.get();\n\t\t\t\tassert(\n\t\t\t\t\tmaybeRouter?.IFluidRouter !== undefined,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn maybeRouter.IFluidRouter.request(request);\n\t\t\t},\n\t\t);\n\n\t\tconst runtime = new runtimeClass(context, dataTypes, existing, async () => {\n\t\t\tawait instance.initialize(true);\n\t\t\treturn instance;\n\t\t});\n\n\t\tconst instance: TestFluidObject = new TestFluidObject(\n\t\t\truntime, // runtime\n\t\t\truntime, // channel\n\t\t\tcontext,\n\t\t\tfactoryEntriesMapForObject,\n\t\t);\n\n\t\tif (!existing) {\n\t\t\tawait instance.initialize(false);\n\t\t}\n\n\t\treturn runtime;\n\t}\n}\n"]}
1
+ {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gDAAgD;AAChD,uDAA4E;AAQ5E,yDAImC;AACnC,6CAA4D;AAO5D,2DAAoD;AAGpD;;;;GAIG;AACH,MAAa,eAAe;IAC3B,IAAW,gBAAgB;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAMD;;;;;;OAMG;IACH,YACiB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,iBAA+C;QAHhD,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAEhE,IAAI,CAAC,WAAW,GAAG,IAAI,6BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAU,EAAU;QAC/C,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;YAC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AE,CAAC;YAChF,IAAA,mBAAM,EACL,WAAW,CAAC,YAAY,KAAK,SAAS,EACtC,gDAAgD,CAChD,CAAC;YACF,OAAO,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC,CACD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAoB,IAAI,eAAe,CACpD,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE;YACd,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AArED,wDAqEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-deprecated\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport {\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tFluidObject,\n\tIProvideFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidObjectHandle,\n\tFluidDataStoreRuntime,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ITestFluidObject } from \"./interfaces\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n */\nexport class TestFluidObject implements ITestFluidObject {\n\tpublic get ITestFluidObject() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\tpublic get handle(): IFluidHandle<this> {\n\t\treturn this.innerHandle;\n\t}\n\n\tpublic root!: ISharedMap;\n\tprivate readonly innerHandle: IFluidHandle<this>;\n\tprivate initializeP: Promise<void> | undefined;\n\n\t/**\n\t * Creates a new TestFluidObject.\n\t * @param runtime - The data store runtime.\n\t * @param context - The data store context.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n\t * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n\t */\n\tconstructor(\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly channel: IFluidDataStoreChannel,\n\t\tpublic readonly context: IFluidDataStoreContext,\n\t\tprivate readonly factoryEntriesMap: Map<string, IChannelFactory>,\n\t) {\n\t\tthis.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getSharedObject<T = any>(id: string): Promise<T> {\n\t\tif (this.factoryEntriesMap === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tfor (const key of this.factoryEntriesMap.keys()) {\n\t\t\tif (key === id) {\n\t\t\t\tconst handle = this.root.get<IFluidHandle>(id);\n\t\t\t\treturn handle?.get() as unknown as T;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Shared object with id ${id} not found.`);\n\t}\n\n\t/**\n\t * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\treturn defaultFluidObjectRequestHandler(this, request);\n\t}\n\n\tpublic async initialize(existing: boolean) {\n\t\tconst doInitialization = async () => {\n\t\t\tif (!existing) {\n\t\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\t\tthis.factoryEntriesMap.forEach(\n\t\t\t\t\t(sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\t\tconst sharedObject = this.runtime.createChannel(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tsharedObjectFactory.type,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tthis.root.bindToContext();\n\t\t\t}\n\n\t\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t\t};\n\n\t\tif (this.initializeP === undefined) {\n\t\t\tthis.initializeP = doInitialization();\n\t\t}\n\n\t\treturn this.initializeP;\n\t}\n}\n\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n *\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n *\n * @privateRemarks Beware that using this class generally forfeits some compatibility coverage\n * `describeCompat` aims to provide:\n * `SharedMap`s always reference the current version of SharedMap.\n * AB#4670 tracks improving this situation.\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a new TestFluidObjectFactory.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n\t * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n\t * for it.\n\t */\n\tconstructor(\n\t\tprivate readonly factoryEntries: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\tconst dataTypes = new Map<string, IChannelFactory>();\n\n\t\t// Add SharedMap's factory which will be used to create the root map.\n\t\tconst sharedMapFactory = SharedMap.getFactory();\n\t\tdataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n\t\t// Add the object factories to the list to be sent to data store runtime.\n\t\tfor (const [, factory] of this.factoryEntries) {\n\t\t\tdataTypes.set(factory.type, factory);\n\t\t}\n\n\t\t// Create a map from the factory entries with entries that don't have the id as undefined. This will be\n\t\t// passed to the Fluid object.\n\t\tconst factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n\t\tfor (const [id, factory] of this.factoryEntries) {\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, factory);\n\t\t\t}\n\t\t}\n\n\t\tconst runtimeClass = mixinRequestHandler(\n\t\t\tasync (request: IRequest, rt: FluidDataStoreRuntime) => {\n\t\t\t\tconst maybeRouter: FluidObject<IProvideFluidRouter> = await rt.entryPoint.get();\n\t\t\t\tassert(\n\t\t\t\t\tmaybeRouter.IFluidRouter !== undefined,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn maybeRouter.IFluidRouter.request(request);\n\t\t\t},\n\t\t);\n\n\t\tconst runtime = new runtimeClass(context, dataTypes, existing, async () => {\n\t\t\tawait instance.initialize(true);\n\t\t\treturn instance;\n\t\t});\n\n\t\tconst instance: TestFluidObject = new TestFluidObject(\n\t\t\truntime, // runtime\n\t\t\truntime, // channel\n\t\t\tcontext,\n\t\t\tfactoryEntriesMapForObject,\n\t\t);\n\n\t\tif (!existing) {\n\t\t\tawait instance.initialize(false);\n\t\t}\n\n\t\treturn runtime;\n\t}\n}\n"]}
@@ -58,8 +58,6 @@ export interface ITestContainerConfig {
58
58
  enableAttribution?: boolean;
59
59
  /** Loader options for the loader used to create containers */
60
60
  loaderProps?: Partial<ILoaderProps>;
61
- /** Temporary flag: simulate read connection using delay connection, default is true */
62
- simulateReadConnectionUsingDelay?: boolean;
63
61
  }
64
62
  export declare const createDocumentId: () => string;
65
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,WAAW,EACX,iBAAiB,EAGjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,YAAY,EACZ,MAAM,EAEN,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AAIvF,OAAO,EAAE,eAAe,EAAmB,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hE;;;;OAIG;IACU,iBAAiB,CAC7B,mBAAmB,CAAC,EAAE,oBAAoB,GACxC,OAAO,CAAC,UAAU,CAAC;IAmBtB;;;;;OAKG;IACU,iBAAiB,CAC7B,mBAAmB,CAAC,EAAE,oBAAoB,EAC1C,aAAa,CAAC,EAAE,cAAc,GAC5B,OAAO,CAAC,UAAU,CAAC;IASf,KAAK;IAaC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC,sBAAsB,CAAC,SAAS,EAAE,UAAU;IAYzD,gBAAgB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS;IAI/C,2BAA2B,CAAC,qBAAqB,GAAE,OAAe;CAIzE;AAED,wBAAgB,8BAA8B,CAC7C,MAAM,EAAE,2BAA2B,GAAG,SAAS,EAC/C,MAAM,CAAC,EAAE,MAAM,qBAwBf"}
@@ -5,7 +5,6 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.getUnexpectedLogErrorException = exports.TestObjectProvider = exports.EventAndErrorTrackingLogger = exports.createDocumentId = exports.DataObjectFactoryType = void 0;
8
- const container_definitions_1 = require("@fluidframework/container-definitions");
9
8
  const container_loader_1 = require("@fluidframework/container-loader");
10
9
  const uuid_1 = require("uuid");
11
10
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
@@ -20,7 +19,7 @@ var DataObjectFactoryType;
20
19
  (function (DataObjectFactoryType) {
21
20
  DataObjectFactoryType[DataObjectFactoryType["Primed"] = 0] = "Primed";
22
21
  DataObjectFactoryType[DataObjectFactoryType["Test"] = 1] = "Test";
23
- })(DataObjectFactoryType = exports.DataObjectFactoryType || (exports.DataObjectFactoryType = {}));
22
+ })(DataObjectFactoryType || (exports.DataObjectFactoryType = DataObjectFactoryType = {}));
24
23
  const createDocumentId = () => (0, uuid_1.v4)();
25
24
  exports.createDocumentId = createDocumentId;
26
25
  /**
@@ -234,35 +233,11 @@ class TestObjectProvider {
234
233
  const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);
235
234
  return this.resolveContainer(loader, requestHeader);
236
235
  }
237
- async resolveContainer(loader, requestHeader, delay = true) {
238
- // Once AB#3889 is done to switch default connection mode to "read" on load, we don't need
239
- // to load "delayed" across the board. Remove the following code.
240
- const delayConnection = delay &&
241
- (requestHeader === undefined || requestHeader[container_definitions_1.LoaderHeader.reconnect] !== false);
242
- const headers = delayConnection
243
- ? {
244
- [container_definitions_1.LoaderHeader.loadMode]: { deltaConnection: "delayed" },
245
- ...requestHeader,
246
- }
247
- : requestHeader;
248
- const container = await loader.resolve({
236
+ async resolveContainer(loader, headers) {
237
+ return loader.resolve({
249
238
  url: await this.driver.createContainerUrl(this.documentId),
250
239
  headers,
251
240
  });
252
- // Once AB#3889 is done to switch default connection mode to "read" on load, we don't need
253
- // to load "delayed" across the board. Remove the following code.
254
- if (delayConnection) {
255
- // Older version may not have connect/disconnect. It was add in PR#9439, and available >= 0.59.1000
256
- const maybeContainer = container;
257
- if (maybeContainer.connect !== undefined) {
258
- container.connect();
259
- }
260
- else {
261
- // back compat. Remove when we don't support < 0.59.1000
262
- container.resume();
263
- }
264
- }
265
- return container;
266
241
  }
267
242
  /**
268
243
  * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.
@@ -297,7 +272,7 @@ class TestObjectProvider {
297
272
  */
298
273
  async loadTestContainer(testContainerConfig, requestHeader) {
299
274
  const loader = this.makeTestLoader(testContainerConfig);
300
- const container = await this.resolveContainer(loader, requestHeader, testContainerConfig?.simulateReadConnectionUsingDelay);
275
+ const container = await this.resolveContainer(loader, requestHeader);
301
276
  await this.waitContainerToCatchUp(container);
302
277
  return container;
303
278
  }
@@ -1 +1 @@
1
- {"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAM+C;AAC/C,uEAI0C;AAc1C,+BAAkC;AAClC,qEAA2F;AAC3F,qEAAkE;AAClE,uDAAqE;AACrE,+CAA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AAgB,EACxB,SAAS,EACT,CAAC,CACD,EAAE,CACH,CAAC;KACF;AACF,CAAC;AA1BD,wEA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIHostLoader,\n\tIFluidCodeDetails,\n\tLoaderHeader,\n\tILoader,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tILoaderProps,\n\tLoader,\n\twaitContainerToCatchUp as waitContainerToCatchUp_original,\n} from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport {\n\tITelemetryGenericEvent,\n\tITelemetryBaseLogger,\n\tITelemetryBaseEvent,\n\tIRequestHeader,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { createChildLogger, createMultiSinkLogger } 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\tpackage: \"defaultTestPackage\",\n\tconfig: {},\n};\n\nexport interface IOpProcessingController {\n\tprocessIncoming(...containers: IContainer[]): Promise<void>;\n\tprocessOutgoing(...containers: IContainer[]): Promise<void>;\n\tpauseProcessing(...containers: IContainer[]): Promise<void>;\n\tresumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n\tcreateFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n\tcreateLoader(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t): IHostLoader;\n\tcreateContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t): Promise<IContainer>;\n\tloadContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer>;\n\n\t/**\n\t * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n\t * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n\t */\n\tmakeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n\tmakeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n\tloadTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer>;\n\t/**\n\t *\n\t * @param url - Resolved container URL\n\t */\n\tupdateDocumentId(url: IResolvedUrl | undefined): void;\n\n\tlogger: ITelemetryBaseLogger;\n\tdocumentServiceFactory: IDocumentServiceFactory;\n\turlResolver: IUrlResolver;\n\tdefaultCodeDetails: IFluidCodeDetails;\n\topProcessingController: IOpProcessingController;\n\n\tensureSynchronized(timeoutDuration?: number): Promise<void>;\n\treset(): void;\n\n\tdocumentId: string;\n\tdriver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n\tPrimed, // default\n\tTest,\n}\n\nexport interface ITestContainerConfig {\n\t/** TestFluidDataObject instead of PrimedDataStore */\n\tfluidDataObjectType?: DataObjectFactoryType;\n\n\t/** An array of channel name and DDS factory pair to create on container creation time */\n\tregistry?: ChannelFactoryRegistry;\n\n\t/** Container runtime options for the container instance */\n\truntimeOptions?: IContainerRuntimeOptions;\n\n\t/** Whether this runtime should be instantiated using a mixed-in attributor class */\n\tenableAttribution?: boolean;\n\n\t/** Loader options for the loader used to create containers */\n\tloaderProps?: Partial<ILoaderProps>;\n\n\t/** Temporary flag: simulate read connection using delay connection, default is true */\n\tsimulateReadConnectionUsingDelay?: boolean;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n\tget(): string;\n\tupdate(resolvedUrl?: IResolvedUrl): void;\n\treset(): 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\tlet documentId = createDocumentId();\n\tswitch (type) {\n\t\tcase \"odsp\":\n\t\t\treturn {\n\t\t\t\tget: () => documentId,\n\t\t\t\tupdate: () => {}, // do not update the document ID in odsp test cases\n\t\t\t\treset: () => {\n\t\t\t\t\tdocumentId = createDocumentId();\n\t\t\t\t},\n\t\t\t};\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tget: () => documentId,\n\t\t\t\tupdate: (resolvedUrl?: IResolvedUrl) => {\n\t\t\t\t\t// Extract the document ID from the resolved container's URL and reset the ID property\n\t\t\t\t\tdocumentId = resolvedUrl?.id ?? documentId;\n\t\t\t\t},\n\t\t\t\treset: () => {\n\t\t\t\t\tdocumentId = createDocumentId();\n\t\t\t\t},\n\t\t\t};\n\t}\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 implements ITelemetryBaseLogger {\n\t/**\n\t * Even if these error events are logged, tests should still be allowed to pass\n\t * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)\n\t */\n\tprivate readonly allowedErrors: { eventName: string; downgrade?: true }[] = [\n\t\t// This log was removed in current version as unnecessary, but it's still present in previous versions\n\t\t{\n\t\t\teventName: \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n\t\t\tdowngrade: true,\n\t\t},\n\t\t// This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.\n\t\t{ eventName: \"fluid:telemetry:OpPerf:OpRoundtripTime\" },\n\t];\n\n\tconstructor(private readonly baseLogger: ITelemetryBaseLogger) {}\n\n\tprivate readonly expectedEvents: (\n\t\t| { index: number; event: ITelemetryGenericEvent | undefined }\n\t\t| undefined\n\t)[] = [];\n\tprivate readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n\tpublic registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEvent[]) {\n\t\tif (this.expectedEvents.length !== 0) {\n\t\t\t// we don't have to error here. just no reason not to. given the events must be\n\t\t\t// ordered it could be tricky to figure out problems around multiple registrations.\n\t\t\tthrow new Error(\n\t\t\t\t\"Expected events already registered.\\n\" +\n\t\t\t\t\t\"Call reportAndClearTrackedEvents to clear them before registering more\",\n\t\t\t);\n\t\t}\n\t\tthis.expectedEvents.push(\n\t\t\t...orderedExpectedEvents.map((event, index) => ({ index, event })),\n\t\t);\n\t}\n\n\tsend(event: ITelemetryBaseEvent): void {\n\t\tconst ee = this.expectedEvents[0]?.event;\n\t\tif (ee?.eventName === event.eventName) {\n\t\t\tlet matches = true;\n\t\t\tfor (const key of Object.keys(ee)) {\n\t\t\t\tif (ee[key] !== event[key]) {\n\t\t\t\t\tmatches = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (matches) {\n\t\t\t\t// we found an expected event\n\t\t\t\t// so remove it from the list of expected events\n\t\t\t\t// and if it is an error, change it to generic\n\t\t\t\t// this helps keep our telemetry clear of\n\t\t\t\t// expected errors.\n\t\t\t\tthis.expectedEvents.shift();\n\t\t\t\tif (event.category === \"error\") {\n\t\t\t\t\tevent.category = \"generic\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (event.category === \"error\") {\n\t\t\t// Check to see if this error is allowed and if its category should be downgraded\n\t\t\tconst allowedError = this.allowedErrors.find(\n\t\t\t\t({ eventName }) => eventName === event.eventName,\n\t\t\t);\n\n\t\t\tif (allowedError === undefined) {\n\t\t\t\tthis.unexpectedErrors.push(event);\n\t\t\t} else if (allowedError.downgrade) {\n\t\t\t\tevent.category = \"generic\";\n\t\t\t}\n\t\t}\n\n\t\tthis.baseLogger.send(event);\n\t}\n\n\tpublic reportAndClearTrackedEvents() {\n\t\tconst expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n\t\tconst unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n\t\treturn {\n\t\t\texpectedNotFound,\n\t\t\tunexpectedErrors,\n\t\t};\n\t}\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\tprivate _loaderContainerTracker = new LoaderContainerTracker();\n\tprivate _documentServiceFactory: IDocumentServiceFactory | undefined;\n\tprivate _urlResolver: IUrlResolver | undefined;\n\tprivate _logger: EventAndErrorTrackingLogger | undefined;\n\tprivate readonly _documentIdStrategy: IDocumentIdStrategy;\n\t// Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n\tprivate _documentCreated = false;\n\n\t/**\n\t * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n\t * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n\t * and factory for TestFluidObject\n\t */\n\tconstructor(\n\t\tpublic readonly LoaderConstructor: typeof Loader,\n\t\tpublic readonly driver: ITestDriver,\n\t\tpublic readonly createFluidEntryPoint: (\n\t\t\ttestContainerConfig?: ITestContainerConfig,\n\t\t) => fluidEntryPoint,\n\t) {\n\t\tthis._documentIdStrategy = getDocumentIdStrategy(driver.type);\n\t}\n\n\tget logger(): EventAndErrorTrackingLogger {\n\t\tif (this._logger === undefined) {\n\t\t\tthis._logger = new EventAndErrorTrackingLogger(\n\t\t\t\tcreateChildLogger({\n\t\t\t\t\tlogger: getTestLogger?.(),\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tall: {\n\t\t\t\t\t\t\tdriverType: this.driver.type,\n\t\t\t\t\t\t\tdriverEndpointName: this.driver.endpointName,\n\t\t\t\t\t\t\tdriverTenantName: this.driver.tenantName,\n\t\t\t\t\t\t\tdriverUserIndex: this.driver.userIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn this._logger;\n\t}\n\n\tset logger(logger: EventAndErrorTrackingLogger) {\n\t\tthis._logger = logger;\n\t}\n\n\tget documentServiceFactory() {\n\t\tif (!this._documentServiceFactory) {\n\t\t\tthis._documentServiceFactory = this.driver.createDocumentServiceFactory();\n\t\t}\n\t\treturn this._documentServiceFactory;\n\t}\n\n\tget urlResolver() {\n\t\tif (!this._urlResolver) {\n\t\t\tthis._urlResolver = this.driver.createUrlResolver();\n\t\t}\n\t\treturn this._urlResolver;\n\t}\n\n\tget documentId() {\n\t\treturn this._documentIdStrategy.get();\n\t}\n\n\tget defaultCodeDetails() {\n\t\treturn defaultCodeDetails;\n\t}\n\n\tget opProcessingController(): IOpProcessingController {\n\t\treturn this._loaderContainerTracker;\n\t}\n\n\t/**\n\t * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n\t *\n\t * Only the version of the loader will vary based on compat config. The version of\n\t * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n\t *\n\t * @param packageEntries - list of code details and fluidEntryPoint pairs.\n\t */\n\tpublic createLoader(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t) {\n\t\tconst logger = createMultiSinkLogger({\n\t\t\tloggers: [this.logger, loaderProps?.logger],\n\t\t});\n\n\t\tconst loader = new this.LoaderConstructor({\n\t\t\t...loaderProps,\n\t\t\tlogger,\n\t\t\tcodeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n\t\t\turlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n\t\t\tdocumentServiceFactory:\n\t\t\t\tloaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n\t\t});\n\t\tthis._loaderContainerTracker.add(loader);\n\t\treturn loader;\n\t}\n\n\t/**\n\t * Create a container using a default document id and code details.\n\t * Container created is automatically added to the OpProcessingController to manage op flow\n\t *\n\t * Only the version of the loader will vary based on compat config. The version of\n\t * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n\t *\n\t * @param packageEntries - list of code details and fluidEntryPoint pairs.\n\t */\n\tpublic async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n\t\tif (this._documentCreated) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Only one container/document can be created. To load the container/document use loadContainer\",\n\t\t\t);\n\t\t}\n\t\tconst loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n\t\tconst container = await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tthis.driver.createCreateNewRequest(this.documentId),\n\t\t);\n\t\tthis._documentCreated = true;\n\t\t// r11s driver will generate a new ID for the new container.\n\t\t// update the document ID with the actual ID of the attached container.\n\t\tthis._documentIdStrategy.update(container.resolvedUrl);\n\t\treturn container;\n\t}\n\n\tpublic async loadContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer> {\n\t\tconst loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n\t\treturn this.resolveContainer(loader, requestHeader);\n\t}\n\n\tprivate async resolveContainer(\n\t\tloader: ILoader,\n\t\trequestHeader?: IRequestHeader,\n\t\tdelay: boolean = true,\n\t) {\n\t\t// Once AB#3889 is done to switch default connection mode to \"read\" on load, we don't need\n\t\t// to load \"delayed\" across the board. Remove the following code.\n\t\tconst delayConnection =\n\t\t\tdelay &&\n\t\t\t(requestHeader === undefined || requestHeader[LoaderHeader.reconnect] !== false);\n\t\tconst headers: IRequestHeader | undefined = delayConnection\n\t\t\t? {\n\t\t\t\t\t[LoaderHeader.loadMode]: { deltaConnection: \"delayed\" },\n\t\t\t\t\t...requestHeader,\n\t\t\t }\n\t\t\t: requestHeader;\n\n\t\tconst container = await loader.resolve({\n\t\t\turl: await this.driver.createContainerUrl(this.documentId),\n\t\t\theaders,\n\t\t});\n\n\t\t// Once AB#3889 is done to switch default connection mode to \"read\" on load, we don't need\n\t\t// to load \"delayed\" across the board. Remove the following code.\n\t\tif (delayConnection) {\n\t\t\t// Older version may not have connect/disconnect. It was add in PR#9439, and available >= 0.59.1000\n\t\t\tconst maybeContainer = container as Partial<IContainer>;\n\t\t\tif (maybeContainer.connect !== undefined) {\n\t\t\t\tcontainer.connect();\n\t\t\t} else {\n\t\t\t\t// back compat. Remove when we don't support < 0.59.1000\n\t\t\t\t(container as any).resume();\n\t\t\t}\n\t\t}\n\t\treturn container;\n\t}\n\n\t/**\n\t * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n\t * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n\t * @param testContainerConfig - optional configuring the test Container\n\t */\n\tpublic makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n\t\treturn this.createLoader(\n\t\t\t[[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n\t\t\ttestContainerConfig?.loaderProps,\n\t\t);\n\t}\n\n\t/**\n\t * Make a container using a default document id and code details\n\t * Container loaded is automatically added to the OpProcessingController to manage op flow\n\t * @param testContainerConfig - optional configuring the test Container\n\t */\n\tpublic async makeTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t): Promise<IContainer> {\n\t\tif (this._documentCreated) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Only one container/document can be created. To load the container/document use loadTestContainer\",\n\t\t\t);\n\t\t}\n\t\tconst loader = this.makeTestLoader(testContainerConfig);\n\t\tconst container = await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tthis.driver.createCreateNewRequest(this.documentId),\n\t\t);\n\t\tthis._documentCreated = true;\n\t\t// r11s driver will generate a new ID for the new container.\n\t\t// update the document ID with the actual ID of the attached container.\n\t\tthis._documentIdStrategy.update(container.resolvedUrl);\n\t\treturn container;\n\t}\n\n\t/**\n\t * Load a container using a default document id and code details.\n\t * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n\t * @param testContainerConfig - optional configuring the test Container\n\t * @param requestHeader - optional headers to be supplied to the loader\n\t */\n\tpublic async loadTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer> {\n\t\tconst loader = this.makeTestLoader(testContainerConfig);\n\n\t\tconst container = await this.resolveContainer(\n\t\t\tloader,\n\t\t\trequestHeader,\n\t\t\ttestContainerConfig?.simulateReadConnectionUsingDelay,\n\t\t);\n\t\tawait this.waitContainerToCatchUp(container);\n\n\t\treturn container;\n\t}\n\n\tpublic reset() {\n\t\tthis._loaderContainerTracker.reset();\n\t\tthis._documentServiceFactory = undefined;\n\t\tthis._urlResolver = undefined;\n\t\tthis._documentIdStrategy.reset();\n\t\tconst logError = getUnexpectedLogErrorException(this._logger);\n\t\tif (logError) {\n\t\t\tthrow logError;\n\t\t}\n\t\tthis._logger = undefined;\n\t\tthis._documentCreated = false;\n\t}\n\n\tpublic async ensureSynchronized(): Promise<void> {\n\t\treturn this._loaderContainerTracker.ensureSynchronized();\n\t}\n\n\tpublic async waitContainerToCatchUp(container: IContainer) {\n\t\t// The original waitContainerToCatchUp() from container loader uses either Container.resume()\n\t\t// or Container.connect() as part of its implementation. However, resume() was deprecated\n\t\t// and eventually replaced with connect(). To avoid issues during LTS compatibility testing\n\t\t// with older container versions issues, we use resume() when connect() is unavailable.\n\t\tif ((container as any).connect === undefined) {\n\t\t\t(container as any).connect = (container as any).resume;\n\t\t}\n\n\t\treturn waitContainerToCatchUp_original(container);\n\t}\n\n\tupdateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n\t\tthis._documentIdStrategy.update(resolvedUrl);\n\t}\n\n\tpublic resetLoaderContainerTracker(syncSummarizerClients: boolean = false) {\n\t\tthis._loaderContainerTracker.reset();\n\t\tthis._loaderContainerTracker = new LoaderContainerTracker(syncSummarizerClients);\n\t}\n}\n\nexport function getUnexpectedLogErrorException(\n\tlogger: EventAndErrorTrackingLogger | undefined,\n\tprefix?: string,\n) {\n\tif (logger === undefined) {\n\t\treturn;\n\t}\n\tconst results = logger.reportAndClearTrackedEvents();\n\tif (results.unexpectedErrors.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(\n\t\t\t\tresults.unexpectedErrors,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n\tif (results.expectedNotFound.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(\n\t\t\t\tresults.expectedNotFound,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,uEAI0C;AAc1C,+BAAkC;AAClC,qEAA2F;AAC3F,qEAAkE;AAClE,uDAAqE;AACrE,+CAAyD;AAGzD,MAAM,kBAAkB,GAAsB;IAC7C,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,EAAE;CACV,CAAC;AAsDF,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAChC,qEAAM,CAAA;IACN,iEAAI,CAAA;AACL,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AAmBM,MAAM,gBAAgB,GAAG,GAAW,EAAE,CAAC,IAAA,SAAI,GAAE,CAAC;AAAxC,QAAA,gBAAgB,oBAAwB;AAQrD;;;GAGG;AACH,SAAS,qBAAqB,CAAC,IAAsB;IACpD,IAAI,UAAU,GAAG,IAAA,wBAAgB,GAAE,CAAC;IACpC,QAAQ,IA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IAAI,KAAK,CACf,GAAG,MAAM,IAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAC3D,OAAO,CAAC,gBAAgB,EACxB,SAAS,EACT,CAAC,CACD,EAAE,CACH,CAAC;KACF;AACF,CAAC;AA1BD,wEA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIHostLoader,\n\tIFluidCodeDetails,\n\tILoader,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tILoaderProps,\n\tLoader,\n\twaitContainerToCatchUp as waitContainerToCatchUp_original,\n} from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport {\n\tITelemetryGenericEvent,\n\tITelemetryBaseLogger,\n\tITelemetryBaseEvent,\n\tIRequestHeader,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { createChildLogger, createMultiSinkLogger } 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\tpackage: \"defaultTestPackage\",\n\tconfig: {},\n};\n\nexport interface IOpProcessingController {\n\tprocessIncoming(...containers: IContainer[]): Promise<void>;\n\tprocessOutgoing(...containers: IContainer[]): Promise<void>;\n\tpauseProcessing(...containers: IContainer[]): Promise<void>;\n\tresumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n\tcreateFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n\tcreateLoader(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t): IHostLoader;\n\tcreateContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t): Promise<IContainer>;\n\tloadContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer>;\n\n\t/**\n\t * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n\t * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n\t */\n\tmakeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n\tmakeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n\tloadTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer>;\n\t/**\n\t *\n\t * @param url - Resolved container URL\n\t */\n\tupdateDocumentId(url: IResolvedUrl | undefined): void;\n\n\tlogger: ITelemetryBaseLogger;\n\tdocumentServiceFactory: IDocumentServiceFactory;\n\turlResolver: IUrlResolver;\n\tdefaultCodeDetails: IFluidCodeDetails;\n\topProcessingController: IOpProcessingController;\n\n\tensureSynchronized(timeoutDuration?: number): Promise<void>;\n\treset(): void;\n\n\tdocumentId: string;\n\tdriver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n\tPrimed, // default\n\tTest,\n}\n\nexport interface ITestContainerConfig {\n\t/** TestFluidDataObject instead of PrimedDataStore */\n\tfluidDataObjectType?: DataObjectFactoryType;\n\n\t/** An array of channel name and DDS factory pair to create on container creation time */\n\tregistry?: ChannelFactoryRegistry;\n\n\t/** Container runtime options for the container instance */\n\truntimeOptions?: IContainerRuntimeOptions;\n\n\t/** Whether this runtime should be instantiated using a mixed-in attributor class */\n\tenableAttribution?: boolean;\n\n\t/** Loader options for the loader used to create containers */\n\tloaderProps?: Partial<ILoaderProps>;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n\tget(): string;\n\tupdate(resolvedUrl?: IResolvedUrl): void;\n\treset(): 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\tlet documentId = createDocumentId();\n\tswitch (type) {\n\t\tcase \"odsp\":\n\t\t\treturn {\n\t\t\t\tget: () => documentId,\n\t\t\t\tupdate: () => {}, // do not update the document ID in odsp test cases\n\t\t\t\treset: () => {\n\t\t\t\t\tdocumentId = createDocumentId();\n\t\t\t\t},\n\t\t\t};\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tget: () => documentId,\n\t\t\t\tupdate: (resolvedUrl?: IResolvedUrl) => {\n\t\t\t\t\t// Extract the document ID from the resolved container's URL and reset the ID property\n\t\t\t\t\tdocumentId = resolvedUrl?.id ?? documentId;\n\t\t\t\t},\n\t\t\t\treset: () => {\n\t\t\t\t\tdocumentId = createDocumentId();\n\t\t\t\t},\n\t\t\t};\n\t}\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 implements ITelemetryBaseLogger {\n\t/**\n\t * Even if these error events are logged, tests should still be allowed to pass\n\t * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)\n\t */\n\tprivate readonly allowedErrors: { eventName: string; downgrade?: true }[] = [\n\t\t// This log was removed in current version as unnecessary, but it's still present in previous versions\n\t\t{\n\t\t\teventName: \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n\t\t\tdowngrade: true,\n\t\t},\n\t\t// This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.\n\t\t{ eventName: \"fluid:telemetry:OpPerf:OpRoundtripTime\" },\n\t];\n\n\tconstructor(private readonly baseLogger: ITelemetryBaseLogger) {}\n\n\tprivate readonly expectedEvents: (\n\t\t| { index: number; event: ITelemetryGenericEvent | undefined }\n\t\t| undefined\n\t)[] = [];\n\tprivate readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n\tpublic registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEvent[]) {\n\t\tif (this.expectedEvents.length !== 0) {\n\t\t\t// we don't have to error here. just no reason not to. given the events must be\n\t\t\t// ordered it could be tricky to figure out problems around multiple registrations.\n\t\t\tthrow new Error(\n\t\t\t\t\"Expected events already registered.\\n\" +\n\t\t\t\t\t\"Call reportAndClearTrackedEvents to clear them before registering more\",\n\t\t\t);\n\t\t}\n\t\tthis.expectedEvents.push(\n\t\t\t...orderedExpectedEvents.map((event, index) => ({ index, event })),\n\t\t);\n\t}\n\n\tsend(event: ITelemetryBaseEvent): void {\n\t\tconst ee = this.expectedEvents[0]?.event;\n\t\tif (ee?.eventName === event.eventName) {\n\t\t\tlet matches = true;\n\t\t\tfor (const key of Object.keys(ee)) {\n\t\t\t\tif (ee[key] !== event[key]) {\n\t\t\t\t\tmatches = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (matches) {\n\t\t\t\t// we found an expected event\n\t\t\t\t// so remove it from the list of expected events\n\t\t\t\t// and if it is an error, change it to generic\n\t\t\t\t// this helps keep our telemetry clear of\n\t\t\t\t// expected errors.\n\t\t\t\tthis.expectedEvents.shift();\n\t\t\t\tif (event.category === \"error\") {\n\t\t\t\t\tevent.category = \"generic\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (event.category === \"error\") {\n\t\t\t// Check to see if this error is allowed and if its category should be downgraded\n\t\t\tconst allowedError = this.allowedErrors.find(\n\t\t\t\t({ eventName }) => eventName === event.eventName,\n\t\t\t);\n\n\t\t\tif (allowedError === undefined) {\n\t\t\t\tthis.unexpectedErrors.push(event);\n\t\t\t} else if (allowedError.downgrade) {\n\t\t\t\tevent.category = \"generic\";\n\t\t\t}\n\t\t}\n\n\t\tthis.baseLogger.send(event);\n\t}\n\n\tpublic reportAndClearTrackedEvents() {\n\t\tconst expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n\t\tconst unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n\t\treturn {\n\t\t\texpectedNotFound,\n\t\t\tunexpectedErrors,\n\t\t};\n\t}\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\tprivate _loaderContainerTracker = new LoaderContainerTracker();\n\tprivate _documentServiceFactory: IDocumentServiceFactory | undefined;\n\tprivate _urlResolver: IUrlResolver | undefined;\n\tprivate _logger: EventAndErrorTrackingLogger | undefined;\n\tprivate readonly _documentIdStrategy: IDocumentIdStrategy;\n\t// Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n\tprivate _documentCreated = false;\n\n\t/**\n\t * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n\t * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n\t * and factory for TestFluidObject\n\t */\n\tconstructor(\n\t\tpublic readonly LoaderConstructor: typeof Loader,\n\t\tpublic readonly driver: ITestDriver,\n\t\tpublic readonly createFluidEntryPoint: (\n\t\t\ttestContainerConfig?: ITestContainerConfig,\n\t\t) => fluidEntryPoint,\n\t) {\n\t\tthis._documentIdStrategy = getDocumentIdStrategy(driver.type);\n\t}\n\n\tget logger(): EventAndErrorTrackingLogger {\n\t\tif (this._logger === undefined) {\n\t\t\tthis._logger = new EventAndErrorTrackingLogger(\n\t\t\t\tcreateChildLogger({\n\t\t\t\t\tlogger: getTestLogger?.(),\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tall: {\n\t\t\t\t\t\t\tdriverType: this.driver.type,\n\t\t\t\t\t\t\tdriverEndpointName: this.driver.endpointName,\n\t\t\t\t\t\t\tdriverTenantName: this.driver.tenantName,\n\t\t\t\t\t\t\tdriverUserIndex: this.driver.userIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn this._logger;\n\t}\n\n\tset logger(logger: EventAndErrorTrackingLogger) {\n\t\tthis._logger = logger;\n\t}\n\n\tget documentServiceFactory() {\n\t\tif (!this._documentServiceFactory) {\n\t\t\tthis._documentServiceFactory = this.driver.createDocumentServiceFactory();\n\t\t}\n\t\treturn this._documentServiceFactory;\n\t}\n\n\tget urlResolver() {\n\t\tif (!this._urlResolver) {\n\t\t\tthis._urlResolver = this.driver.createUrlResolver();\n\t\t}\n\t\treturn this._urlResolver;\n\t}\n\n\tget documentId() {\n\t\treturn this._documentIdStrategy.get();\n\t}\n\n\tget defaultCodeDetails() {\n\t\treturn defaultCodeDetails;\n\t}\n\n\tget opProcessingController(): IOpProcessingController {\n\t\treturn this._loaderContainerTracker;\n\t}\n\n\t/**\n\t * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n\t *\n\t * Only the version of the loader will vary based on compat config. The version of\n\t * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n\t *\n\t * @param packageEntries - list of code details and fluidEntryPoint pairs.\n\t */\n\tpublic createLoader(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t) {\n\t\tconst logger = createMultiSinkLogger({\n\t\t\tloggers: [this.logger, loaderProps?.logger],\n\t\t});\n\n\t\tconst loader = new this.LoaderConstructor({\n\t\t\t...loaderProps,\n\t\t\tlogger,\n\t\t\tcodeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n\t\t\turlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n\t\t\tdocumentServiceFactory:\n\t\t\t\tloaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n\t\t});\n\t\tthis._loaderContainerTracker.add(loader);\n\t\treturn loader;\n\t}\n\n\t/**\n\t * Create a container using a default document id and code details.\n\t * Container created is automatically added to the OpProcessingController to manage op flow\n\t *\n\t * Only the version of the loader will vary based on compat config. The version of\n\t * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n\t *\n\t * @param packageEntries - list of code details and fluidEntryPoint pairs.\n\t */\n\tpublic async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n\t\tif (this._documentCreated) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Only one container/document can be created. To load the container/document use loadContainer\",\n\t\t\t);\n\t\t}\n\t\tconst loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n\t\tconst container = await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tthis.driver.createCreateNewRequest(this.documentId),\n\t\t);\n\t\tthis._documentCreated = true;\n\t\t// r11s driver will generate a new ID for the new container.\n\t\t// update the document ID with the actual ID of the attached container.\n\t\tthis._documentIdStrategy.update(container.resolvedUrl);\n\t\treturn container;\n\t}\n\n\tpublic async loadContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer> {\n\t\tconst loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n\t\treturn this.resolveContainer(loader, requestHeader);\n\t}\n\n\tprivate async resolveContainer(loader: ILoader, headers?: IRequestHeader) {\n\t\treturn loader.resolve({\n\t\t\turl: await this.driver.createContainerUrl(this.documentId),\n\t\t\theaders,\n\t\t});\n\t}\n\n\t/**\n\t * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n\t * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n\t * @param testContainerConfig - optional configuring the test Container\n\t */\n\tpublic makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n\t\treturn this.createLoader(\n\t\t\t[[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n\t\t\ttestContainerConfig?.loaderProps,\n\t\t);\n\t}\n\n\t/**\n\t * Make a container using a default document id and code details\n\t * Container loaded is automatically added to the OpProcessingController to manage op flow\n\t * @param testContainerConfig - optional configuring the test Container\n\t */\n\tpublic async makeTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t): Promise<IContainer> {\n\t\tif (this._documentCreated) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Only one container/document can be created. To load the container/document use loadTestContainer\",\n\t\t\t);\n\t\t}\n\t\tconst loader = this.makeTestLoader(testContainerConfig);\n\t\tconst container = await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tthis.driver.createCreateNewRequest(this.documentId),\n\t\t);\n\t\tthis._documentCreated = true;\n\t\t// r11s driver will generate a new ID for the new container.\n\t\t// update the document ID with the actual ID of the attached container.\n\t\tthis._documentIdStrategy.update(container.resolvedUrl);\n\t\treturn container;\n\t}\n\n\t/**\n\t * Load a container using a default document id and code details.\n\t * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n\t * @param testContainerConfig - optional configuring the test Container\n\t * @param requestHeader - optional headers to be supplied to the loader\n\t */\n\tpublic async loadTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer> {\n\t\tconst loader = this.makeTestLoader(testContainerConfig);\n\n\t\tconst container = await this.resolveContainer(loader, requestHeader);\n\t\tawait this.waitContainerToCatchUp(container);\n\n\t\treturn container;\n\t}\n\n\tpublic reset() {\n\t\tthis._loaderContainerTracker.reset();\n\t\tthis._documentServiceFactory = undefined;\n\t\tthis._urlResolver = undefined;\n\t\tthis._documentIdStrategy.reset();\n\t\tconst logError = getUnexpectedLogErrorException(this._logger);\n\t\tif (logError) {\n\t\t\tthrow logError;\n\t\t}\n\t\tthis._logger = undefined;\n\t\tthis._documentCreated = false;\n\t}\n\n\tpublic async ensureSynchronized(): Promise<void> {\n\t\treturn this._loaderContainerTracker.ensureSynchronized();\n\t}\n\n\tpublic async waitContainerToCatchUp(container: IContainer) {\n\t\t// The original waitContainerToCatchUp() from container loader uses either Container.resume()\n\t\t// or Container.connect() as part of its implementation. However, resume() was deprecated\n\t\t// and eventually replaced with connect(). To avoid issues during LTS compatibility testing\n\t\t// with older container versions issues, we use resume() when connect() is unavailable.\n\t\tif ((container as any).connect === undefined) {\n\t\t\t(container as any).connect = (container as any).resume;\n\t\t}\n\n\t\treturn waitContainerToCatchUp_original(container);\n\t}\n\n\tupdateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n\t\tthis._documentIdStrategy.update(resolvedUrl);\n\t}\n\n\tpublic resetLoaderContainerTracker(syncSummarizerClients: boolean = false) {\n\t\tthis._loaderContainerTracker.reset();\n\t\tthis._loaderContainerTracker = new LoaderContainerTracker(syncSummarizerClients);\n\t}\n}\n\nexport function getUnexpectedLogErrorException(\n\tlogger: EventAndErrorTrackingLogger | undefined,\n\tprefix?: string,\n) {\n\tif (logger === undefined) {\n\t\treturn;\n\t}\n\tconst results = logger.reportAndClearTrackedEvents();\n\tif (results.unexpectedErrors.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(\n\t\t\t\tresults.unexpectedErrors,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n\tif (results.expectedNotFound.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(\n\t\t\t\tresults.expectedNotFound,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n}\n"]}
@@ -23,7 +23,7 @@ export interface TimeoutWithValue<T = void> {
23
23
  reject: false;
24
24
  value: T;
25
25
  }
26
- export declare type PromiseExecutor<T = void> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
26
+ export type PromiseExecutor<T = void> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
27
27
  /**
28
28
  * Wraps the given promise around with promise that will complete after a specific timeout if the original promise does
29
29
  * not resolve by then. By default, it uses the mocha test timeout and complete the promise just before that so that
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutUtils.d.ts","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AA8F5C,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,IAAI;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACT;AAED,oBAAY,eAAe,CAAC,CAAC,GAAG,IAAI,IAAI,CACvC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC1B,IAAI,CAAC;AAEV;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,IAAI,EAC1C,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,GACzD,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,IAAI,EAC5C,QAAQ,EAAE,CACT,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,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C,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC1B,IAAI,EACT,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,GACzD,OAAO,CAAC,CAAC,CAAC,CA6BZ"}
@@ -15,13 +15,6 @@ const timeBuffer = 15; // leave 15 ms leeway for finish processing
15
15
  // before that happens.
16
16
  // Once rejected, a new TestTimeout object will be create for the timeout.
17
17
  class TestTimeout {
18
- constructor() {
19
- this.timeout = 0;
20
- this.rejected = false;
21
- this.deferred = new core_utils_1.Deferred();
22
- // Ignore rejection for timeout promise if no one is waiting for it.
23
- this.deferred.promise.catch(() => { });
24
- }
25
18
  static reset(runnable) {
26
19
  TestTimeout.clear();
27
20
  TestTimeout.instance.resetTimer(runnable);
@@ -43,6 +36,13 @@ class TestTimeout {
43
36
  getTimeout() {
44
37
  return this.timeout;
45
38
  }
39
+ constructor() {
40
+ this.timeout = 0;
41
+ this.rejected = false;
42
+ this.deferred = new core_utils_1.Deferred();
43
+ // Ignore rejection for timeout promise if no one is waiting for it.
44
+ this.deferred.promise.catch(() => { });
45
+ }
46
46
  resetTimer(runnable) {
47
47
  (0, core_utils_1.assert)(!this.timer, "clearTimer should have been called before reset");
48
48
  (0, core_utils_1.assert)(!this.deferred.isCompleted, "can't reset a completed TestTimeout");
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAA8D;AAE9D,2CAA2C;AAC9B,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,MAAM,UAAU,GAAG,EAAE,CAAC,CAAC,2CAA2C;AAElE,yGAAyG;AACzG,uHAAuH;AACvH,sGAAsG;AACtG,uBAAuB;AACvB,0EAA0E;AAC1E,MAAM,WAAW;IAgChB;QA/BQ,YAAO,GAAW,CAAC,CAAC;QAGpB,aAAQ,GAAG,KAAK,CAAC;QA6BxB,IAAI,CAAC,QAAQ,GAA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AC/C,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC9C,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC7B;IAED,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,MAAM,iBAAiB,GAAG,GAAG,EAAE;YAC9B,oEAAoE;YACpE,MAAM,WAAW,GAAG,GAAI,CAAC;YACzB,WAAW,CAAC,OAAO,GAAG,GAAG,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;YAC9D,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CACvB,GAAG,EAAE,CACJ,cAAc,CAAC,MAAM,KAAK,KAAK;YAC9B,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,iBAAiB,EAAE,EACvB,OAAO,CACP,CAAC;QAEF,QAAQ,CACP,CAAC,KAAK,EAAE,EAAE;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QAChB,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\n\n// @deprecated this value is no longer used\nexport const defaultTimeoutDurationMs = 250;\n\nconst timeBuffer = 15; // leave 15 ms leeway for finish processing\n\n// TestTimeout class that manages tracking of test timeout. It creates a timer when timeout is in effect,\n// and provides a promise that will be rejected some time (as defined by `timeBuffer`) before the test timeout happens.\n// This will ensure that async awaits in tests do not end up timing out the tests but resolve / reject\n// before that happens.\n// Once rejected, a new TestTimeout object will be create for the timeout.\nclass TestTimeout {\n\tprivate timeout: number = 0;\n\tprivate timer: NodeJS.Timeout | undefined;\n\tprivate readonly deferred: Deferred<void>;\n\tprivate rejected = false;\n\n\tprivate static instance: TestTimeout = new TestTimeout();\n\tpublic static reset(runnable: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\tTestTimeout.instance.resetTimer(runnable);\n\t}\n\n\tpublic static clear() {\n\t\tif (TestTimeout.instance.rejected) {\n\t\t\tTestTimeout.instance = new TestTimeout();\n\t\t} else {\n\t\t\tTestTimeout.instance.clearTimer();\n\t\t}\n\t}\n\n\tpublic static getInstance() {\n\t\treturn TestTimeout.instance;\n\t}\n\n\tpublic async getPromise() {\n\t\treturn this.deferred.promise;\n\t}\n\n\tpublic getTimeout() {\n\t\treturn this.timeout;\n\t}\n\n\tprivate constructor() {\n\t\tthis.deferred = new Deferred();\n\t\t// Ignore rejection for timeout promise if no one is waiting for it.\n\t\tthis.deferred.promise.catch(() => {});\n\t}\n\n\tprivate resetTimer(runnable: Mocha.Runnable) {\n\t\tassert(!this.timer, \"clearTimer should have been called before reset\");\n\t\tassert(!this.deferred.isCompleted, \"can't reset a completed TestTimeout\");\n\n\t\t// Check the test timeout setting\n\t\tconst timeout = runnable.timeout();\n\t\tif (!(Number.isFinite(timeout) && timeout > 0)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// subtract a buffer\n\t\tthis.timeout = Math.max(timeout - timeBuffer, 1);\n\n\t\t// Set up timer to reject near the test timeout.\n\t\tthis.timer = setTimeout(() => {\n\t\t\tthis.deferred.reject(this);\n\t\t\tthis.rejected = true;\n\t\t}, this.timeout);\n\t}\n\tprivate clearTimer() {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t}\n}\n\n// only register if we are running with mocha-test-setup loaded\nif (globalThis.getMochaModule !== undefined) {\n\t// patching resetTimeout and clearTimeout on the runnable object\n\t// so we can track when test timeout are enforced\n\tconst mochaModule = globalThis.getMochaModule() as typeof Mocha;\n\tconst runnablePrototype = mochaModule.Runnable.prototype;\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldResetTimeoutFunc = runnablePrototype.resetTimeout;\n\trunnablePrototype.resetTimeout = function (this: Mocha.Runnable) {\n\t\toldResetTimeoutFunc.call(this);\n\t\tTestTimeout.reset(this);\n\t};\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldClearTimeoutFunc = runnablePrototype.clearTimeout;\n\trunnablePrototype.clearTimeout = function (this: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\toldClearTimeoutFunc.call(this);\n\t};\n}\n\nexport interface TimeoutWithError {\n\t/**\n\t * Timeout duration in milliseconds, if it is great than 0 and not Infinity\n\t * If it is undefined, then it will use test timeout if we are in side the test function\n\t * Otherwise, there is no timeout\n\t */\n\tdurationMs?: number;\n\treject?: true;\n\terrorMsg?: string;\n}\nexport interface TimeoutWithValue<T = void> {\n\t/**\n\t * Timeout duration in milliseconds, if it is great than 0 and not Infinity\n\t * If it is undefined, then it will use test timeout if we are in side the test function\n\t * Otherwise, there is no timeout\n\t */\n\tdurationMs?: number;\n\treject: false;\n\tvalue: T;\n}\n\nexport type PromiseExecutor<T = void> = (\n\tresolve: (value: T | PromiseLike<T>) => void,\n\treject: (reason?: any) => void,\n) => void;\n\n/**\n * Wraps the given promise around with promise that will complete after a specific timeout if the original promise does\n * not resolve by then. By default, it uses the mocha test timeout and complete the promise just before that so that\n * tests don't time out because of unpredictable awaits.\n * The timeout can be overridden via timeoutOptions but it's recommended to use the default value.\n * @param promise - The promise to be awaited.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior\n * when the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a\n * specific value.\n * @returns A new promise that will complete when the given promise resolves or the timeout expires.\n */\nexport async function timeoutAwait<T = void>(\n\tpromise: PromiseLike<T>,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\treturn Promise.race([promise, timeoutPromise<T>(() => {}, timeoutOptions)]);\n}\n\n/**\n * Creates a promise from the given executor that will complete after a specific timeout. By default, it uses the mocha\n * test timeout and complete the promise just before that so that tests don't time out because of unpredictable awaits.\n * The timeout can be overridden via timeoutOptions but it's recommended to use the default value.\n * @param executor - The executor for the promise.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when\n * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.\n * @returns A new promise that will complete when the given executor resolves or the timeout expires.\n */\nexport async function timeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\t// create the timeout error outside the async task, so its callstack includes\n\t// the original call site, this makes it easier to debug\n\tconst err =\n\t\ttimeoutOptions.reject === false\n\t\t\t? undefined\n\t\t\t: new Error(timeoutOptions.errorMsg ?? \"Timed out\");\n\tconst executorPromise = getTimeoutPromise(executor, timeoutOptions, err);\n\n\tconst currentTestTimeout = TestTimeout.getInstance();\n\tif (currentTestTimeout === undefined) {\n\t\treturn executorPromise;\n\t}\n\n\treturn Promise.race([executorPromise, currentTestTimeout.getPromise()]).catch((e) => {\n\t\tif (e === currentTestTimeout) {\n\t\t\tif (timeoutOptions.reject !== false) {\n\t\t\t\t// If the rejection is because of the timeout then\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst errorObject = err!;\n\t\t\t\terrorObject.message = `${\n\t\t\t\t\ttimeoutOptions.errorMsg ?? \"Test timed out\"\n\t\t\t\t} (${currentTestTimeout.getTimeout()}ms)`;\n\t\t\t\tthrow errorObject;\n\t\t\t}\n\t\t\treturn timeoutOptions.value;\n\t\t}\n\t\tthrow e;\n\t}) as Promise<T>;\n}\n\n// Create a promise based on the timeout options\nasync function getTimeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T>,\n\terr: Error | undefined,\n) {\n\tconst timeout = timeoutOptions.durationMs ?? 0;\n\tif (timeout <= 0 || !Number.isFinite(timeout)) {\n\t\treturn new Promise(executor);\n\t}\n\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst timeoutRejections = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst errorObject = err!;\n\t\t\terrorObject.message = `${errorObject.message} (${timeout}ms)`;\n\t\t\treject(err);\n\t\t};\n\t\tconst timer = setTimeout(\n\t\t\t() =>\n\t\t\t\ttimeoutOptions.reject === false\n\t\t\t\t\t? resolve(timeoutOptions.value)\n\t\t\t\t\t: timeoutRejections(),\n\t\t\ttimeout,\n\t\t);\n\n\t\texecutor(\n\t\t\t(value) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(reason) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\treject(reason);\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
1
+ {"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAA8D;AAE9D,2CAA2C;AAC9B,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,MAAM,UAAU,GAAG,EAAE,CAAC,CAAC,2CAA2C;AAElE,yGAAyG;AACzG,uHAAuH;AACvH,sGAAsG;AACtG,uBAAuB;AACvB,0EAA0E;AAC1E,MAAM,WAAW;IAOT,MAAM,CAAC,KAAK,CAAC,QAAwB;QAC3C,WAAW,CAAC,KAAK,EAAE,CAAC;QACpB,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,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,CAAC,OAAO,CAAC,EAAE;QAC9C,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC7B;IAED,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,MAAM,iBAAiB,GAAG,GAAG,EAAE;YAC9B,oEAAoE;YACpE,MAAM,WAAW,GAAG,GAAI,CAAC;YACzB,WAAW,CAAC,OAAO,GAAG,GAAG,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;YAC9D,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CACvB,GAAG,EAAE,CACJ,cAAc,CAAC,MAAM,KAAK,KAAK;YAC9B,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,iBAAiB,EAAE,EACvB,OAAO,CACP,CAAC;QAEF,QAAQ,CACP,CAAC,KAAK,EAAE,EAAE;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QAChB,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\n\n// @deprecated this value is no longer used\nexport const defaultTimeoutDurationMs = 250;\n\nconst timeBuffer = 15; // leave 15 ms leeway for finish processing\n\n// TestTimeout class that manages tracking of test timeout. It creates a timer when timeout is in effect,\n// and provides a promise that will be rejected some time (as defined by `timeBuffer`) before the test timeout happens.\n// This will ensure that async awaits in tests do not end up timing out the tests but resolve / reject\n// before that happens.\n// Once rejected, a new TestTimeout object will be create for the timeout.\nclass TestTimeout {\n\tprivate timeout: number = 0;\n\tprivate timer: NodeJS.Timeout | undefined;\n\tprivate readonly deferred: Deferred<void>;\n\tprivate rejected = false;\n\n\tprivate static instance: TestTimeout = new TestTimeout();\n\tpublic static reset(runnable: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\tTestTimeout.instance.resetTimer(runnable);\n\t}\n\n\tpublic static clear() {\n\t\tif (TestTimeout.instance.rejected) {\n\t\t\tTestTimeout.instance = new TestTimeout();\n\t\t} else {\n\t\t\tTestTimeout.instance.clearTimer();\n\t\t}\n\t}\n\n\tpublic static getInstance() {\n\t\treturn TestTimeout.instance;\n\t}\n\n\tpublic async getPromise() {\n\t\treturn this.deferred.promise;\n\t}\n\n\tpublic getTimeout() {\n\t\treturn this.timeout;\n\t}\n\n\tprivate constructor() {\n\t\tthis.deferred = new Deferred();\n\t\t// Ignore rejection for timeout promise if no one is waiting for it.\n\t\tthis.deferred.promise.catch(() => {});\n\t}\n\n\tprivate resetTimer(runnable: Mocha.Runnable) {\n\t\tassert(!this.timer, \"clearTimer should have been called before reset\");\n\t\tassert(!this.deferred.isCompleted, \"can't reset a completed TestTimeout\");\n\n\t\t// Check the test timeout setting\n\t\tconst timeout = runnable.timeout();\n\t\tif (!(Number.isFinite(timeout) && timeout > 0)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// subtract a buffer\n\t\tthis.timeout = Math.max(timeout - timeBuffer, 1);\n\n\t\t// Set up timer to reject near the test timeout.\n\t\tthis.timer = setTimeout(() => {\n\t\t\tthis.deferred.reject(this);\n\t\t\tthis.rejected = true;\n\t\t}, this.timeout);\n\t}\n\tprivate clearTimer() {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t}\n}\n\n// only register if we are running with mocha-test-setup loaded\nif (globalThis.getMochaModule !== undefined) {\n\t// patching resetTimeout and clearTimeout on the runnable object\n\t// so we can track when test timeout are enforced\n\tconst mochaModule = globalThis.getMochaModule() as typeof Mocha;\n\tconst runnablePrototype = mochaModule.Runnable.prototype;\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldResetTimeoutFunc = runnablePrototype.resetTimeout;\n\trunnablePrototype.resetTimeout = function (this: Mocha.Runnable) {\n\t\toldResetTimeoutFunc.call(this);\n\t\tTestTimeout.reset(this);\n\t};\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldClearTimeoutFunc = runnablePrototype.clearTimeout;\n\trunnablePrototype.clearTimeout = function (this: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\toldClearTimeoutFunc.call(this);\n\t};\n}\n\nexport interface TimeoutWithError {\n\t/**\n\t * Timeout duration in milliseconds, if it is great than 0 and not Infinity\n\t * If it is undefined, then it will use test timeout if we are in side the test function\n\t * Otherwise, there is no timeout\n\t */\n\tdurationMs?: number;\n\treject?: true;\n\terrorMsg?: string;\n}\nexport interface TimeoutWithValue<T = void> {\n\t/**\n\t * Timeout duration in milliseconds, if it is great than 0 and not Infinity\n\t * If it is undefined, then it will use test timeout if we are in side the test function\n\t * Otherwise, there is no timeout\n\t */\n\tdurationMs?: number;\n\treject: false;\n\tvalue: T;\n}\n\nexport type PromiseExecutor<T = void> = (\n\tresolve: (value: T | PromiseLike<T>) => void,\n\treject: (reason?: any) => void,\n) => void;\n\n/**\n * Wraps the given promise around with promise that will complete after a specific timeout if the original promise does\n * not resolve by then. By default, it uses the mocha test timeout and complete the promise just before that so that\n * tests don't time out because of unpredictable awaits.\n * The timeout can be overridden via timeoutOptions but it's recommended to use the default value.\n * @param promise - The promise to be awaited.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior\n * when the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a\n * specific value.\n * @returns A new promise that will complete when the given promise resolves or the timeout expires.\n */\nexport async function timeoutAwait<T = void>(\n\tpromise: PromiseLike<T>,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\treturn Promise.race([promise, timeoutPromise<T>(() => {}, timeoutOptions)]);\n}\n\n/**\n * Creates a promise from the given executor that will complete after a specific timeout. By default, it uses the mocha\n * test timeout and complete the promise just before that so that tests don't time out because of unpredictable awaits.\n * The timeout can be overridden via timeoutOptions but it's recommended to use the default value.\n * @param executor - The executor for the promise.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when\n * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.\n * @returns A new promise that will complete when the given executor resolves or the timeout expires.\n */\nexport async function timeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\t// create the timeout error outside the async task, so its callstack includes\n\t// the original call site, this makes it easier to debug\n\tconst err =\n\t\ttimeoutOptions.reject === false\n\t\t\t? undefined\n\t\t\t: new Error(timeoutOptions.errorMsg ?? \"Timed out\");\n\tconst executorPromise = getTimeoutPromise(executor, timeoutOptions, err);\n\n\tconst currentTestTimeout = TestTimeout.getInstance();\n\tif (currentTestTimeout === undefined) {\n\t\treturn executorPromise;\n\t}\n\n\treturn Promise.race([executorPromise, currentTestTimeout.getPromise()]).catch((e) => {\n\t\tif (e === currentTestTimeout) {\n\t\t\tif (timeoutOptions.reject !== false) {\n\t\t\t\t// If the rejection is because of the timeout then\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst errorObject = err!;\n\t\t\t\terrorObject.message = `${\n\t\t\t\t\ttimeoutOptions.errorMsg ?? \"Test timed out\"\n\t\t\t\t} (${currentTestTimeout.getTimeout()}ms)`;\n\t\t\t\tthrow errorObject;\n\t\t\t}\n\t\t\treturn timeoutOptions.value;\n\t\t}\n\t\tthrow e;\n\t}) as Promise<T>;\n}\n\n// Create a promise based on the timeout options\nasync function getTimeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T>,\n\terr: Error | undefined,\n) {\n\tconst timeout = timeoutOptions.durationMs ?? 0;\n\tif (timeout <= 0 || !Number.isFinite(timeout)) {\n\t\treturn new Promise(executor);\n\t}\n\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst timeoutRejections = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst errorObject = err!;\n\t\t\terrorObject.message = `${errorObject.message} (${timeout}ms)`;\n\t\t\treject(err);\n\t\t};\n\t\tconst timer = setTimeout(\n\t\t\t() =>\n\t\t\t\ttimeoutOptions.reject === false\n\t\t\t\t\t? resolve(timeoutOptions.value)\n\t\t\t\t\t: timeoutRejections(),\n\t\t\ttimeout,\n\t\t);\n\n\t\texecutor(\n\t\t\t(value) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(reason) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\treject(reason);\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.34.9"
8
+ "packageVersion": "7.37.0"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/test-utils",
3
- "version": "2.0.0-internal.6.4.0",
3
+ "version": "2.0.0-internal.7.0.1",
4
4
  "description": "Utilities for Fluid tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -34,39 +34,39 @@
34
34
  "temp-directory": "nyc/.nyc_output"
35
35
  },
36
36
  "dependencies": {
37
- "@fluidframework/aqueduct": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
38
- "@fluidframework/container-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
39
- "@fluidframework/container-loader": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
40
- "@fluidframework/container-runtime": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
41
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
42
- "@fluidframework/core-interfaces": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
43
- "@fluidframework/core-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
44
- "@fluidframework/datastore": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
45
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
46
- "@fluidframework/driver-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
47
- "@fluidframework/driver-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
48
- "@fluidframework/local-driver": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
49
- "@fluidframework/map": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
50
- "@fluidframework/protocol-definitions": "^1.1.0",
51
- "@fluidframework/request-handler": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
52
- "@fluidframework/routerlicious-driver": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
53
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
54
- "@fluidframework/runtime-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
55
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
56
- "@fluidframework/test-driver-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
57
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
37
+ "@fluidframework/aqueduct": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
38
+ "@fluidframework/container-definitions": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
39
+ "@fluidframework/container-loader": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
40
+ "@fluidframework/container-runtime": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
41
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
42
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
43
+ "@fluidframework/core-utils": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
44
+ "@fluidframework/datastore": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
45
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
46
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
47
+ "@fluidframework/driver-utils": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
48
+ "@fluidframework/local-driver": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
49
+ "@fluidframework/map": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
50
+ "@fluidframework/protocol-definitions": "^3.0.0",
51
+ "@fluidframework/request-handler": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
52
+ "@fluidframework/routerlicious-driver": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
53
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
54
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
55
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
56
+ "@fluidframework/test-driver-definitions": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
57
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
58
58
  "best-random": "^1.0.0",
59
59
  "debug": "^4.1.1",
60
60
  "uuid": "^9.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@fluid-tools/build-cli": "^0.22.0",
63
+ "@fluid-tools/build-cli": "^0.24.0",
64
64
  "@fluidframework/build-common": "^2.0.0",
65
- "@fluidframework/build-tools": "^0.22.0",
65
+ "@fluidframework/build-tools": "^0.24.0",
66
66
  "@fluidframework/eslint-config-fluid": "^2.1.0",
67
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
67
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.0.1 <2.0.0-internal.7.1.0",
68
68
  "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.0.0-internal.6.3.0",
69
- "@microsoft/api-extractor": "^7.34.4",
69
+ "@microsoft/api-extractor": "^7.37.0",
70
70
  "@types/debug": "^4.1.5",
71
71
  "@types/diff": "^3.5.1",
72
72
  "@types/mocha": "^9.1.1",
@@ -83,7 +83,7 @@
83
83
  "moment": "^2.21.0",
84
84
  "prettier": "~2.6.2",
85
85
  "rimraf": "^4.4.0",
86
- "typescript": "~4.5.5"
86
+ "typescript": "~5.1.6"
87
87
  },
88
88
  "typeValidation": {
89
89
  "broken": {}
@@ -19,11 +19,11 @@ import {
19
19
  NamedFluidDataStoreRegistryEntries,
20
20
  } from "@fluidframework/runtime-definitions";
21
21
  import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
22
- import { requestFluidObject } from "@fluidframework/runtime-utils";
23
22
  import { ITestContainerConfig, ITestObjectProvider } from "./testObjectProvider";
24
23
  import { mockConfigProvider } from "./TestConfigs";
25
24
  import { waitForContainerConnection } from "./containerUtils";
26
25
  import { timeoutAwait } from "./timeoutUtils";
26
+ import { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore";
27
27
 
28
28
  const summarizerClientType = "summarizer";
29
29
 
@@ -52,11 +52,8 @@ async function createSummarizerCore(
52
52
  const summarizerContainer = await loader.resolve(request);
53
53
  await waitForContainerConnection(summarizerContainer);
54
54
 
55
- const fluidObject: FluidObject<ISummarizer> | undefined = summarizerContainer.getEntryPoint
56
- ? await summarizerContainer.getEntryPoint?.()
57
- : await requestFluidObject<FluidObject<ISummarizer>>(summarizerContainer, {
58
- url: "_summarizer",
59
- });
55
+ const fluidObject: FluidObject<ISummarizer> | undefined =
56
+ await summarizerContainer.getEntryPoint();
60
57
  if (fluidObject?.ISummarizer === undefined) {
61
58
  throw new Error("Fluid object does not implement ISummarizer");
62
59
  }
@@ -93,12 +90,16 @@ export async function createSummarizerFromFactory(
93
90
  ): Promise<{ container: IContainer; summarizer: ISummarizer }> {
94
91
  const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>
95
92
  runtime.IFluidHandleContext.resolveHandle(request);
96
- const runtimeFactory = new containerRuntimeFactoryType(
97
- dataStoreFactory,
98
- registryEntries ?? [[dataStoreFactory.type, Promise.resolve(dataStoreFactory)]],
99
- undefined,
100
- [innerRequestHandler],
101
- { summaryOptions: defaultSummaryOptions },
93
+ const runtimeFactory = createContainerRuntimeFactoryWithDefaultDataStore(
94
+ containerRuntimeFactoryType,
95
+ {
96
+ defaultFactory: dataStoreFactory,
97
+ registryEntries: registryEntries ?? [
98
+ [dataStoreFactory.type, Promise.resolve(dataStoreFactory)],
99
+ ],
100
+ requestHandlers: [innerRequestHandler],
101
+ runtimeOptions: { summaryOptions: defaultSummaryOptions },
102
+ },
102
103
  );
103
104
 
104
105
  const loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], {
package/src/index.ts CHANGED
@@ -38,3 +38,4 @@ export {
38
38
  TimeoutWithValue,
39
39
  } from "./timeoutUtils";
40
40
  export { waitForContainerConnection } from "./containerUtils";
41
+ export { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore";
@@ -71,13 +71,14 @@ export class LocalCodeLoader implements ICodeDetailsLoader {
71
71
  fluidModule = {
72
72
  fluidExport: {
73
73
  ...maybeExport,
74
- IRuntimeFactory: new ContainerRuntimeFactoryWithDefaultDataStore(
74
+ IRuntimeFactory: new ContainerRuntimeFactoryWithDefaultDataStore({
75
75
  defaultFactory,
76
- [[defaultFactory.type, Promise.resolve(defaultFactory)]],
77
- undefined,
78
- [innerRequestHandler],
76
+ registryEntries: [
77
+ [defaultFactory.type, Promise.resolve(defaultFactory)],
78
+ ],
79
+ requestHandlers: [innerRequestHandler],
79
80
  runtimeOptions,
80
- ),
81
+ }),
81
82
  },
82
83
  };
83
84
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/test-utils";
9
- export const pkgVersion = "2.0.0-internal.6.4.0";
9
+ export const pkgVersion = "2.0.0-internal.7.0.1";