@fluidframework/azure-end-to-end-tests 2.74.0 → 2.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/eslint.config.mts +4 -4
- package/lib/test/AzureClientFactory.js +29 -25
- package/lib/test/AzureClientFactory.js.map +1 -1
- package/lib/test/audience.spec.js.map +1 -1
- package/lib/test/containerCreate.spec.js.map +1 -1
- package/lib/test/ddsTests.spec.js.map +1 -1
- package/lib/test/multiprocess/childClient.tool.js +10 -0
- package/lib/test/multiprocess/childClient.tool.js.map +1 -1
- package/lib/test/signals.spec.js.map +1 -1
- package/lib/test/tree.spec.js +0 -1
- package/lib/test/tree.spec.js.map +1 -1
- package/lib/test/viewContainerVersion.spec.js.map +1 -1
- package/package.json +28 -29
- package/src/test/AzureClientFactory.ts +45 -27
- package/src/test/audience.spec.ts +5 -6
- package/src/test/containerCreate.spec.ts +3 -4
- package/src/test/ddsTests.spec.ts +6 -7
- package/src/test/multiprocess/childClient.tool.ts +16 -7
- package/src/test/signals.spec.ts +5 -7
- package/src/test/tree.spec.ts +1 -3
- package/src/test/viewContainerVersion.spec.ts +3 -4
- package/.eslintrc.cjs +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewContainerVersion.spec.js","sourceRoot":"","sources":["../../src/test/viewContainerVersion.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EACN,iBAAiB,EACjB,0BAA0B,EAC1B,iCAAiC,GACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,qBAAqB,MAAM,4BAA4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,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,iCAAiC,CAAC,CAAC;gBACnF,MAAM,CAAC,WAAW,CACjB,KAAK,CAAC,OAAO,EACb,+DAA+D,EAC/D,qBAAqB,KAAK,CAAC,OAAO,EAAE,CACpC,CAAC;gBACF,OAAO,IAAI,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,8CAA8C,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;IACJ,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 { strict as assert } from \"node:assert\";\n\nimport type { AzureClient } from \"@fluidframework/azure-client\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport type { ContainerSchema, IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { SharedMap } from \"@fluidframework/map/legacy\";\nimport { timeoutPromise } from \"@fluidframework/test-utils/internal\";\nimport type { AxiosResponse } from \"axios\";\n\nimport {\n\tcreateAzureClient,\n\tcreateContainerFromPayload,\n\tgetContainerIdFromPayloadResponse,\n} from \"./AzureClientFactory.js\";\nimport * as ephemeralSummaryTrees from \"./ephemeralSummaryTrees.js\";\nimport { getTestMatrix } from \"./utils.js\";\n\nconst testMatrix = getTestMatrix();\nfor (const testOpts of testMatrix) {\n\tdescribe(`viewContainerVersion scenarios (${testOpts.variant})`, () => {\n\t\tconst isEphemeral: boolean = testOpts.options.isEphemeral;\n\t\tconst connectTimeoutMs = 10_000;\n\t\tlet client: AzureClient;\n\t\tconst schema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap1: SharedMap,\n\t\t\t},\n\t\t} satisfies ContainerSchema;\n\n\t\tbeforeEach(\"createAzureClient\", () => {\n\t\t\tclient = createAzureClient();\n\t\t});\n\n\t\tbeforeEach(\"skipForNonAzure\", async function () {\n\t\t\tif (process.env.FLUID_CLIENT !== \"azure\") {\n\t\t\t\tthis.skip();\n\t\t\t}\n\t\t});\n\n\t\tbeforeEach(\"skipForEphemeral\", async function () {\n\t\t\tif (isEphemeral) {\n\t\t\t\tthis.skip();\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can provide versions of the container.\n\t\t *\n\t\t * Expected behavior: an error should not be thrown nor should a rejected promise\n\t\t * be returned. Upon creation, we should recieve back 1 version of the container.\n\t\t */\n\t\tit(\"can get versions of current document\", async () => {\n\t\t\tlet containerId: string;\n\t\t\tlet container: IFluidContainer;\n\t\t\tif (isEphemeral) {\n\t\t\t\tconst containerResponse: AxiosResponse | undefined = await createContainerFromPayload(\n\t\t\t\t\tephemeralSummaryTrees.getVersionsOfCurrentDocument,\n\t\t\t\t\t\"test-user-id-1\",\n\t\t\t\t\t\"test-user-name-1\",\n\t\t\t\t);\n\t\t\t\tcontainerId = getContainerIdFromPayloadResponse(containerResponse);\n\t\t\t\t({ container } = await client.getContainer(containerId, schema, \"2\"));\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, \"2\"));\n\t\t\t\tcontainerId = await container.attach();\n\t\t\t}\n\n\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\tawait timeoutPromise((resolve) => container.once(\"connected\", () => resolve()), {\n\t\t\t\t\tdurationMs: connectTimeoutMs,\n\t\t\t\t\terrorMsg: \"container connect() timeout\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst resources = client.getContainerVersions(containerId);\n\t\t\tawait assert.doesNotReject(\n\t\t\t\tresources,\n\t\t\t\t() => true,\n\t\t\t\t\"could not get versions of the container\",\n\t\t\t);\n\n\t\t\tconst versions = await resources;\n\t\t\tassert.strictEqual(versions.length, 1, \"Container should have exactly one version.\");\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can handle bad document ID when versions are requested.\n\t\t *\n\t\t * Expected behavior: Client should throw an error.\n\t\t */\n\t\tit(\"can handle bad document id when requesting versions\", async () => {\n\t\t\tconst resources = client.getContainerVersions(\"badid\");\n\t\t\tconst errorFn = (error: Error): boolean => {\n\t\t\t\tassert.notStrictEqual(error.message, undefined, \"Azure Client error is undefined\");\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\terror.message,\n\t\t\t\t\t\"R11s fetch error: Document is deleted and cannot be accessed.\",\n\t\t\t\t\t`Unexpected error: ${error.message}`,\n\t\t\t\t);\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\tawait assert.rejects(\n\t\t\t\tresources,\n\t\t\t\terrorFn,\n\t\t\t\t\"We should not be able to get container versions.\",\n\t\t\t);\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can retrieve a specified version of a container.\n\t\t *\n\t\t * Expected behavior: an error should not be thrown nor should a rejected promise\n\t\t * be returned.\n\t\t */\n\t\tit(\"can view container version successfully\", async () => {\n\t\t\tlet containerId: string;\n\t\t\tlet container: IFluidContainer;\n\t\t\tif (isEphemeral) {\n\t\t\t\tconst containerResponse: AxiosResponse | undefined = await createContainerFromPayload(\n\t\t\t\t\tephemeralSummaryTrees.copyDocumentSuccessfully,\n\t\t\t\t\t\"test-user-id-1\",\n\t\t\t\t\t\"test-user-name-1\",\n\t\t\t\t);\n\t\t\t\tcontainerId = getContainerIdFromPayloadResponse(containerResponse);\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, \"2\"));\n\t\t\t\tcontainerId = await container.attach();\n\n\t\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\t\tawait timeoutPromise((resolve) => container.once(\"connected\", () => resolve()), {\n\t\t\t\t\t\tdurationMs: connectTimeoutMs,\n\t\t\t\t\t\terrorMsg: \"container connect() timeout\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst versions = await client.getContainerVersions(containerId);\n\t\t\tassert.notStrictEqual(versions.length, 0, \"There should be at least one version\");\n\t\t\tconst viewContainerVersionAttempt = client.viewContainerVersion(\n\t\t\t\tcontainerId,\n\t\t\t\tschema,\n\t\t\t\tversions[0],\n\t\t\t\t\"2\",\n\t\t\t);\n\t\t\tawait assert.doesNotReject(viewContainerVersionAttempt);\n\t\t\tconst { container: containerView } = await viewContainerVersionAttempt;\n\t\t\tassert.notStrictEqual(containerView.initialObjects.map1, undefined);\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client observes correct DDS values when viewing version.\n\t\t *\n\t\t * Expected behavior: DDS values should reflect their values from the version.\n\t\t */\n\t\tit(\"has correct DDS values when viewing container version\", async () => {\n\t\t\tlet containerId: string;\n\t\t\tlet container: IFluidContainer;\n\t\t\tlet valueAtCreate: string | undefined = \"expected-value\";\n\t\t\tlet map1: SharedMap;\n\t\t\tconst testKey = \"new-key\";\n\t\t\tconst expectedValue = \"expected-value\";\n\t\t\tif (isEphemeral) {\n\t\t\t\tconst containerResponse: AxiosResponse | undefined = await createContainerFromPayload(\n\t\t\t\t\tephemeralSummaryTrees.copyDDSValuesWhenCopyingContainer,\n\t\t\t\t\t\"test-user-id-1\",\n\t\t\t\t\t\"test-user-name-1\",\n\t\t\t\t);\n\t\t\t\tcontainerId = getContainerIdFromPayloadResponse(containerResponse);\n\t\t\t\t({ container } = await client.getContainer(containerId, schema, \"2\"));\n\t\t\t\tmap1 = container.initialObjects.map1 as SharedMap;\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, \"2\"));\n\n\t\t\t\tmap1 = container.initialObjects.map1 as SharedMap;\n\t\t\t\tmap1.set(testKey, expectedValue);\n\t\t\t\tvalueAtCreate = map1.get(testKey);\n\n\t\t\t\tcontainerId = await container.attach();\n\t\t\t}\n\n\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\tawait timeoutPromise((resolve) => container.once(\"connected\", () => resolve()), {\n\t\t\t\t\tdurationMs: connectTimeoutMs,\n\t\t\t\t\terrorMsg: \"container connect() timeout\",\n\t\t\t\t});\n\t\t\t}\n\t\t\t// Set a new value to the map - we do not expect to see this when loading the older version\n\t\t\tmap1.set(testKey, \"some-newer-value\");\n\n\t\t\tconst versions = await client.getContainerVersions(containerId);\n\t\t\tassert.notStrictEqual(versions.length, 0, \"There should be at least one version\");\n\t\t\t// Get the oldest version, which we expect is the version from attach and should still have the old value.\n\t\t\tconst viewContainerVersionAttempt = client.viewContainerVersion(\n\t\t\t\tcontainerId,\n\t\t\t\tschema,\n\t\t\t\tversions[versions.length - 1],\n\t\t\t\t\"2\",\n\t\t\t);\n\t\t\tawait assert.doesNotReject(viewContainerVersionAttempt);\n\t\t\tconst { container: containerView } = await viewContainerVersionAttempt;\n\t\t\tassert.strictEqual(containerView.initialObjects.map1.get(testKey), valueAtCreate);\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can handle non-existing container when trying to view a version\n\t\t *\n\t\t * Expected behavior: client should throw an error.\n\t\t */\n\t\tit(\"can handle non-existing container\", async () => {\n\t\t\tconst resources = client.viewContainerVersion(\n\t\t\t\t\"badidonviewversion\",\n\t\t\t\tschema,\n\t\t\t\t{\n\t\t\t\t\tid: \"whatever\",\n\t\t\t\t},\n\t\t\t\t\"2\",\n\t\t\t);\n\t\t\tconst errorFn = (error: Error): boolean => {\n\t\t\t\tassert.notStrictEqual(error.message, undefined, \"Azure Client error is undefined\");\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\terror.message,\n\t\t\t\t\t\"R11s fetch error: Document is deleted and cannot be accessed.\",\n\t\t\t\t\t`Unexpected error: ${error.message}`,\n\t\t\t\t);\n\t\t\t\treturn true;\n\t\t\t};\n\n\t\t\tawait assert.rejects(resources, errorFn, \"We should not be able to view the container.\");\n\t\t});\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"viewContainerVersion.spec.js","sourceRoot":"","sources":["../../src/test/viewContainerVersion.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,M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,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;YAClD,MAAM,SAAS,GAAG,MAAM,CAAC,oBAAoB,CAC5C,oBAAoB,EACpB,MAAM,EACN;gBACC,EAAE,EAAE,UAAU;aACd,EACD,GAAG,CACH,CAAC;YACF,MAAM,OAAO,GAAG,CAAC,KAAY,EAAW,EAAE;gBACzC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,iCAAiC,CAAC,CAAC;gBACnF,MAAM,CAAC,WAAW,CACjB,KAAK,CAAC,OAAO,EACb,+DAA+D,EAC/D,qBAAqB,KAAK,CAAC,OAAO,EAAE,CACpC,CAAC;gBACF,OAAO,IAAI,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,8CAA8C,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;IACJ,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 { strict as assert } from \"node:assert\";\n\nimport type { AzureClient } from \"@fluidframework/azure-client\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport type { ContainerSchema, IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { SharedMap } from \"@fluidframework/map/legacy\";\nimport { timeoutPromise } from \"@fluidframework/test-utils/internal\";\n\nimport {\n\tcreateAzureClient,\n\tcreateContainerFromPayload,\n\tgetContainerIdFromPayloadResponse,\n} from \"./AzureClientFactory.js\";\nimport * as ephemeralSummaryTrees from \"./ephemeralSummaryTrees.js\";\nimport { getTestMatrix } from \"./utils.js\";\n\nconst testMatrix = getTestMatrix();\nfor (const testOpts of testMatrix) {\n\tdescribe(`viewContainerVersion scenarios (${testOpts.variant})`, () => {\n\t\tconst isEphemeral: boolean = testOpts.options.isEphemeral;\n\t\tconst connectTimeoutMs = 10_000;\n\t\tlet client: AzureClient;\n\t\tconst schema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap1: SharedMap,\n\t\t\t},\n\t\t} satisfies ContainerSchema;\n\n\t\tbeforeEach(\"createAzureClient\", () => {\n\t\t\tclient = createAzureClient();\n\t\t});\n\n\t\tbeforeEach(\"skipForNonAzure\", async function () {\n\t\t\tif (process.env.FLUID_CLIENT !== \"azure\") {\n\t\t\t\tthis.skip();\n\t\t\t}\n\t\t});\n\n\t\tbeforeEach(\"skipForEphemeral\", async function () {\n\t\t\tif (isEphemeral) {\n\t\t\t\tthis.skip();\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can provide versions of the container.\n\t\t *\n\t\t * Expected behavior: an error should not be thrown nor should a rejected promise\n\t\t * be returned. Upon creation, we should recieve back 1 version of the container.\n\t\t */\n\t\tit(\"can get versions of current document\", async () => {\n\t\t\tlet containerId: string;\n\t\t\tlet container: IFluidContainer;\n\t\t\tif (isEphemeral) {\n\t\t\t\tconst containerResponse = await createContainerFromPayload(\n\t\t\t\t\tephemeralSummaryTrees.getVersionsOfCurrentDocument,\n\t\t\t\t\t\"test-user-id-1\",\n\t\t\t\t\t\"test-user-name-1\",\n\t\t\t\t);\n\t\t\t\tcontainerId = getContainerIdFromPayloadResponse(containerResponse);\n\t\t\t\t({ container } = await client.getContainer(containerId, schema, \"2\"));\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, \"2\"));\n\t\t\t\tcontainerId = await container.attach();\n\t\t\t}\n\n\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\tawait timeoutPromise((resolve) => container.once(\"connected\", () => resolve()), {\n\t\t\t\t\tdurationMs: connectTimeoutMs,\n\t\t\t\t\terrorMsg: \"container connect() timeout\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst resources = client.getContainerVersions(containerId);\n\t\t\tawait assert.doesNotReject(\n\t\t\t\tresources,\n\t\t\t\t() => true,\n\t\t\t\t\"could not get versions of the container\",\n\t\t\t);\n\n\t\t\tconst versions = await resources;\n\t\t\tassert.strictEqual(versions.length, 1, \"Container should have exactly one version.\");\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can handle bad document ID when versions are requested.\n\t\t *\n\t\t * Expected behavior: Client should throw an error.\n\t\t */\n\t\tit(\"can handle bad document id when requesting versions\", async () => {\n\t\t\tconst resources = client.getContainerVersions(\"badid\");\n\t\t\tconst errorFn = (error: Error): boolean => {\n\t\t\t\tassert.notStrictEqual(error.message, undefined, \"Azure Client error is undefined\");\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\terror.message,\n\t\t\t\t\t\"R11s fetch error: Document is deleted and cannot be accessed.\",\n\t\t\t\t\t`Unexpected error: ${error.message}`,\n\t\t\t\t);\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\tawait assert.rejects(\n\t\t\t\tresources,\n\t\t\t\terrorFn,\n\t\t\t\t\"We should not be able to get container versions.\",\n\t\t\t);\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can retrieve a specified version of a container.\n\t\t *\n\t\t * Expected behavior: an error should not be thrown nor should a rejected promise\n\t\t * be returned.\n\t\t */\n\t\tit(\"can view container version successfully\", async () => {\n\t\t\tlet containerId: string;\n\t\t\tlet container: IFluidContainer;\n\t\t\tif (isEphemeral) {\n\t\t\t\tconst containerResponse = await createContainerFromPayload(\n\t\t\t\t\tephemeralSummaryTrees.copyDocumentSuccessfully,\n\t\t\t\t\t\"test-user-id-1\",\n\t\t\t\t\t\"test-user-name-1\",\n\t\t\t\t);\n\t\t\t\tcontainerId = getContainerIdFromPayloadResponse(containerResponse);\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, \"2\"));\n\t\t\t\tcontainerId = await container.attach();\n\n\t\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\t\tawait timeoutPromise((resolve) => container.once(\"connected\", () => resolve()), {\n\t\t\t\t\t\tdurationMs: connectTimeoutMs,\n\t\t\t\t\t\terrorMsg: \"container connect() timeout\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst versions = await client.getContainerVersions(containerId);\n\t\t\tassert.notStrictEqual(versions.length, 0, \"There should be at least one version\");\n\t\t\tconst viewContainerVersionAttempt = client.viewContainerVersion(\n\t\t\t\tcontainerId,\n\t\t\t\tschema,\n\t\t\t\tversions[0],\n\t\t\t\t\"2\",\n\t\t\t);\n\t\t\tawait assert.doesNotReject(viewContainerVersionAttempt);\n\t\t\tconst { container: containerView } = await viewContainerVersionAttempt;\n\t\t\tassert.notStrictEqual(containerView.initialObjects.map1, undefined);\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client observes correct DDS values when viewing version.\n\t\t *\n\t\t * Expected behavior: DDS values should reflect their values from the version.\n\t\t */\n\t\tit(\"has correct DDS values when viewing container version\", async () => {\n\t\t\tlet containerId: string;\n\t\t\tlet container: IFluidContainer;\n\t\t\tlet valueAtCreate: string | undefined = \"expected-value\";\n\t\t\tlet map1: SharedMap;\n\t\t\tconst testKey = \"new-key\";\n\t\t\tconst expectedValue = \"expected-value\";\n\t\t\tif (isEphemeral) {\n\t\t\t\tconst containerResponse = await createContainerFromPayload(\n\t\t\t\t\tephemeralSummaryTrees.copyDDSValuesWhenCopyingContainer,\n\t\t\t\t\t\"test-user-id-1\",\n\t\t\t\t\t\"test-user-name-1\",\n\t\t\t\t);\n\t\t\t\tcontainerId = getContainerIdFromPayloadResponse(containerResponse);\n\t\t\t\t({ container } = await client.getContainer(containerId, schema, \"2\"));\n\t\t\t\tmap1 = container.initialObjects.map1 as SharedMap;\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, \"2\"));\n\n\t\t\t\tmap1 = container.initialObjects.map1 as SharedMap;\n\t\t\t\tmap1.set(testKey, expectedValue);\n\t\t\t\tvalueAtCreate = map1.get(testKey);\n\n\t\t\t\tcontainerId = await container.attach();\n\t\t\t}\n\n\t\t\tif (container.connectionState !== ConnectionState.Connected) {\n\t\t\t\tawait timeoutPromise((resolve) => container.once(\"connected\", () => resolve()), {\n\t\t\t\t\tdurationMs: connectTimeoutMs,\n\t\t\t\t\terrorMsg: \"container connect() timeout\",\n\t\t\t\t});\n\t\t\t}\n\t\t\t// Set a new value to the map - we do not expect to see this when loading the older version\n\t\t\tmap1.set(testKey, \"some-newer-value\");\n\n\t\t\tconst versions = await client.getContainerVersions(containerId);\n\t\t\tassert.notStrictEqual(versions.length, 0, \"There should be at least one version\");\n\t\t\t// Get the oldest version, which we expect is the version from attach and should still have the old value.\n\t\t\tconst viewContainerVersionAttempt = client.viewContainerVersion(\n\t\t\t\tcontainerId,\n\t\t\t\tschema,\n\t\t\t\tversions[versions.length - 1],\n\t\t\t\t\"2\",\n\t\t\t);\n\t\t\tawait assert.doesNotReject(viewContainerVersionAttempt);\n\t\t\tconst { container: containerView } = await viewContainerVersionAttempt;\n\t\t\tassert.strictEqual(containerView.initialObjects.map1.get(testKey), valueAtCreate);\n\t\t});\n\n\t\t/**\n\t\t * Scenario: test if Azure Client can handle non-existing container when trying to view a version\n\t\t *\n\t\t * Expected behavior: client should throw an error.\n\t\t */\n\t\tit(\"can handle non-existing container\", async () => {\n\t\t\tconst resources = client.viewContainerVersion(\n\t\t\t\t\"badidonviewversion\",\n\t\t\t\tschema,\n\t\t\t\t{\n\t\t\t\t\tid: \"whatever\",\n\t\t\t\t},\n\t\t\t\t\"2\",\n\t\t\t);\n\t\t\tconst errorFn = (error: Error): boolean => {\n\t\t\t\tassert.notStrictEqual(error.message, undefined, \"Azure Client error is undefined\");\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\terror.message,\n\t\t\t\t\t\"R11s fetch error: Document is deleted and cannot be accessed.\",\n\t\t\t\t\t`Unexpected error: ${error.message}`,\n\t\t\t\t);\n\t\t\t\treturn true;\n\t\t\t};\n\n\t\t\tawait assert.rejects(resources, errorFn, \"We should not be able to view the container.\");\n\t\t});\n\t});\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/azure-end-to-end-tests",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.81.0",
|
|
4
4
|
"description": "Azure client end to end tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -33,31 +33,30 @@
|
|
|
33
33
|
"temp-directory": "nyc/.nyc_output"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fluid-experimental/data-objects": "~2.
|
|
37
|
-
"@fluid-internal/client-utils": "~2.
|
|
38
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
39
|
-
"@fluid-private/test-version-utils": "~2.
|
|
40
|
-
"@fluidframework/aqueduct": "~2.
|
|
41
|
-
"@fluidframework/azure-client": "~2.
|
|
36
|
+
"@fluid-experimental/data-objects": "~2.81.0",
|
|
37
|
+
"@fluid-internal/client-utils": "~2.81.0",
|
|
38
|
+
"@fluid-internal/mocha-test-setup": "~2.81.0",
|
|
39
|
+
"@fluid-private/test-version-utils": "~2.81.0",
|
|
40
|
+
"@fluidframework/aqueduct": "~2.81.0",
|
|
41
|
+
"@fluidframework/azure-client": "~2.81.0",
|
|
42
42
|
"@fluidframework/azure-client-legacy": "npm:@fluidframework/azure-client@^1.2.0",
|
|
43
|
-
"@fluidframework/container-definitions": "~2.
|
|
44
|
-
"@fluidframework/container-loader": "~2.
|
|
45
|
-
"@fluidframework/core-interfaces": "~2.
|
|
46
|
-
"@fluidframework/counter": "~2.
|
|
47
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
48
|
-
"@fluidframework/fluid-static": "~2.
|
|
49
|
-
"@fluidframework/map": "~2.
|
|
43
|
+
"@fluidframework/container-definitions": "~2.81.0",
|
|
44
|
+
"@fluidframework/container-loader": "~2.81.0",
|
|
45
|
+
"@fluidframework/core-interfaces": "~2.81.0",
|
|
46
|
+
"@fluidframework/counter": "~2.81.0",
|
|
47
|
+
"@fluidframework/datastore-definitions": "~2.81.0",
|
|
48
|
+
"@fluidframework/fluid-static": "~2.81.0",
|
|
49
|
+
"@fluidframework/map": "~2.81.0",
|
|
50
50
|
"@fluidframework/map-legacy": "npm:@fluidframework/map@^1.4.0",
|
|
51
|
-
"@fluidframework/matrix": "~2.
|
|
52
|
-
"@fluidframework/presence": "~2.
|
|
53
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
54
|
-
"@fluidframework/sequence": "~2.
|
|
55
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
56
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
57
|
-
"@fluidframework/test-utils": "~2.
|
|
58
|
-
"@fluidframework/tree": "~2.
|
|
59
|
-
"
|
|
60
|
-
"cross-env": "^7.0.3",
|
|
51
|
+
"@fluidframework/matrix": "~2.81.0",
|
|
52
|
+
"@fluidframework/presence": "~2.81.0",
|
|
53
|
+
"@fluidframework/runtime-definitions": "~2.81.0",
|
|
54
|
+
"@fluidframework/sequence": "~2.81.0",
|
|
55
|
+
"@fluidframework/telemetry-utils": "~2.81.0",
|
|
56
|
+
"@fluidframework/test-runtime-utils": "~2.81.0",
|
|
57
|
+
"@fluidframework/test-utils": "~2.81.0",
|
|
58
|
+
"@fluidframework/tree": "~2.81.0",
|
|
59
|
+
"cross-env": "^10.1.0",
|
|
61
60
|
"mocha": "^10.8.2",
|
|
62
61
|
"mocha-multi-reporters": "^1.5.1",
|
|
63
62
|
"sinon": "^18.0.1",
|
|
@@ -68,18 +67,18 @@
|
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"@biomejs/biome": "~1.9.3",
|
|
70
69
|
"@fluidframework/build-common": "^2.0.3",
|
|
71
|
-
"@fluidframework/build-tools": "^0.
|
|
72
|
-
"@fluidframework/driver-definitions": "~2.
|
|
73
|
-
"@fluidframework/eslint-config-fluid": "~2.
|
|
70
|
+
"@fluidframework/build-tools": "^0.63.0",
|
|
71
|
+
"@fluidframework/driver-definitions": "~2.81.0",
|
|
72
|
+
"@fluidframework/eslint-config-fluid": "~2.81.0",
|
|
74
73
|
"@types/mocha": "^10.0.10",
|
|
75
74
|
"@types/nock": "^9.3.0",
|
|
76
75
|
"@types/node": "^18.19.0",
|
|
77
76
|
"@types/sinon": "^17.0.3",
|
|
78
77
|
"c8": "^10.1.3",
|
|
79
|
-
"eslint": "~
|
|
78
|
+
"eslint": "~9.39.1",
|
|
80
79
|
"jiti": "^2.6.1",
|
|
81
80
|
"nock": "^13.3.3",
|
|
82
|
-
"rimraf": "^
|
|
81
|
+
"rimraf": "^6.1.2",
|
|
83
82
|
"typescript": "~5.4.5"
|
|
84
83
|
},
|
|
85
84
|
"fluidBuild": {
|
|
@@ -27,9 +27,18 @@ import {
|
|
|
27
27
|
createMultiSinkLogger,
|
|
28
28
|
} from "@fluidframework/telemetry-utils/internal";
|
|
29
29
|
import { InsecureTokenProvider } from "@fluidframework/test-runtime-utils/internal";
|
|
30
|
-
import { default as Axios, type AxiosResponse, type AxiosRequestConfig } from "axios";
|
|
31
30
|
import { v4 as uuid } from "uuid";
|
|
32
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Response type for container creation requests.
|
|
34
|
+
* - Azure Fluid Relay (AFR) returns `{ id: string }` object
|
|
35
|
+
* - Local Tinylicious returns the container ID as a plain string
|
|
36
|
+
*/
|
|
37
|
+
interface FetchResponse {
|
|
38
|
+
status: number;
|
|
39
|
+
data: { id?: string } | string;
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
import { createAzureTokenProvider } from "./AzureTokenFactory.js";
|
|
34
43
|
|
|
35
44
|
// eslint-disable-next-line unicorn/prefer-export-from
|
|
@@ -88,7 +97,7 @@ export function createAzureClient(
|
|
|
88
97
|
}
|
|
89
98
|
: {
|
|
90
99
|
tokenProvider: new InsecureTokenProvider("fooBar", user, scopes),
|
|
91
|
-
endpoint: "http://localhost:7071",
|
|
100
|
+
endpoint: "http://localhost:7071", // Port for local Azure Fluid Relay (AFR) service
|
|
92
101
|
type: "local",
|
|
93
102
|
};
|
|
94
103
|
const getLogger = (): ITelemetryBaseLogger | undefined => {
|
|
@@ -155,7 +164,7 @@ export function createAzureClientLegacy(
|
|
|
155
164
|
}
|
|
156
165
|
: {
|
|
157
166
|
tokenProvider: new InsecureTokenProvider("fooBar", user),
|
|
158
|
-
endpoint: "http://localhost:7071",
|
|
167
|
+
endpoint: "http://localhost:7071", // Port for local Azure Fluid Relay (AFR) service
|
|
159
168
|
type: "local",
|
|
160
169
|
};
|
|
161
170
|
const getLogger = (): ITelemetryBaseLoggerLegacy | undefined => {
|
|
@@ -187,13 +196,13 @@ export function createAzureClientLegacy(
|
|
|
187
196
|
* currently these are mainly fetched from ephemeralSummaryTrees.ts
|
|
188
197
|
* @param userID - ID for the user creating the container
|
|
189
198
|
* @param userName - Name for the user creating the container
|
|
190
|
-
* @returns
|
|
199
|
+
* @returns A FetchResponse containing the container ID(response.data.id)
|
|
191
200
|
*/
|
|
192
201
|
export async function createContainerFromPayload(
|
|
193
202
|
requestPayload: object,
|
|
194
203
|
userID?: string,
|
|
195
204
|
userName?: string,
|
|
196
|
-
): Promise<
|
|
205
|
+
): Promise<FetchResponse> {
|
|
197
206
|
const useAzure = process.env.FLUID_CLIENT === "azure";
|
|
198
207
|
const tenantId = useAzure
|
|
199
208
|
? (process.env.azure__fluid__relay__service__tenantId as string)
|
|
@@ -204,7 +213,7 @@ export async function createContainerFromPayload(
|
|
|
204
213
|
};
|
|
205
214
|
const endPoint = useAzure
|
|
206
215
|
? (process.env.azure__fluid__relay__service__endpoint as string)
|
|
207
|
-
: "http://localhost:7071";
|
|
216
|
+
: "http://localhost:7071"; // Port for local Azure Fluid Relay (AFR) service
|
|
208
217
|
if (useAzure && endPoint === undefined) {
|
|
209
218
|
throw new Error("Azure Fluid Relay service endpoint is missing");
|
|
210
219
|
}
|
|
@@ -219,48 +228,57 @@ export async function createContainerFromPayload(
|
|
|
219
228
|
"Content-Type": "application/json",
|
|
220
229
|
};
|
|
221
230
|
|
|
222
|
-
const url =
|
|
223
|
-
|
|
224
|
-
const options: AxiosRequestConfig = {
|
|
225
|
-
baseURL: endPoint,
|
|
226
|
-
data: requestPayload,
|
|
227
|
-
headers,
|
|
228
|
-
maxBodyLength: 1048576000,
|
|
229
|
-
maxContentLength: 1048576000,
|
|
230
|
-
method: "POST",
|
|
231
|
-
url,
|
|
232
|
-
};
|
|
231
|
+
const url = `${endPoint}/documents/${tenantId}`;
|
|
233
232
|
|
|
234
233
|
try {
|
|
235
|
-
const response
|
|
234
|
+
const response = await fetch(url, {
|
|
235
|
+
method: "POST",
|
|
236
|
+
headers,
|
|
237
|
+
body: JSON.stringify(requestPayload),
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// Fetch doesn't auto-throw on non-2xx responses like axios did, so check explicitly
|
|
241
|
+
if (!response.ok) {
|
|
242
|
+
throw new Error(`Error creating container. Status code: ${response.status}`);
|
|
243
|
+
}
|
|
236
244
|
|
|
237
245
|
if (response.status === 201) {
|
|
238
246
|
console.log("Container created successfully");
|
|
239
|
-
} else {
|
|
240
|
-
throw new Error(`Error creating container. Status code: ${response.status}`);
|
|
241
247
|
}
|
|
242
248
|
|
|
243
|
-
|
|
244
|
-
|
|
249
|
+
const data: { id?: string } | string = (await response.json()) as { id?: string } | string;
|
|
250
|
+
|
|
251
|
+
if (
|
|
252
|
+
data === undefined ||
|
|
253
|
+
(useAzure && typeof data === "object" && data.id === undefined)
|
|
254
|
+
) {
|
|
245
255
|
throw new Error(`ID of the created container is undefined`);
|
|
246
256
|
}
|
|
247
257
|
|
|
248
|
-
return response;
|
|
258
|
+
return { status: response.status, data };
|
|
249
259
|
} catch (error) {
|
|
250
260
|
throw new Error(`An error occurred: ${error}`);
|
|
251
261
|
}
|
|
252
262
|
}
|
|
253
263
|
|
|
254
264
|
/**
|
|
255
|
-
* This function takes
|
|
265
|
+
* This function takes a FetchResponse returned by the createContainerFromPayload and returns the containerId.
|
|
256
266
|
* A separate function is used for this, since the data path to the containerID is not always the same.
|
|
257
267
|
* (Tinylicious has the ID stored at a different path than other services)
|
|
258
268
|
*
|
|
259
269
|
* @param response - A container creation response returned by createContainerFromPayload
|
|
260
270
|
* @returns The ID of the container that was created by createContainerFromPayload
|
|
261
271
|
*/
|
|
262
|
-
export function getContainerIdFromPayloadResponse(response:
|
|
272
|
+
export function getContainerIdFromPayloadResponse(response: FetchResponse): string {
|
|
263
273
|
const useAzure = process.env.FLUID_CLIENT === "azure";
|
|
264
|
-
|
|
265
|
-
|
|
274
|
+
if (useAzure) {
|
|
275
|
+
if (typeof response.data === "object" && response.data.id !== undefined) {
|
|
276
|
+
return response.data.id;
|
|
277
|
+
}
|
|
278
|
+
throw new Error("Invalid response format for Azure");
|
|
279
|
+
}
|
|
280
|
+
if (typeof response.data === "string") {
|
|
281
|
+
return response.data;
|
|
282
|
+
}
|
|
283
|
+
throw new Error("Invalid response format for local");
|
|
266
284
|
}
|
|
@@ -11,7 +11,6 @@ import { ConnectionState } from "@fluidframework/container-loader";
|
|
|
11
11
|
import type { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
|
|
12
12
|
import { SharedMap } from "@fluidframework/map/legacy";
|
|
13
13
|
import { timeoutPromise } from "@fluidframework/test-utils/internal";
|
|
14
|
-
import type { AxiosResponse } from "axios";
|
|
15
14
|
|
|
16
15
|
import {
|
|
17
16
|
createAzureClient,
|
|
@@ -49,7 +48,7 @@ for (const testOpts of testMatrix) {
|
|
|
49
48
|
let container: IFluidContainer;
|
|
50
49
|
let services: AzureContainerServices;
|
|
51
50
|
if (isEphemeral) {
|
|
52
|
-
const containerResponse
|
|
51
|
+
const containerResponse = await createContainerFromPayload(
|
|
53
52
|
ephemeralSummaryTrees.findOriginalMember,
|
|
54
53
|
"test-user-id-1",
|
|
55
54
|
"test-user-name-1",
|
|
@@ -94,7 +93,7 @@ for (const testOpts of testMatrix) {
|
|
|
94
93
|
let container: IFluidContainer;
|
|
95
94
|
let services: AzureContainerServices;
|
|
96
95
|
if (isEphemeral) {
|
|
97
|
-
const containerResponse
|
|
96
|
+
const containerResponse = await createContainerFromPayload(
|
|
98
97
|
ephemeralSummaryTrees.findPartnerMember,
|
|
99
98
|
"test-user-id-1",
|
|
100
99
|
"test-user-name-1",
|
|
@@ -158,7 +157,7 @@ for (const testOpts of testMatrix) {
|
|
|
158
157
|
let containerId: string;
|
|
159
158
|
let container: IFluidContainer;
|
|
160
159
|
if (isEphemeral) {
|
|
161
|
-
const containerResponse
|
|
160
|
+
const containerResponse = await createContainerFromPayload(
|
|
162
161
|
ephemeralSummaryTrees.observeMemberLeaving,
|
|
163
162
|
"test-user-id-1",
|
|
164
163
|
"test-user-name-1",
|
|
@@ -217,7 +216,7 @@ for (const testOpts of testMatrix) {
|
|
|
217
216
|
let container: IFluidContainer;
|
|
218
217
|
let services: AzureContainerServices;
|
|
219
218
|
if (isEphemeral) {
|
|
220
|
-
const containerResponse
|
|
219
|
+
const containerResponse = await createContainerFromPayload(
|
|
221
220
|
ephemeralSummaryTrees.observeMemberLeaving,
|
|
222
221
|
"test-user-id-1",
|
|
223
222
|
"test-user-name-1",
|
|
@@ -326,7 +325,7 @@ for (const testOpts of testMatrix) {
|
|
|
326
325
|
let containerId: string;
|
|
327
326
|
let container: IFluidContainer;
|
|
328
327
|
if (isEphemeral) {
|
|
329
|
-
const containerResponse
|
|
328
|
+
const containerResponse = await createContainerFromPayload(
|
|
330
329
|
ephemeralSummaryTrees.observeMemberLeaving,
|
|
331
330
|
"test-user-id-1",
|
|
332
331
|
"test-user-name-1",
|
|
@@ -26,7 +26,6 @@ import { SharedMap as SharedMapLegacy } from "@fluidframework/map-legacy";
|
|
|
26
26
|
import { MockLogger, UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
27
27
|
import { timeoutPromise } from "@fluidframework/test-utils/internal";
|
|
28
28
|
import { SharedTree } from "@fluidframework/tree/legacy";
|
|
29
|
-
import type { AxiosResponse } from "axios";
|
|
30
29
|
import type { SinonSandbox } from "sinon";
|
|
31
30
|
import { createSandbox } from "sinon";
|
|
32
31
|
|
|
@@ -96,7 +95,7 @@ for (const testOpts of testMatrix) {
|
|
|
96
95
|
let containerId: string;
|
|
97
96
|
let container: IFluidContainer;
|
|
98
97
|
if (isEphemeral) {
|
|
99
|
-
const containerResponse
|
|
98
|
+
const containerResponse = await createContainerFromPayload(
|
|
100
99
|
ephemeralSummaryTrees.canAttachContainer,
|
|
101
100
|
"test-user-id-1",
|
|
102
101
|
"test-user-name-1",
|
|
@@ -133,7 +132,7 @@ for (const testOpts of testMatrix) {
|
|
|
133
132
|
let containerId: string;
|
|
134
133
|
let container: IFluidContainer;
|
|
135
134
|
if (isEphemeral) {
|
|
136
|
-
const containerResponse
|
|
135
|
+
const containerResponse = await createContainerFromPayload(
|
|
137
136
|
ephemeralSummaryTrees.cannotAttachContainerTwice,
|
|
138
137
|
"test-user-id-1",
|
|
139
138
|
"test-user-name-1",
|
|
@@ -175,7 +174,7 @@ for (const testOpts of testMatrix) {
|
|
|
175
174
|
let containerId: string;
|
|
176
175
|
let newContainer: IFluidContainer;
|
|
177
176
|
if (isEphemeral) {
|
|
178
|
-
const containerResponse
|
|
177
|
+
const containerResponse = await createContainerFromPayload(
|
|
179
178
|
ephemeralSummaryTrees.retrieveExistingAFRContainer,
|
|
180
179
|
"test-user-id-1",
|
|
181
180
|
"test-user-name-1",
|
|
@@ -11,7 +11,6 @@ import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
11
11
|
import type { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
|
|
12
12
|
import { type ISharedMap, SharedMap } from "@fluidframework/map/legacy";
|
|
13
13
|
import { timeoutPromise } from "@fluidframework/test-utils/internal";
|
|
14
|
-
import type { AxiosResponse } from "axios";
|
|
15
14
|
|
|
16
15
|
import {
|
|
17
16
|
createAzureClient,
|
|
@@ -49,7 +48,7 @@ for (const testOpts of testMatrix) {
|
|
|
49
48
|
let containerId: string;
|
|
50
49
|
let newContainer: IFluidContainer;
|
|
51
50
|
if (isEphemeral) {
|
|
52
|
-
const containerResponse
|
|
51
|
+
const containerResponse = await createContainerFromPayload(
|
|
53
52
|
ephemeralSummaryTrees.setDDSesAsInitialObjectsForContainer,
|
|
54
53
|
"test-user-id-1",
|
|
55
54
|
"test-user-name-1",
|
|
@@ -92,7 +91,7 @@ for (const testOpts of testMatrix) {
|
|
|
92
91
|
let containerId: string;
|
|
93
92
|
let container: IFluidContainer;
|
|
94
93
|
if (isEphemeral) {
|
|
95
|
-
const containerResponse
|
|
94
|
+
const containerResponse = await createContainerFromPayload(
|
|
96
95
|
ephemeralSummaryTrees.changeDDSesWithinInitialObjectsValue,
|
|
97
96
|
"test-user-id-1",
|
|
98
97
|
"test-user-name-1",
|
|
@@ -137,7 +136,7 @@ for (const testOpts of testMatrix) {
|
|
|
137
136
|
let containerId: string;
|
|
138
137
|
let container: IFluidContainer;
|
|
139
138
|
if (isEphemeral) {
|
|
140
|
-
const containerResponse
|
|
139
|
+
const containerResponse = await createContainerFromPayload(
|
|
141
140
|
ephemeralSummaryTrees.setDataObjectsAsInitialObjectsForContainer,
|
|
142
141
|
"test-user-id-1",
|
|
143
142
|
"test-user-name-1",
|
|
@@ -200,7 +199,7 @@ for (const testOpts of testMatrix) {
|
|
|
200
199
|
let containerId: string;
|
|
201
200
|
let container: IFluidContainer;
|
|
202
201
|
if (isEphemeral) {
|
|
203
|
-
const containerResponse
|
|
202
|
+
const containerResponse = await createContainerFromPayload(
|
|
204
203
|
ephemeralSummaryTrees.useMultipleDataObjectsOfSameType,
|
|
205
204
|
"test-user-id-1",
|
|
206
205
|
"test-user-name-1",
|
|
@@ -268,7 +267,7 @@ for (const testOpts of testMatrix) {
|
|
|
268
267
|
let containerId: string;
|
|
269
268
|
let container: IFluidContainer;
|
|
270
269
|
if (isEphemeral) {
|
|
271
|
-
const containerResponse
|
|
270
|
+
const containerResponse = await createContainerFromPayload(
|
|
272
271
|
ephemeralSummaryTrees.changeDataObjectsWithinInitialObjectsValue,
|
|
273
272
|
"test-user-id-1",
|
|
274
273
|
"test-user-name-1",
|
|
@@ -328,7 +327,7 @@ for (const testOpts of testMatrix) {
|
|
|
328
327
|
let containerId: string;
|
|
329
328
|
let container: IFluidContainer;
|
|
330
329
|
if (isEphemeral) {
|
|
331
|
-
const containerResponse
|
|
330
|
+
const containerResponse = await createContainerFromPayload(
|
|
332
331
|
ephemeralSummaryTrees.createAddLoadableObjectsDynamically,
|
|
333
332
|
"test-user-id-1",
|
|
334
333
|
"test-user-name-1",
|
|
@@ -130,6 +130,16 @@ const getOrCreateContainer = async (params: {
|
|
|
130
130
|
const client = new AzureClient({
|
|
131
131
|
connection: connectionProps,
|
|
132
132
|
logger,
|
|
133
|
+
configProvider: {
|
|
134
|
+
getRawConfig: (v: string) => {
|
|
135
|
+
// At higher client counts, summarizer will get invoked, taking up resources
|
|
136
|
+
// and spewing telemetry. None of current tests need summarization, so disable it.
|
|
137
|
+
if (v === "Fluid.ContainerRuntime.Test.DisableSummaries") {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
},
|
|
142
|
+
},
|
|
133
143
|
});
|
|
134
144
|
let services: AzureContainerServices;
|
|
135
145
|
if (containerId === undefined) {
|
|
@@ -334,16 +344,15 @@ class MessageHandler {
|
|
|
334
344
|
if (latestMap && !workspace.states.latestMap) {
|
|
335
345
|
workspace.add(
|
|
336
346
|
"latestMap",
|
|
337
|
-
StateFactory.latestMap<{ value: Record<string, string | number> }
|
|
347
|
+
StateFactory.latestMap<{ value: Record<string, string | number> }>({
|
|
338
348
|
local: {},
|
|
339
349
|
}),
|
|
340
350
|
);
|
|
341
351
|
// Cast required due to optional keys in WorkspaceSchema
|
|
342
352
|
// TODO: AB#47518
|
|
343
|
-
const latestMapState = workspace.states.latestMap as LatestMapRaw<
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
>;
|
|
353
|
+
const latestMapState = workspace.states.latestMap as LatestMapRaw<{
|
|
354
|
+
value: Record<string, string | number>;
|
|
355
|
+
}>;
|
|
347
356
|
latestMapState.events.on("remoteUpdated", (update) => {
|
|
348
357
|
for (const [key, valueWithMetadata] of update.items) {
|
|
349
358
|
this.send({
|
|
@@ -614,7 +623,7 @@ class MessageHandler {
|
|
|
614
623
|
// Cast required due to optional keys in WorkspaceSchema
|
|
615
624
|
// TODO: AB#47518
|
|
616
625
|
const latestMapState = workspace.states.latestMap as
|
|
617
|
-
| LatestMapRaw<{ value: Record<string, string | number> }
|
|
626
|
+
| LatestMapRaw<{ value: Record<string, string | number> }>
|
|
618
627
|
| undefined;
|
|
619
628
|
if (!latestMapState) {
|
|
620
629
|
this.send({
|
|
@@ -692,7 +701,7 @@ class MessageHandler {
|
|
|
692
701
|
// Cast required due to optional keys in WorkspaceSchema
|
|
693
702
|
// TODO: AB#47518
|
|
694
703
|
const latestMapState = workspace.states.latestMap as
|
|
695
|
-
| LatestMapRaw<{ value: Record<string, string | number> }
|
|
704
|
+
| LatestMapRaw<{ value: Record<string, string | number> }>
|
|
696
705
|
| undefined;
|
|
697
706
|
if (!latestMapState) {
|
|
698
707
|
this.send({
|
package/src/test/signals.spec.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { AttachState } from "@fluidframework/container-definitions";
|
|
|
10
10
|
import { ConnectionState } from "@fluidframework/container-loader";
|
|
11
11
|
import type { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
|
|
12
12
|
import { timeoutPromise } from "@fluidframework/test-utils/internal";
|
|
13
|
-
import type { AxiosResponse } from "axios";
|
|
14
13
|
|
|
15
14
|
import {
|
|
16
15
|
createAzureClient,
|
|
@@ -103,12 +102,11 @@ for (const testOpts of testMatrix) {
|
|
|
103
102
|
let containerId: string;
|
|
104
103
|
if (id === undefined) {
|
|
105
104
|
if (isEphemeral) {
|
|
106
|
-
const containerResponse
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
105
|
+
const containerResponse = await createContainerFromPayload(
|
|
106
|
+
ephemeralSummaryTrees.sendAndRecieveSignals,
|
|
107
|
+
"test-user-id-1",
|
|
108
|
+
"test-user-name-1",
|
|
109
|
+
);
|
|
112
110
|
containerId = getContainerIdFromPayloadResponse(containerResponse);
|
|
113
111
|
({ container, services } = await client.getContainer(containerId, schema, "2"));
|
|
114
112
|
} else {
|
package/src/test/tree.spec.ts
CHANGED
|
@@ -13,7 +13,6 @@ import type { Revertible, TreeView, ValidateRecursiveSchema } from "@fluidframew
|
|
|
13
13
|
import { SchemaFactory, Tree, TreeStatus, TreeViewConfiguration } from "@fluidframework/tree";
|
|
14
14
|
import { allowUnused, asAlpha } from "@fluidframework/tree/alpha";
|
|
15
15
|
import { SharedTree } from "@fluidframework/tree/legacy";
|
|
16
|
-
import type { AxiosResponse } from "axios";
|
|
17
16
|
|
|
18
17
|
import {
|
|
19
18
|
createAzureClient,
|
|
@@ -94,7 +93,7 @@ for (const testOpts of testMatrix) {
|
|
|
94
93
|
containerId = await container.attach();
|
|
95
94
|
await waitForConnection(container);
|
|
96
95
|
} else {
|
|
97
|
-
const containerResponse
|
|
96
|
+
const containerResponse = await createContainerFromPayload(
|
|
98
97
|
summaryTree,
|
|
99
98
|
"test-user-id-1",
|
|
100
99
|
"test-user-name-1",
|
|
@@ -294,7 +293,6 @@ for (const testOpts of testMatrix) {
|
|
|
294
293
|
|
|
295
294
|
it("can listen to events on a recursive tree", async () => {
|
|
296
295
|
class Doll extends sf.objectRecursive("Matryoshka", {
|
|
297
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
298
296
|
nested: sf.optionalRecursive([() => Doll]),
|
|
299
297
|
}) {}
|
|
300
298
|
allowUnused<ValidateRecursiveSchema<typeof Doll>>();
|
|
@@ -10,7 +10,6 @@ import { ConnectionState } from "@fluidframework/container-loader";
|
|
|
10
10
|
import type { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
|
|
11
11
|
import { SharedMap } from "@fluidframework/map/legacy";
|
|
12
12
|
import { timeoutPromise } from "@fluidframework/test-utils/internal";
|
|
13
|
-
import type { AxiosResponse } from "axios";
|
|
14
13
|
|
|
15
14
|
import {
|
|
16
15
|
createAzureClient,
|
|
@@ -58,7 +57,7 @@ for (const testOpts of testMatrix) {
|
|
|
58
57
|
let containerId: string;
|
|
59
58
|
let container: IFluidContainer;
|
|
60
59
|
if (isEphemeral) {
|
|
61
|
-
const containerResponse
|
|
60
|
+
const containerResponse = await createContainerFromPayload(
|
|
62
61
|
ephemeralSummaryTrees.getVersionsOfCurrentDocument,
|
|
63
62
|
"test-user-id-1",
|
|
64
63
|
"test-user-name-1",
|
|
@@ -120,7 +119,7 @@ for (const testOpts of testMatrix) {
|
|
|
120
119
|
let containerId: string;
|
|
121
120
|
let container: IFluidContainer;
|
|
122
121
|
if (isEphemeral) {
|
|
123
|
-
const containerResponse
|
|
122
|
+
const containerResponse = await createContainerFromPayload(
|
|
124
123
|
ephemeralSummaryTrees.copyDocumentSuccessfully,
|
|
125
124
|
"test-user-id-1",
|
|
126
125
|
"test-user-name-1",
|
|
@@ -164,7 +163,7 @@ for (const testOpts of testMatrix) {
|
|
|
164
163
|
const testKey = "new-key";
|
|
165
164
|
const expectedValue = "expected-value";
|
|
166
165
|
if (isEphemeral) {
|
|
167
|
-
const containerResponse
|
|
166
|
+
const containerResponse = await createContainerFromPayload(
|
|
168
167
|
ephemeralSummaryTrees.copyDDSValuesWhenCopyingContainer,
|
|
169
168
|
"test-user-id-1",
|
|
170
169
|
"test-user-name-1",
|