@fluidframework/azure-end-to-end-tests 2.101.1 → 2.103.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/eslint.config.mts +4 -0
  3. package/lib/packageVersion.js +9 -0
  4. package/lib/packageVersion.js.map +1 -0
  5. package/lib/test/AzureClientFactory.js.map +1 -1
  6. package/lib/test/audience.spec.js +16 -16
  7. package/lib/test/audience.spec.js.map +1 -1
  8. package/lib/test/containerCreate.spec.js +27 -24
  9. package/lib/test/containerCreate.spec.js.map +1 -1
  10. package/lib/test/ddsTests.spec.js +17 -17
  11. package/lib/test/ddsTests.spec.js.map +1 -1
  12. package/lib/test/multiprocess/childClient.tool.js +3 -2
  13. package/lib/test/multiprocess/childClient.tool.js.map +1 -1
  14. package/lib/test/signals.spec.js +4 -4
  15. package/lib/test/signals.spec.js.map +1 -1
  16. package/lib/test/tree.spec.js +8 -8
  17. package/lib/test/tree.spec.js.map +1 -1
  18. package/lib/test/utils.js +3 -0
  19. package/lib/test/utils.js.map +1 -1
  20. package/lib/test/viewContainerVersion.spec.js +9 -9
  21. package/lib/test/viewContainerVersion.spec.js.map +1 -1
  22. package/package.json +29 -27
  23. package/src/packageVersion.ts +9 -0
  24. package/src/test/.mocharc.js +15 -0
  25. package/src/test/AzureClientFactory.ts +4 -3
  26. package/src/test/audience.spec.ts +36 -16
  27. package/src/test/containerCreate.spec.ts +31 -24
  28. package/src/test/ddsTests.spec.ts +29 -17
  29. package/src/test/multiprocess/childClient.tool.ts +7 -2
  30. package/src/test/signals.spec.ts +12 -4
  31. package/src/test/tree.spec.ts +8 -8
  32. package/src/test/tsconfig.json +6 -3
  33. package/src/test/utils.ts +4 -0
  34. package/src/test/viewContainerVersion.spec.ts +9 -9
  35. package/src/test/.mocharc.cjs +0 -11
@@ -8,7 +8,7 @@ import { SharedMap } from "@fluidframework/map/legacy";
8
8
  import { timeoutPromise } from "@fluidframework/test-utils/internal";
9
9
  import { createAzureClient, createContainerFromPayload, getContainerIdFromPayloadResponse, } from "./AzureClientFactory.js";
10
10
  import * as ephemeralSummaryTrees from "./ephemeralSummaryTrees.js";
11
- import { getTestMatrix } from "./utils.js";
11
+ import { getTestMatrix, currentVersion } from "./utils.js";
12
12
  const testMatrix = getTestMatrix();
13
13
  for (const testOpts of testMatrix) {
14
14
  describe(`viewContainerVersion scenarios (${testOpts.variant})`, () => {
@@ -45,10 +45,10 @@ for (const testOpts of testMatrix) {
45
45
  if (isEphemeral) {
46
46
  const containerResponse = await createContainerFromPayload(ephemeralSummaryTrees.getVersionsOfCurrentDocument, "test-user-id-1", "test-user-name-1");
47
47
  containerId = getContainerIdFromPayloadResponse(containerResponse);
48
- ({ container } = await client.getContainer(containerId, schema, "2"));
48
+ ({ container } = await client.getContainer(containerId, schema, currentVersion));
49
49
  }
50
50
  else {
51
- ({ container } = await client.createContainer(schema, "2"));
51
+ ({ container } = await client.createContainer(schema, currentVersion));
52
52
  containerId = await container.attach();
53
53
  }
54
54
  if (container.connectionState !== ConnectionState.Connected) {
@@ -90,7 +90,7 @@ for (const testOpts of testMatrix) {
90
90
  containerId = getContainerIdFromPayloadResponse(containerResponse);
91
91
  }
92
92
  else {
93
- ({ container } = await client.createContainer(schema, "2"));
93
+ ({ container } = await client.createContainer(schema, currentVersion));
94
94
  containerId = await container.attach();
95
95
  if (container.connectionState !== ConnectionState.Connected) {
96
96
  await timeoutPromise((resolve) => container.once("connected", () => resolve()), {
@@ -101,7 +101,7 @@ for (const testOpts of testMatrix) {
101
101
  }
102
102
  const versions = await client.getContainerVersions(containerId);
103
103
  assert.notStrictEqual(versions.length, 0, "There should be at least one version");
104
- const viewContainerVersionAttempt = client.viewContainerVersion(containerId, schema, versions[0], "2");
104
+ const viewContainerVersionAttempt = client.viewContainerVersion(containerId, schema, versions[0], currentVersion);
105
105
  await assert.doesNotReject(viewContainerVersionAttempt);
106
106
  const { container: containerView } = await viewContainerVersionAttempt;
107
107
  assert.notStrictEqual(containerView.initialObjects.map1, undefined);
@@ -121,11 +121,11 @@ for (const testOpts of testMatrix) {
121
121
  if (isEphemeral) {
122
122
  const containerResponse = await createContainerFromPayload(ephemeralSummaryTrees.copyDDSValuesWhenCopyingContainer, "test-user-id-1", "test-user-name-1");
123
123
  containerId = getContainerIdFromPayloadResponse(containerResponse);
124
- ({ container } = await client.getContainer(containerId, schema, "2"));
124
+ ({ container } = await client.getContainer(containerId, schema, currentVersion));
125
125
  map1 = container.initialObjects.map1;
126
126
  }
127
127
  else {
128
- ({ container } = await client.createContainer(schema, "2"));
128
+ ({ container } = await client.createContainer(schema, currentVersion));
129
129
  map1 = container.initialObjects.map1;
130
130
  map1.set(testKey, expectedValue);
131
131
  valueAtCreate = map1.get(testKey);
@@ -142,7 +142,7 @@ for (const testOpts of testMatrix) {
142
142
  const versions = await client.getContainerVersions(containerId);
143
143
  assert.notStrictEqual(versions.length, 0, "There should be at least one version");
144
144
  // Get the oldest version, which we expect is the version from attach and should still have the old value.
145
- const viewContainerVersionAttempt = client.viewContainerVersion(containerId, schema, versions[versions.length - 1], "2");
145
+ const viewContainerVersionAttempt = client.viewContainerVersion(containerId, schema, versions[versions.length - 1], currentVersion);
146
146
  await assert.doesNotReject(viewContainerVersionAttempt);
147
147
  const { container: containerView } = await viewContainerVersionAttempt;
148
148
  assert.strictEqual(containerView.initialObjects.map1.get(testKey), valueAtCreate);
@@ -155,7 +155,7 @@ for (const testOpts of testMatrix) {
155
155
  it("can handle non-existing container", async () => {
156
156
  const resources = client.viewContainerVersion("badidonviewversion", schema, {
157
157
  id: "whatever",
158
- }, "2");
158
+ }, currentVersion);
159
159
  const errorFn = (error) => {
160
160
  assert.notStrictEqual(error.message, undefined, "Azure Client error is undefined");
161
161
  assert.strictEqual(error.message, "R11s fetch error: Document is deleted and cannot be accessed.", `Unexpected error: ${error.message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"viewContainerVersion.spec.js","sourceRoot":"","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CAAC,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;QAEH;;;;WAIG;QACH,EAAE,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"]}
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;AAErE,OAAO,EACN,iBAAiB,EACjB,0BAA0B,EAC1B,iCAAiC,GACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;AACnC,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;IACnC,QAAQ,CAAC,mCAAmC,QAAQ,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE;QACrE,MAAM,WAAW,GAAY,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;QAC1D,MAAM,gBAAgB,GAAG,MAAM,CAAC;QAChC,IAAI,MAAmB,CAAC;QACxB,MAAM,MAAM,GAAG;YACd,cAAc,EAAE;gBACf,IAAI,EAAE,SAAS;aACf;SACyB,CAAC;QAE5B,UAAU,CAAC,mBAAmB,EAAE,GAAG,EAAE;YACpC,MAAM,GAAG,iBAAiB,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,iBAAiB,EAAE,KAAK;YAClC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,OAAO,EAAE,CAAC;gBAC1C,IAAI,CAAC,I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CAAC,CAAC,EAC7B,cAAc,CACd,CAAC;YACF,MAAM,MAAM,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC;YACxD,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM,2BAA2B,CAAC;YACvE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;QAEH;;;;WAIG;QACH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;YAClD,MAAM,SAAS,GAAG,MAAM,CAAC,oBAAoB,CAC5C,oBAAoB,EACpB,MAAM,EACN;gBACC,EAAE,EAAE,UAAU;aACd,EACD,cAAc,CACd,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, currentVersion } 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, currentVersion));\n\t\t\t} else {\n\t\t\t\t({ container } = await client.createContainer(schema, currentVersion));\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, currentVersion));\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\tcurrentVersion,\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, currentVersion));\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, currentVersion));\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\tcurrentVersion,\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\tcurrentVersion,\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.101.1",
3
+ "version": "2.103.0",
4
4
  "description": "Azure client end to end tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -33,29 +33,29 @@
33
33
  "temp-directory": "nyc/.nyc_output"
34
34
  },
35
35
  "dependencies": {
36
- "@fluid-experimental/data-objects": "~2.101.1",
37
- "@fluid-internal/client-utils": "~2.101.1",
38
- "@fluid-internal/mocha-test-setup": "~2.101.1",
39
- "@fluid-private/test-version-utils": "~2.101.1",
40
- "@fluidframework/aqueduct": "~2.101.1",
41
- "@fluidframework/azure-client": "~2.101.1",
36
+ "@fluid-experimental/data-objects": "~2.103.0",
37
+ "@fluid-internal/client-utils": "~2.103.0",
38
+ "@fluid-internal/mocha-test-setup": "~2.103.0",
39
+ "@fluid-private/test-version-utils": "~2.103.0",
40
+ "@fluidframework/aqueduct": "~2.103.0",
41
+ "@fluidframework/azure-client": "~2.103.0",
42
42
  "@fluidframework/azure-client-legacy": "npm:@fluidframework/azure-client@^1.2.0",
43
- "@fluidframework/container-definitions": "~2.101.1",
44
- "@fluidframework/container-loader": "~2.101.1",
45
- "@fluidframework/core-interfaces": "~2.101.1",
46
- "@fluidframework/counter": "~2.101.1",
47
- "@fluidframework/datastore-definitions": "~2.101.1",
48
- "@fluidframework/fluid-static": "~2.101.1",
49
- "@fluidframework/map": "~2.101.1",
43
+ "@fluidframework/container-definitions": "~2.103.0",
44
+ "@fluidframework/container-loader": "~2.103.0",
45
+ "@fluidframework/core-interfaces": "~2.103.0",
46
+ "@fluidframework/counter": "~2.103.0",
47
+ "@fluidframework/datastore-definitions": "~2.103.0",
48
+ "@fluidframework/fluid-static": "~2.103.0",
49
+ "@fluidframework/map": "~2.103.0",
50
50
  "@fluidframework/map-legacy": "npm:@fluidframework/map@^1.4.0",
51
- "@fluidframework/matrix": "~2.101.1",
52
- "@fluidframework/presence": "~2.101.1",
53
- "@fluidframework/runtime-definitions": "~2.101.1",
54
- "@fluidframework/sequence": "~2.101.1",
55
- "@fluidframework/telemetry-utils": "~2.101.1",
56
- "@fluidframework/test-runtime-utils": "~2.101.1",
57
- "@fluidframework/test-utils": "~2.101.1",
58
- "@fluidframework/tree": "~2.101.1",
51
+ "@fluidframework/matrix": "~2.103.0",
52
+ "@fluidframework/presence": "~2.103.0",
53
+ "@fluidframework/runtime-definitions": "~2.103.0",
54
+ "@fluidframework/sequence": "~2.103.0",
55
+ "@fluidframework/telemetry-utils": "~2.103.0",
56
+ "@fluidframework/test-runtime-utils": "~2.103.0",
57
+ "@fluidframework/test-utils": "~2.103.0",
58
+ "@fluidframework/tree": "~2.103.0",
59
59
  "cross-env": "^10.1.0",
60
60
  "mocha": "^11.7.5",
61
61
  "mocha-multi-reporters": "^1.5.1",
@@ -68,7 +68,7 @@
68
68
  "@biomejs/biome": "~2.4.5",
69
69
  "@fluidframework/build-common": "^2.0.3",
70
70
  "@fluidframework/build-tools": "^0.65.0",
71
- "@fluidframework/driver-definitions": "~2.101.1",
71
+ "@fluidframework/driver-definitions": "~2.103.0",
72
72
  "@fluidframework/eslint-config-fluid": "^9.0.0",
73
73
  "@types/mocha": "^10.0.10",
74
74
  "@types/nock": "^9.3.0",
@@ -83,10 +83,10 @@
83
83
  },
84
84
  "fluidBuild": {
85
85
  "tasks": {
86
- "build:test": [
86
+ "build:test:esm": [
87
87
  "^api-extractor:esnext",
88
88
  "^build:esnext",
89
- "^tsc"
89
+ "build:genver"
90
90
  ]
91
91
  }
92
92
  },
@@ -96,7 +96,9 @@
96
96
  "scripts": {
97
97
  "build": "fluid-build . --task build",
98
98
  "build:compile": "fluid-build . --task compile",
99
- "build:test": "tsc --project ./src/test/tsconfig.json",
99
+ "build:genver": "gen-version",
100
+ "build:test": "npm run build:test:esm",
101
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
100
102
  "check:biome": "biome check .",
101
103
  "check:format": "npm run check:biome",
102
104
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc",
@@ -111,7 +113,7 @@
111
113
  "test:coverage": "c8 npm test",
112
114
  "test:realsvc": "npm run test:realsvc:tinylicious",
113
115
  "test:realsvc:azure": "cross-env FLUID_CLIENT=azure npm run test:realsvc:azure:run -- --driver=r11s --r11sEndpointName=frs",
114
- "test:realsvc:azure:run": "mocha --exit --timeout 20000 --config src/test/.mocharc.cjs",
116
+ "test:realsvc:azure:run": "mocha --exit --timeout 20000 --config src/test/.mocharc.js",
115
117
  "test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7071 test:realsvc:tinylicious:run",
116
118
  "test:realsvc:tinylicious:report": "npm run test:realsvc:tinylicious",
117
119
  "test:realsvc:tinylicious:run": "npm run test:realsvc:azure:run -- --driver=t9s",
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
+ */
7
+
8
+ export const pkgName = "@fluidframework/azure-end-to-end-tests";
9
+ export const pkgVersion = "2.103.0";
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import path from "node:path";
7
+
8
+ import { getFluidTestMochaConfigWithCompat } from "@fluid-private/test-version-utils/mocharc-common";
9
+
10
+ const packageDir = path.resolve(import.meta.dirname, "../..");
11
+ const config = getFluidTestMochaConfigWithCompat(packageDir);
12
+ // mocha v12+ supports ESM config when default export is given via `export default config;`.
13
+ // Prior to that synchronous ESM can be loaded with specifically configured
14
+ // module.exports export containing the config.
15
+ export { config as "module.exports" };
@@ -20,7 +20,8 @@ import {
20
20
  import type { IRuntimeFactory } from "@fluidframework/container-definitions/legacy";
21
21
  import type { IConfigProviderBase } from "@fluidframework/core-interfaces";
22
22
  import { ScopeType } from "@fluidframework/driver-definitions/legacy";
23
- import type { CompatibilityMode, ContainerSchema } from "@fluidframework/fluid-static";
23
+ import type { ContainerSchema } from "@fluidframework/fluid-static";
24
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions";
24
25
  import {
25
26
  type MockLogger,
26
27
  createChildLogger,
@@ -56,10 +57,10 @@ export function createAzureClient(
56
57
  scopes?: ScopeType[],
57
58
  createContainerRuntimeFactory?: ({
58
59
  schema,
59
- compatibilityMode,
60
+ minVersionForCollaboration,
60
61
  }: {
61
62
  schema: ContainerSchema;
62
- compatibilityMode: CompatibilityMode;
63
+ minVersionForCollaboration: MinimumVersionForCollab;
63
64
  }) => IRuntimeFactory,
64
65
  ): AzureClient {
65
66
  const args = process.argv.slice(2);
@@ -19,7 +19,7 @@ import {
19
19
  ScopeType,
20
20
  } from "./AzureClientFactory.js";
21
21
  import * as ephemeralSummaryTrees from "./ephemeralSummaryTrees.js";
22
- import { configProvider, waitForMember, getTestMatrix } from "./utils.js";
22
+ import { configProvider, waitForMember, getTestMatrix, currentVersion } from "./utils.js";
23
23
 
24
24
  const testMatrix = getTestMatrix();
25
25
  for (const testOpts of testMatrix) {
@@ -54,9 +54,13 @@ for (const testOpts of testMatrix) {
54
54
  "test-user-name-1",
55
55
  );
56
56
  containerId = getContainerIdFromPayloadResponse(containerResponse);
57
- ({ container, services } = await client.getContainer(containerId, schema, "2"));
57
+ ({ container, services } = await client.getContainer(
58
+ containerId,
59
+ schema,
60
+ currentVersion,
61
+ ));
58
62
  } else {
59
- ({ container, services } = await client.createContainer(schema, "2"));
63
+ ({ container, services } = await client.createContainer(schema, currentVersion));
60
64
  containerId = await container.attach();
61
65
  }
62
66
 
@@ -99,9 +103,13 @@ for (const testOpts of testMatrix) {
99
103
  "test-user-name-1",
100
104
  );
101
105
  containerId = getContainerIdFromPayloadResponse(containerResponse);
102
- ({ container, services } = await client.getContainer(containerId, schema, "2"));
106
+ ({ container, services } = await client.getContainer(
107
+ containerId,
108
+ schema,
109
+ currentVersion,
110
+ ));
103
111
  } else {
104
- ({ container, services } = await client.createContainer(schema, "2"));
112
+ ({ container, services } = await client.createContainer(schema, currentVersion));
105
113
  containerId = await container.attach();
106
114
  }
107
115
 
@@ -131,7 +139,11 @@ for (const testOpts of testMatrix) {
131
139
  "Fluid.Container.ForceWriteConnection": true,
132
140
  }),
133
141
  );
134
- const { services: servicesGet } = await client2.getContainer(containerId, schema, "2");
142
+ const { services: servicesGet } = await client2.getContainer(
143
+ containerId,
144
+ schema,
145
+ currentVersion,
146
+ );
135
147
 
136
148
  /* This is a workaround for a known bug, we should have one member (self) upon container connection */
137
149
  const partner = await waitForMember(servicesGet.audience, "test-user-id-2");
@@ -163,9 +175,9 @@ for (const testOpts of testMatrix) {
163
175
  "test-user-name-1",
164
176
  );
165
177
  containerId = getContainerIdFromPayloadResponse(containerResponse);
166
- ({ container } = await client.getContainer(containerId, schema, "2"));
178
+ ({ container } = await client.getContainer(containerId, schema, currentVersion));
167
179
  } else {
168
- ({ container } = await client.createContainer(schema, "2"));
180
+ ({ container } = await client.createContainer(schema, currentVersion));
169
181
  containerId = await container.attach();
170
182
  }
171
183
 
@@ -184,7 +196,11 @@ for (const testOpts of testMatrix) {
184
196
  "Fluid.Container.ForceWriteConnection": true,
185
197
  }),
186
198
  );
187
- const { services: servicesGet } = await client2.getContainer(containerId, schema, "2");
199
+ const { services: servicesGet } = await client2.getContainer(
200
+ containerId,
201
+ schema,
202
+ currentVersion,
203
+ );
188
204
 
189
205
  /* This is a workaround for a known bug, we should have one member (self) upon container connection */
190
206
  const partner = await waitForMember(servicesGet.audience, "test-user-id-2");
@@ -222,9 +238,13 @@ for (const testOpts of testMatrix) {
222
238
  "test-user-name-1",
223
239
  );
224
240
  containerId = getContainerIdFromPayloadResponse(containerResponse);
225
- ({ container, services } = await client.getContainer(containerId, schema, "2"));
241
+ ({ container, services } = await client.getContainer(
242
+ containerId,
243
+ schema,
244
+ currentVersion,
245
+ ));
226
246
  } else {
227
- ({ container, services } = await client.createContainer(schema, "2"));
247
+ ({ container, services } = await client.createContainer(schema, currentVersion));
228
248
  containerId = await container.attach();
229
249
  }
230
250
 
@@ -254,7 +274,7 @@ for (const testOpts of testMatrix) {
254
274
  [ScopeType.DocRead],
255
275
  );
256
276
  const { container: partnerContainer, services: partnerServices } =
257
- await partnerClient.getContainer(containerId, schema, "2");
277
+ await partnerClient.getContainer(containerId, schema, currentVersion);
258
278
 
259
279
  if (partnerContainer.connectionState !== ConnectionState.Connected) {
260
280
  await timeoutPromise(
@@ -331,9 +351,9 @@ for (const testOpts of testMatrix) {
331
351
  "test-user-name-1",
332
352
  );
333
353
  containerId = getContainerIdFromPayloadResponse(containerResponse);
334
- ({ container } = await client.getContainer(containerId, schema, "2"));
354
+ ({ container } = await client.getContainer(containerId, schema, currentVersion));
335
355
  } else {
336
- ({ container } = await client.createContainer(schema, "2"));
356
+ ({ container } = await client.createContainer(schema, currentVersion));
337
357
  containerId = await container.attach();
338
358
  }
339
359
 
@@ -352,7 +372,7 @@ for (const testOpts of testMatrix) {
352
372
  [ScopeType.DocRead],
353
373
  );
354
374
  const { container: partnerContainer, services: partnerServices } =
355
- await partnerClient.getContainer(containerId, schema, "2");
375
+ await partnerClient.getContainer(containerId, schema, currentVersion);
356
376
 
357
377
  if (partnerContainer.connectionState !== ConnectionState.Connected) {
358
378
  await timeoutPromise(
@@ -398,7 +418,7 @@ for (const testOpts of testMatrix) {
398
418
  [ScopeType.DocRead],
399
419
  );
400
420
  const { container: partnerContainer2, services: partnerServices2 } =
401
- await partnerClient2.getContainer(containerId, schema, "2");
421
+ await partnerClient2.getContainer(containerId, schema, currentVersion);
402
422
 
403
423
  if (partnerContainer2.connectionState !== ConnectionState.Connected) {
404
424
  await timeoutPromise(
@@ -36,7 +36,7 @@ import {
36
36
  getContainerIdFromPayloadResponse,
37
37
  } from "./AzureClientFactory.js";
38
38
  import * as ephemeralSummaryTrees from "./ephemeralSummaryTrees.js";
39
- import { getTestMatrix, mapWait } from "./utils.js";
39
+ import { getTestMatrix, mapWait, currentVersion } from "./utils.js";
40
40
 
41
41
  const configProvider = (settings: Record<string, ConfigTypes>): IConfigProviderBase => ({
42
42
  getRawConfig: (name: string): ConfigTypes => settings[name],
@@ -73,7 +73,7 @@ for (const testOpts of testMatrix) {
73
73
  if (isEphemeral) {
74
74
  this.skip();
75
75
  }
76
- const { container } = await client.createContainer(schema, "2");
76
+ const { container } = await client.createContainer(schema, currentVersion);
77
77
  assert.strictEqual(
78
78
  container.attachState,
79
79
  AttachState.Detached,
@@ -101,9 +101,9 @@ for (const testOpts of testMatrix) {
101
101
  "test-user-name-1",
102
102
  );
103
103
  containerId = getContainerIdFromPayloadResponse(containerResponse);
104
- ({ container } = await client.getContainer(containerId, schema, "2"));
104
+ ({ container } = await client.getContainer(containerId, schema, currentVersion));
105
105
  } else {
106
- ({ container } = await client.createContainer(schema, "2"));
106
+ ({ container } = await client.createContainer(schema, currentVersion));
107
107
  containerId = await container.attach();
108
108
  }
109
109
 
@@ -138,9 +138,9 @@ for (const testOpts of testMatrix) {
138
138
  "test-user-name-1",
139
139
  );
140
140
  containerId = getContainerIdFromPayloadResponse(containerResponse);
141
- ({ container } = await client.getContainer(containerId, schema, "2"));
141
+ ({ container } = await client.getContainer(containerId, schema, currentVersion));
142
142
  } else {
143
- ({ container } = await client.createContainer(schema, "2"));
143
+ ({ container } = await client.createContainer(schema, currentVersion));
144
144
  containerId = await container.attach();
145
145
  }
146
146
 
@@ -181,7 +181,7 @@ for (const testOpts of testMatrix) {
181
181
  );
182
182
  containerId = getContainerIdFromPayloadResponse(containerResponse);
183
183
  } else {
184
- ({ container: newContainer } = await client.createContainer(schema, "2"));
184
+ ({ container: newContainer } = await client.createContainer(schema, currentVersion));
185
185
  containerId = await newContainer.attach();
186
186
 
187
187
  if (newContainer.connectionState !== ConnectionState.Connected) {
@@ -192,7 +192,7 @@ for (const testOpts of testMatrix) {
192
192
  }
193
193
  }
194
194
 
195
- const resources = client.getContainer(containerId, schema, "2");
195
+ const resources = client.getContainer(containerId, schema, currentVersion);
196
196
  await assert.doesNotReject(
197
197
  resources,
198
198
  () => true,
@@ -210,7 +210,11 @@ for (const testOpts of testMatrix) {
210
210
  it("cannot load improperly created container (cannot load a non-existent container)", async () => {
211
211
  const consoleErrorFn = console.error;
212
212
  console.error = (): void => {};
213
- const containerAndServicesP = client.getContainer("containerConfig", schema, "2");
213
+ const containerAndServicesP = client.getContainer(
214
+ "containerConfig",
215
+ schema,
216
+ currentVersion,
217
+ );
214
218
 
215
219
  const errorFn = (error: Error): boolean => {
216
220
  assert.notStrictEqual(error.message, undefined, "Azure Client error is undefined");
@@ -266,7 +270,7 @@ for (const testOpts of testMatrix) {
266
270
  if (isEphemeral) {
267
271
  this.skip();
268
272
  }
269
- await client.createContainer(schema, "2");
273
+ await client.createContainer(schema, currentVersion);
270
274
  const event = mockLogger.events.find((e) => e.eventName.endsWith("ContainerLoadStats"));
271
275
  assert(event !== undefined, "ContainerLoadStats event should exist");
272
276
  const featureGates = event.featureGates as string;
@@ -310,7 +314,7 @@ for (const testOpts of testMatrix) {
310
314
  * Expected behavior: an error should not be thrown nor should a rejected promise
311
315
  * be returned.
312
316
  */
313
- for (const compatibilityMode of ["1", "2"] as const) {
317
+ for (const compatibilityMode of ["1.0.0", "2.0.0"] as const) {
314
318
  it(`Current AzureClient (mode: "${compatibilityMode}") can get container made by legacy AzureClient`, async () => {
315
319
  const { container: containerLegacy } =
316
320
  await clientLegacy.createContainer(schemaLegacy);
@@ -348,7 +352,7 @@ for (const testOpts of testMatrix) {
348
352
  // Await the value being saved, especially important if we dispose the legacy container.
349
353
  await valueSetP;
350
354
 
351
- if (compatibilityMode === "2") {
355
+ if (compatibilityMode === "2.0.0") {
352
356
  // We don't support interop between legacy containers and "2" mode, dispose the legacy
353
357
  // container to avoid this case.
354
358
  containerLegacy.dispose();
@@ -429,7 +433,7 @@ for (const testOpts of testMatrix) {
429
433
  const { container: containerCurrent } = await clientCurrent1.createContainer(
430
434
  schemaCurrent,
431
435
  // Note: Only containers created in compatibility mode "1" may be loaded by legacy client.
432
- "1",
436
+ "1.0.0",
433
437
  );
434
438
  const containerId = await containerCurrent.attach();
435
439
 
@@ -470,7 +474,7 @@ for (const testOpts of testMatrix) {
470
474
  it(`Current AzureClient (mode: "2") can get container made by current AzureClient (mode: "1")`, async () => {
471
475
  const { container: containerCurrent1 } = await clientCurrent1.createContainer(
472
476
  schemaCurrent,
473
- "1",
477
+ "1.0.0",
474
478
  );
475
479
  const containerId = await containerCurrent1.attach();
476
480
 
@@ -486,7 +490,7 @@ for (const testOpts of testMatrix) {
486
490
 
487
491
  containerCurrent1.initialObjects.map1.set("key", "value");
488
492
 
489
- const resources = clientCurrent2.getContainer(containerId, schemaCurrent, "2");
493
+ const resources = clientCurrent2.getContainer(containerId, schemaCurrent, "2.0.0");
490
494
  await assert.doesNotReject(resources, () => true, "container could not be loaded");
491
495
 
492
496
  const { container: containerCurrent2 } = await resources;
@@ -512,7 +516,7 @@ for (const testOpts of testMatrix) {
512
516
  it(`Current AzureClient (mode: "1") can get container made by current AzureClient (mode: "2")`, async () => {
513
517
  const { container: containerCurrent2 } = await clientCurrent2.createContainer(
514
518
  schemaCurrent,
515
- "2",
519
+ "2.0.0",
516
520
  );
517
521
  const containerId = await containerCurrent2.attach();
518
522
 
@@ -528,7 +532,7 @@ for (const testOpts of testMatrix) {
528
532
 
529
533
  containerCurrent2.initialObjects.map1.set("key", "value");
530
534
 
531
- const resources = clientCurrent1.getContainer(containerId, schemaCurrent, "1");
535
+ const resources = clientCurrent1.getContainer(containerId, schemaCurrent, "1.0.0");
532
536
  await assert.doesNotReject(resources, () => true, "container could not be loaded");
533
537
 
534
538
  const { container: containerCurrent1 } = await resources;
@@ -549,7 +553,7 @@ for (const testOpts of testMatrix) {
549
553
  it("op grouping disabled as expected for 1.x clients", async () => {
550
554
  const { container: container1 } = await clientCurrent1.createContainer(
551
555
  schemaCurrent,
552
- "1",
556
+ "1.0.0",
553
557
  );
554
558
  const containerId = await container1.attach();
555
559
 
@@ -605,7 +609,7 @@ for (const testOpts of testMatrix) {
605
609
  }
606
610
  });
607
611
 
608
- for (const compatibilityMode of ["1", "2"] as const) {
612
+ for (const compatibilityMode of ["1.0.0", "2.0.0"] as const) {
609
613
  it(`op grouping works as expected (compatibilityMode: ${compatibilityMode})`, async () => {
610
614
  const { container: container1 } = await clientCurrent1.createContainer(
611
615
  schemaCurrent,
@@ -660,7 +664,7 @@ for (const testOpts of testMatrix) {
660
664
  }
661
665
  }
662
666
 
663
- if (compatibilityMode === "1") {
667
+ if (compatibilityMode === "1.0.0") {
664
668
  assert.strictEqual(
665
669
  groupedBatchCount,
666
670
  0,
@@ -691,11 +695,14 @@ describe("Container create in tree-only mode", () => {
691
695
  undefined,
692
696
  undefined,
693
697
  undefined,
694
- ({ schema, compatibilityMode }) => {
698
+ ({ schema, minVersionForCollaboration }) => {
695
699
  if (!isTreeContainerSchema(schema)) {
696
700
  throw new UsageError(invalidSchemaErrorMessage);
697
701
  }
698
- return createTreeContainerRuntimeFactory({ schema, compatibilityMode });
702
+ return createTreeContainerRuntimeFactory({
703
+ schema,
704
+ minVersionForCollaboration,
705
+ });
699
706
  },
700
707
  );
701
708
  }
@@ -706,7 +713,7 @@ describe("Container create in tree-only mode", () => {
706
713
  tree: SharedTree,
707
714
  },
708
715
  };
709
- const { container } = await client.createContainer(schema, "2");
716
+ const { container } = await client.createContainer(schema, currentVersion);
710
717
 
711
718
  assert(SharedTree.is(container.initialObjects.tree));
712
719
  });
@@ -721,7 +728,7 @@ describe("Container create in tree-only mode", () => {
721
728
  };
722
729
 
723
730
  await assert.rejects(
724
- client.createContainer(schema, "2"),
731
+ client.createContainer(schema, currentVersion),
725
732
  (error: unknown) => {
726
733
  assert(error instanceof UsageError);
727
734
  assert.strictEqual(error.message, invalidSchemaErrorMessage);