@fluidframework/azure-end-to-end-tests 2.70.0-361092 → 2.70.0-361248
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.
|
@@ -136,7 +136,7 @@ export function createAzureClientLegacy(userID, userName, logger) {
|
|
|
136
136
|
* currently these are mainly fetched from ephemeralSummaryTrees.ts
|
|
137
137
|
* @param userID - ID for the user creating the container
|
|
138
138
|
* @param userName - Name for the user creating the container
|
|
139
|
-
* @returns
|
|
139
|
+
* @returns An AxiosResponse containing the container ID(response.data.id)
|
|
140
140
|
*/
|
|
141
141
|
export async function createContainerFromPayload(requestPayload, userID, userName) {
|
|
142
142
|
const useAzure = process.env.FLUID_CLIENT === "azure";
|
|
@@ -195,7 +195,7 @@ export async function createContainerFromPayload(requestPayload, userID, userNam
|
|
|
195
195
|
* (Tinylicious has the ID stored at a different path than other services)
|
|
196
196
|
*
|
|
197
197
|
* @param response - A container creation response returned by createContainerFromPayload
|
|
198
|
-
* @returns
|
|
198
|
+
* @returns The ID of the container that was created by createContainerFromPayload
|
|
199
199
|
*/
|
|
200
200
|
export function getContainerIdFromPayloadResponse(response) {
|
|
201
201
|
const useAzure = process.env.FLUID_CLIENT === "azure";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClientFactory.js","sourceRoot":"","sources":["../../src/test/AzureClientFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,GAIX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACN,WAAW,IAAI,iBAAiB,GAIhC,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAEtE,OAAO,EAEN,iBAAiB,EACjB,qBAAqB,GACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,KAAK,EAA+C,MAAM,OAAO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copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAzureClient,\n\ttype AzureLocalConnectionConfig,\n\ttype AzureRemoteConnectionConfig,\n\ttype ITelemetryBaseLogger,\n} from \"@fluidframework/azure-client\";\n// eslint-disable-next-line import/no-internal-modules -- TODO consider a test exposure to avoid /internal\nimport type { AzureClientPropsInternal } from \"@fluidframework/azure-client/internal\";\nimport {\n\tAzureClient as AzureClientLegacy,\n\ttype AzureLocalConnectionConfig as AzureLocalConnectionConfigLegacy,\n\ttype AzureRemoteConnectionConfig as AzureRemoteConnectionConfigLegacy,\n\ttype ITelemetryBaseLogger as ITelemetryBaseLoggerLegacy,\n} from \"@fluidframework/azure-client-legacy\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/legacy\";\nimport type { IConfigProviderBase } from \"@fluidframework/core-interfaces\";\nimport { ScopeType } from \"@fluidframework/driver-definitions/legacy\";\nimport type { CompatibilityMode, ContainerSchema } from \"@fluidframework/fluid-static\";\nimport {\n\ttype MockLogger,\n\tcreateChildLogger,\n\tcreateMultiSinkLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { InsecureTokenProvider } from \"@fluidframework/test-runtime-utils/internal\";\nimport { default as Axios, type AxiosResponse, type AxiosRequestConfig } from \"axios\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { createAzureTokenProvider } from \"./AzureTokenFactory.js\";\n\n// eslint-disable-next-line unicorn/prefer-export-from\nexport { ScopeType };\n\n/**\n * This function will determine if local or remote mode is required (based on FLUID_CLIENT), and return a new\n * {@link AzureClient} instance based on the mode by setting the Connection config accordingly.\n */\nexport function createAzureClient(\n\tid?: string,\n\tname?: string,\n\tlogger?: MockLogger,\n\tconfigProvider?: IConfigProviderBase,\n\tscopes?: ScopeType[],\n\tcreateContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory,\n): AzureClient {\n\tconst args = process.argv.slice(2);\n\n\tconst driverIndex = args.indexOf(\"--driver\");\n\tconst r11sEndpointNameIndex = args.indexOf(\"--r11sEndpointName\");\n\n\t// Get values associated with the flags\n\tconst driver = driverIndex === -1 ? undefined : args[driverIndex + 1];\n\tconst r11sEndpointName =\n\t\tr11sEndpointNameIndex === -1 ? undefined : args[r11sEndpointNameIndex + 1];\n\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tconst tenantId = useAzure\n\t\t? (process.env.azure__fluid__relay__service__tenantId as string)\n\t\t: \"frs-client-tenant\";\n\tconst user = {\n\t\tid: id ?? uuid(),\n\t\tname: name ?? uuid(),\n\t};\n\tconst endPoint = process.env.azure__fluid__relay__service__endpoint as string;\n\tif (useAzure && endPoint === undefined) {\n\t\tthrow new Error(\"Azure Fluid Relay service endpoint is missing\");\n\t}\n\n\t// use AzureClient remote mode will run against live Azure Fluid Relay.\n\t// Default to running Tinylicious for PR validation\n\t// and local testing so it's not hindered by service availability\n\tconst connectionProps: AzureRemoteConnectionConfig | AzureLocalConnectionConfig = useAzure\n\t\t? {\n\t\t\t\ttenantId,\n\t\t\t\ttokenProvider: createAzureTokenProvider(id ?? \"foo\", name ?? \"bar\", scopes),\n\t\t\t\tendpoint: endPoint,\n\t\t\t\ttype: \"remote\",\n\t\t\t}\n\t\t: {\n\t\t\t\ttokenProvider: new InsecureTokenProvider(\"fooBar\", user, scopes),\n\t\t\t\tendpoint: \"http://localhost:7071\",\n\t\t\t\ttype: \"local\",\n\t\t\t};\n\tconst getLogger = (): ITelemetryBaseLogger | undefined => {\n\t\tconst testLogger = getTestLogger?.();\n\t\tif (!logger && !testLogger) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (logger && testLogger) {\n\t\t\treturn createMultiSinkLogger({ loggers: [logger, testLogger] });\n\t\t}\n\t\treturn logger ?? testLogger;\n\t};\n\n\tconst createLogger = createChildLogger({\n\t\tlogger: getLogger(),\n\t\tproperties: {\n\t\t\tall: {\n\t\t\t\tdriverType: useAzure ? r11sEndpointName : driver,\n\t\t\t\tdriverEndpointName: driver,\n\t\t\t},\n\t\t},\n\t});\n\n\tconst props: AzureClientPropsInternal = {\n\t\tconnection: connectionProps,\n\t\tlogger: createLogger,\n\t\tconfigProvider,\n\t\tcreateContainerRuntimeFactory,\n\t};\n\treturn new AzureClient(props);\n}\n\n/**\n * Copy of {@link createAzureClient} with legacy (LTS) AzureClient APIs.\n */\nexport function createAzureClientLegacy(\n\tuserID?: string,\n\tuserName?: string,\n\tlogger?: MockLogger,\n): AzureClientLegacy {\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tconst tenantId = useAzure\n\t\t? (process.env.azure__fluid__relay__service__tenantId as string)\n\t\t: \"frs-client-tenant\";\n\tconst user = {\n\t\tid: userID ?? uuid(),\n\t\tname: userName ?? uuid(),\n\t};\n\tconst endPoint = process.env.azure__fluid__relay__service__endpoint as string;\n\tif (useAzure && endPoint === undefined) {\n\t\tthrow new Error(\"Azure Azure Fluid Relay service endpoint is missing\");\n\t}\n\n\t// use AzureClient remote mode will run against live Azure Fluid Relay.\n\t// Default to running Tinylicious for PR validation\n\t// and local testing so it's not hindered by service availability\n\tconst connectionProps: AzureRemoteConnectionConfigLegacy | AzureLocalConnectionConfigLegacy =\n\t\tuseAzure\n\t\t\t? {\n\t\t\t\t\ttenantId,\n\t\t\t\t\ttokenProvider: createAzureTokenProvider(userID ?? \"foo\", userName ?? \"bar\"),\n\t\t\t\t\tendpoint: endPoint,\n\t\t\t\t\ttype: \"remote\",\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\ttokenProvider: new InsecureTokenProvider(\"fooBar\", user),\n\t\t\t\t\tendpoint: \"http://localhost:7071\",\n\t\t\t\t\ttype: \"local\",\n\t\t\t\t};\n\tconst getLogger = (): ITelemetryBaseLoggerLegacy | undefined => {\n\t\tconst testLogger = getTestLogger?.();\n\t\tif (!logger && !testLogger) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (logger && testLogger) {\n\t\t\treturn createMultiSinkLogger({ loggers: [logger, testLogger] });\n\t\t}\n\t\treturn logger ?? testLogger;\n\t};\n\treturn new AzureClientLegacy({\n\t\tconnection: connectionProps,\n\t\tlogger: getLogger(),\n\t});\n}\n\n/**\n * This function is used to create a container using any summary payload.\n * It is primary intended as a workaround to using the AzureClient, and\n * is only being used at the moment for ephemeral container E2E tests\n * since AzureClient does not currently support ephemeral containers.\n *\n * Usage of this function for anything other than ephemeral E2E tests is\n * not recommended.\n *\n * @param requestPayload - The summary payload used to create the container,\n * currently these are mainly fetched from ephemeralSummaryTrees.ts\n * @param userID - ID for the user creating the container\n * @param userName - Name for the user creating the container\n * @returns - An AxiosResponse containing the container ID(response.data.id)\n */\nexport async function createContainerFromPayload(\n\trequestPayload: object,\n\tuserID?: string,\n\tuserName?: string,\n): Promise<AxiosResponse> {\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tconst tenantId = useAzure\n\t\t? (process.env.azure__fluid__relay__service__tenantId as string)\n\t\t: \"local\";\n\tconst user = {\n\t\tid: userID ?? uuid(),\n\t\tname: userName ?? uuid(),\n\t};\n\tconst endPoint = useAzure\n\t\t? (process.env.azure__fluid__relay__service__endpoint as string)\n\t\t: \"http://localhost:7071\";\n\tif (useAzure && endPoint === undefined) {\n\t\tthrow new Error(\"Azure Fluid Relay service endpoint is missing\");\n\t}\n\n\tconst tokenProvider = useAzure\n\t\t? createAzureTokenProvider(userID ?? \"foo\", userName ?? \"bar\")\n\t\t: new InsecureTokenProvider(\"fooBar\", user);\n\tconst ordererToken = await tokenProvider.fetchOrdererToken(tenantId, undefined, false);\n\n\tconst headers = {\n\t\t\"Authorization\": `Basic ${ordererToken.jwt}`,\n\t\t\"Content-Type\": \"application/json\",\n\t};\n\n\tconst url = `/documents/${tenantId}`;\n\n\tconst options: AxiosRequestConfig = {\n\t\tbaseURL: endPoint,\n\t\tdata: requestPayload,\n\t\theaders,\n\t\tmaxBodyLength: 1048576000,\n\t\tmaxContentLength: 1048576000,\n\t\tmethod: \"POST\",\n\t\turl,\n\t};\n\n\ttry {\n\t\tconst response: AxiosResponse = await Axios(options);\n\n\t\tif (response.status === 201) {\n\t\t\tconsole.log(\"Container created successfully\");\n\t\t} else {\n\t\t\tthrow new Error(`Error creating container. Status code: ${response.status}`);\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tif (response?.data === undefined || (useAzure && response?.data?.id === undefined)) {\n\t\t\tthrow new Error(`ID of the created container is undefined`);\n\t\t}\n\n\t\treturn response;\n\t} catch (error) {\n\t\tthrow new Error(`An error occurred: ${error}`);\n\t}\n}\n\n/**\n * This function takes an AxiosResponse returned by the createContainerFromPayload and returns the containerId.\n * A separate function is used for this, since the data path to the containerID is not always the same.\n * (Tinylicious has the ID stored at a different path than other services)\n *\n * @param response - A container creation response returned by createContainerFromPayload\n * @returns - The ID of the container that was created by createContainerFromPayload\n */\nexport function getContainerIdFromPayloadResponse(response: AxiosResponse): string {\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\treturn (useAzure ? response.data.id : response.data) as string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AzureClientFactory.js","sourceRoot":"","sources":["../../src/test/AzureClientFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,GAIX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACN,WAAW,IAAI,iBAAiB,GAIhC,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAEtE,OAAO,EAEN,iBAAiB,EACjB,qBAAqB,GACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,KAAK,EAA+C,MAAM,OAAO,CAAC;AACtF,OAA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ation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAzureClient,\n\ttype AzureLocalConnectionConfig,\n\ttype AzureRemoteConnectionConfig,\n\ttype ITelemetryBaseLogger,\n} from \"@fluidframework/azure-client\";\n// eslint-disable-next-line import/no-internal-modules -- TODO consider a test exposure to avoid /internal\nimport type { AzureClientPropsInternal } from \"@fluidframework/azure-client/internal\";\nimport {\n\tAzureClient as AzureClientLegacy,\n\ttype AzureLocalConnectionConfig as AzureLocalConnectionConfigLegacy,\n\ttype AzureRemoteConnectionConfig as AzureRemoteConnectionConfigLegacy,\n\ttype ITelemetryBaseLogger as ITelemetryBaseLoggerLegacy,\n} from \"@fluidframework/azure-client-legacy\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/legacy\";\nimport type { IConfigProviderBase } from \"@fluidframework/core-interfaces\";\nimport { ScopeType } from \"@fluidframework/driver-definitions/legacy\";\nimport type { CompatibilityMode, ContainerSchema } from \"@fluidframework/fluid-static\";\nimport {\n\ttype MockLogger,\n\tcreateChildLogger,\n\tcreateMultiSinkLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { InsecureTokenProvider } from \"@fluidframework/test-runtime-utils/internal\";\nimport { default as Axios, type AxiosResponse, type AxiosRequestConfig } from \"axios\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { createAzureTokenProvider } from \"./AzureTokenFactory.js\";\n\n// eslint-disable-next-line unicorn/prefer-export-from\nexport { ScopeType };\n\n/**\n * This function will determine if local or remote mode is required (based on FLUID_CLIENT), and return a new\n * {@link AzureClient} instance based on the mode by setting the Connection config accordingly.\n */\nexport function createAzureClient(\n\tid?: string,\n\tname?: string,\n\tlogger?: MockLogger,\n\tconfigProvider?: IConfigProviderBase,\n\tscopes?: ScopeType[],\n\tcreateContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory,\n): AzureClient {\n\tconst args = process.argv.slice(2);\n\n\tconst driverIndex = args.indexOf(\"--driver\");\n\tconst r11sEndpointNameIndex = args.indexOf(\"--r11sEndpointName\");\n\n\t// Get values associated with the flags\n\tconst driver = driverIndex === -1 ? undefined : args[driverIndex + 1];\n\tconst r11sEndpointName =\n\t\tr11sEndpointNameIndex === -1 ? undefined : args[r11sEndpointNameIndex + 1];\n\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tconst tenantId = useAzure\n\t\t? (process.env.azure__fluid__relay__service__tenantId as string)\n\t\t: \"frs-client-tenant\";\n\tconst user = {\n\t\tid: id ?? uuid(),\n\t\tname: name ?? uuid(),\n\t};\n\tconst endPoint = process.env.azure__fluid__relay__service__endpoint as string;\n\tif (useAzure && endPoint === undefined) {\n\t\tthrow new Error(\"Azure Fluid Relay service endpoint is missing\");\n\t}\n\n\t// use AzureClient remote mode will run against live Azure Fluid Relay.\n\t// Default to running Tinylicious for PR validation\n\t// and local testing so it's not hindered by service availability\n\tconst connectionProps: AzureRemoteConnectionConfig | AzureLocalConnectionConfig = useAzure\n\t\t? {\n\t\t\t\ttenantId,\n\t\t\t\ttokenProvider: createAzureTokenProvider(id ?? \"foo\", name ?? \"bar\", scopes),\n\t\t\t\tendpoint: endPoint,\n\t\t\t\ttype: \"remote\",\n\t\t\t}\n\t\t: {\n\t\t\t\ttokenProvider: new InsecureTokenProvider(\"fooBar\", user, scopes),\n\t\t\t\tendpoint: \"http://localhost:7071\",\n\t\t\t\ttype: \"local\",\n\t\t\t};\n\tconst getLogger = (): ITelemetryBaseLogger | undefined => {\n\t\tconst testLogger = getTestLogger?.();\n\t\tif (!logger && !testLogger) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (logger && testLogger) {\n\t\t\treturn createMultiSinkLogger({ loggers: [logger, testLogger] });\n\t\t}\n\t\treturn logger ?? testLogger;\n\t};\n\n\tconst createLogger = createChildLogger({\n\t\tlogger: getLogger(),\n\t\tproperties: {\n\t\t\tall: {\n\t\t\t\tdriverType: useAzure ? r11sEndpointName : driver,\n\t\t\t\tdriverEndpointName: driver,\n\t\t\t},\n\t\t},\n\t});\n\n\tconst props: AzureClientPropsInternal = {\n\t\tconnection: connectionProps,\n\t\tlogger: createLogger,\n\t\tconfigProvider,\n\t\tcreateContainerRuntimeFactory,\n\t};\n\treturn new AzureClient(props);\n}\n\n/**\n * Copy of {@link createAzureClient} with legacy (LTS) AzureClient APIs.\n */\nexport function createAzureClientLegacy(\n\tuserID?: string,\n\tuserName?: string,\n\tlogger?: MockLogger,\n): AzureClientLegacy {\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tconst tenantId = useAzure\n\t\t? (process.env.azure__fluid__relay__service__tenantId as string)\n\t\t: \"frs-client-tenant\";\n\tconst user = {\n\t\tid: userID ?? uuid(),\n\t\tname: userName ?? uuid(),\n\t};\n\tconst endPoint = process.env.azure__fluid__relay__service__endpoint as string;\n\tif (useAzure && endPoint === undefined) {\n\t\tthrow new Error(\"Azure Azure Fluid Relay service endpoint is missing\");\n\t}\n\n\t// use AzureClient remote mode will run against live Azure Fluid Relay.\n\t// Default to running Tinylicious for PR validation\n\t// and local testing so it's not hindered by service availability\n\tconst connectionProps: AzureRemoteConnectionConfigLegacy | AzureLocalConnectionConfigLegacy =\n\t\tuseAzure\n\t\t\t? {\n\t\t\t\t\ttenantId,\n\t\t\t\t\ttokenProvider: createAzureTokenProvider(userID ?? \"foo\", userName ?? \"bar\"),\n\t\t\t\t\tendpoint: endPoint,\n\t\t\t\t\ttype: \"remote\",\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\ttokenProvider: new InsecureTokenProvider(\"fooBar\", user),\n\t\t\t\t\tendpoint: \"http://localhost:7071\",\n\t\t\t\t\ttype: \"local\",\n\t\t\t\t};\n\tconst getLogger = (): ITelemetryBaseLoggerLegacy | undefined => {\n\t\tconst testLogger = getTestLogger?.();\n\t\tif (!logger && !testLogger) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (logger && testLogger) {\n\t\t\treturn createMultiSinkLogger({ loggers: [logger, testLogger] });\n\t\t}\n\t\treturn logger ?? testLogger;\n\t};\n\treturn new AzureClientLegacy({\n\t\tconnection: connectionProps,\n\t\tlogger: getLogger(),\n\t});\n}\n\n/**\n * This function is used to create a container using any summary payload.\n * It is primary intended as a workaround to using the AzureClient, and\n * is only being used at the moment for ephemeral container E2E tests\n * since AzureClient does not currently support ephemeral containers.\n *\n * Usage of this function for anything other than ephemeral E2E tests is\n * not recommended.\n *\n * @param requestPayload - The summary payload used to create the container,\n * currently these are mainly fetched from ephemeralSummaryTrees.ts\n * @param userID - ID for the user creating the container\n * @param userName - Name for the user creating the container\n * @returns An AxiosResponse containing the container ID(response.data.id)\n */\nexport async function createContainerFromPayload(\n\trequestPayload: object,\n\tuserID?: string,\n\tuserName?: string,\n): Promise<AxiosResponse> {\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tconst tenantId = useAzure\n\t\t? (process.env.azure__fluid__relay__service__tenantId as string)\n\t\t: \"local\";\n\tconst user = {\n\t\tid: userID ?? uuid(),\n\t\tname: userName ?? uuid(),\n\t};\n\tconst endPoint = useAzure\n\t\t? (process.env.azure__fluid__relay__service__endpoint as string)\n\t\t: \"http://localhost:7071\";\n\tif (useAzure && endPoint === undefined) {\n\t\tthrow new Error(\"Azure Fluid Relay service endpoint is missing\");\n\t}\n\n\tconst tokenProvider = useAzure\n\t\t? createAzureTokenProvider(userID ?? \"foo\", userName ?? \"bar\")\n\t\t: new InsecureTokenProvider(\"fooBar\", user);\n\tconst ordererToken = await tokenProvider.fetchOrdererToken(tenantId, undefined, false);\n\n\tconst headers = {\n\t\t\"Authorization\": `Basic ${ordererToken.jwt}`,\n\t\t\"Content-Type\": \"application/json\",\n\t};\n\n\tconst url = `/documents/${tenantId}`;\n\n\tconst options: AxiosRequestConfig = {\n\t\tbaseURL: endPoint,\n\t\tdata: requestPayload,\n\t\theaders,\n\t\tmaxBodyLength: 1048576000,\n\t\tmaxContentLength: 1048576000,\n\t\tmethod: \"POST\",\n\t\turl,\n\t};\n\n\ttry {\n\t\tconst response: AxiosResponse = await Axios(options);\n\n\t\tif (response.status === 201) {\n\t\t\tconsole.log(\"Container created successfully\");\n\t\t} else {\n\t\t\tthrow new Error(`Error creating container. Status code: ${response.status}`);\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tif (response?.data === undefined || (useAzure && response?.data?.id === undefined)) {\n\t\t\tthrow new Error(`ID of the created container is undefined`);\n\t\t}\n\n\t\treturn response;\n\t} catch (error) {\n\t\tthrow new Error(`An error occurred: ${error}`);\n\t}\n}\n\n/**\n * This function takes an AxiosResponse returned by the createContainerFromPayload and returns the containerId.\n * A separate function is used for this, since the data path to the containerID is not always the same.\n * (Tinylicious has the ID stored at a different path than other services)\n *\n * @param response - A container creation response returned by createContainerFromPayload\n * @returns The ID of the container that was created by createContainerFromPayload\n */\nexport function getContainerIdFromPayloadResponse(response: AxiosResponse): string {\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\treturn (useAzure ? response.data.id : response.data) as string;\n}\n"]}
|
package/lib/test/utils.js
CHANGED
|
@@ -44,7 +44,7 @@ export const configProvider = (settings) => ({
|
|
|
44
44
|
* Currently, there is only a test-set for Durable containers and one for Ephemeral containers.
|
|
45
45
|
* The Ephemeral container tests will not run for local tests.
|
|
46
46
|
*
|
|
47
|
-
* @returns
|
|
47
|
+
* @returns The test matrix
|
|
48
48
|
*/
|
|
49
49
|
export function getTestMatrix() {
|
|
50
50
|
const testMatrix = [
|
package/lib/test/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EACjC,QAAwB,EACxB,EAAU,EACa,EA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CAAC,CAAC;QACF,GAAG,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,QAAqC,EACf,EAAE,CAAC,CAAC;IAC1B,YAAY,EAAE,CAAC,IAAY,EAAe,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC3D,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa;IAC5B,MAAM,UAAU,GAAG;QAClB;YACC,OAAO,EAAE,mBAAmB;YAC5B,OAAO,EAAE;gBACR,WAAW,EAAE,KAAK;aAClB;SACD;KACD,CAAC;IAEF,6FAA6F;IAC7F,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,OAAO,CAAC;IACtD,IAAI,QAAQ,EAAE,CAAC;QACd,UAAU,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,qBAAqB;YAC9B,OAAO,EAAE;gBACR,WAAW,EAAE,IAAI;aACjB;SACD,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { AzureMember, IAzureAudience } from \"@fluidframework/azure-client\";\nimport type { ConfigTypes, IConfigProviderBase } from \"@fluidframework/core-interfaces\";\nimport type { IMember } from \"@fluidframework/fluid-static\";\nimport type { ISharedMap, IValueChanged } from \"@fluidframework/map/legacy\";\n\nexport const waitForMember = async (\n\taudience: IAzureAudience,\n\tid: string,\n): Promise<AzureMember> => {\n\tconst allMembers = audience.getMembers();\n\tconst member = allMembers.get(id);\n\tif (member !== undefined) {\n\t\treturn member;\n\t}\n\treturn new Promise((resolve) => {\n\t\tconst handler = (clientId: string, newMember: IMember): void => {\n\t\t\tif (newMember.id === id) {\n\t\t\t\tresolve(newMember as AzureMember);\n\t\t\t}\n\t\t};\n\t\taudience.on(\"memberAdded\", handler);\n\t});\n};\n\nexport const mapWait = async <T>(map: ISharedMap, key: string): Promise<T> => {\n\tconst maybeValue = map.get<T>(key);\n\tif (maybeValue !== undefined) {\n\t\treturn maybeValue;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst handler = (changed: IValueChanged): void => {\n\t\t\tif (changed.key === key) {\n\t\t\t\tmap.off(\"valueChanged\", handler);\n\t\t\t\tconst value = map.get<T>(changed.key);\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tthrow new Error(\"Unexpected valueChanged result\");\n\t\t\t\t}\n\t\t\t\tresolve(value);\n\t\t\t}\n\t\t};\n\t\tmap.on(\"valueChanged\", handler);\n\t});\n};\n\nexport const configProvider = (\n\tsettings: Record<string, ConfigTypes>,\n): IConfigProviderBase => ({\n\tgetRawConfig: (name: string): ConfigTypes => settings[name],\n});\n\n/**\n * This function creates a test matrix which allows the Azure Client to run the same tests against different sets of parameters.\n * Currently, there is only a test-set for Durable containers and one for Ephemeral containers.\n * The Ephemeral container tests will not run for local tests.\n *\n * @returns
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EACjC,QAAwB,EACxB,EAAU,EACa,EAAE;IACzB,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,SAAkB,EAAQ,EAAE;YAC9D,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;gBACzB,OAA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AO,EAAE;gBACR,WAAW,EAAE,KAAK;aAClB;SACD;KACD,CAAC;IAEF,6FAA6F;IAC7F,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,OAAO,CAAC;IACtD,IAAI,QAAQ,EAAE,CAAC;QACd,UAAU,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,qBAAqB;YAC9B,OAAO,EAAE;gBACR,WAAW,EAAE,IAAI;aACjB;SACD,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { AzureMember, IAzureAudience } from \"@fluidframework/azure-client\";\nimport type { ConfigTypes, IConfigProviderBase } from \"@fluidframework/core-interfaces\";\nimport type { IMember } from \"@fluidframework/fluid-static\";\nimport type { ISharedMap, IValueChanged } from \"@fluidframework/map/legacy\";\n\nexport const waitForMember = async (\n\taudience: IAzureAudience,\n\tid: string,\n): Promise<AzureMember> => {\n\tconst allMembers = audience.getMembers();\n\tconst member = allMembers.get(id);\n\tif (member !== undefined) {\n\t\treturn member;\n\t}\n\treturn new Promise((resolve) => {\n\t\tconst handler = (clientId: string, newMember: IMember): void => {\n\t\t\tif (newMember.id === id) {\n\t\t\t\tresolve(newMember as AzureMember);\n\t\t\t}\n\t\t};\n\t\taudience.on(\"memberAdded\", handler);\n\t});\n};\n\nexport const mapWait = async <T>(map: ISharedMap, key: string): Promise<T> => {\n\tconst maybeValue = map.get<T>(key);\n\tif (maybeValue !== undefined) {\n\t\treturn maybeValue;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst handler = (changed: IValueChanged): void => {\n\t\t\tif (changed.key === key) {\n\t\t\t\tmap.off(\"valueChanged\", handler);\n\t\t\t\tconst value = map.get<T>(changed.key);\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tthrow new Error(\"Unexpected valueChanged result\");\n\t\t\t\t}\n\t\t\t\tresolve(value);\n\t\t\t}\n\t\t};\n\t\tmap.on(\"valueChanged\", handler);\n\t});\n};\n\nexport const configProvider = (\n\tsettings: Record<string, ConfigTypes>,\n): IConfigProviderBase => ({\n\tgetRawConfig: (name: string): ConfigTypes => settings[name],\n});\n\n/**\n * This function creates a test matrix which allows the Azure Client to run the same tests against different sets of parameters.\n * Currently, there is only a test-set for Durable containers and one for Ephemeral containers.\n * The Ephemeral container tests will not run for local tests.\n *\n * @returns The test matrix\n */\nexport function getTestMatrix(): { variant: string; options: { isEphemeral: boolean } }[] {\n\tconst testMatrix = [\n\t\t{\n\t\t\tvariant: \"Durable Container\",\n\t\t\toptions: {\n\t\t\t\tisEphemeral: false,\n\t\t\t},\n\t\t},\n\t];\n\n\t// We only need to test ephemeral container behaviors when running against an azure container\n\tconst useAzure = process.env.FLUID_CLIENT === \"azure\";\n\tif (useAzure) {\n\t\ttestMatrix.push({\n\t\t\tvariant: \"Ephemeral Container\",\n\t\t\toptions: {\n\t\t\t\tisEphemeral: true,\n\t\t\t},\n\t\t});\n\t}\n\n\treturn testMatrix;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/azure-end-to-end-tests",
|
|
3
|
-
"version": "2.70.0-
|
|
3
|
+
"version": "2.70.0-361248",
|
|
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.70.0-
|
|
37
|
-
"@fluid-internal/client-utils": "2.70.0-
|
|
38
|
-
"@fluid-internal/mocha-test-setup": "2.70.0-
|
|
39
|
-
"@fluid-private/test-version-utils": "2.70.0-
|
|
40
|
-
"@fluidframework/aqueduct": "2.70.0-
|
|
41
|
-
"@fluidframework/azure-client": "2.70.0-
|
|
36
|
+
"@fluid-experimental/data-objects": "2.70.0-361248",
|
|
37
|
+
"@fluid-internal/client-utils": "2.70.0-361248",
|
|
38
|
+
"@fluid-internal/mocha-test-setup": "2.70.0-361248",
|
|
39
|
+
"@fluid-private/test-version-utils": "2.70.0-361248",
|
|
40
|
+
"@fluidframework/aqueduct": "2.70.0-361248",
|
|
41
|
+
"@fluidframework/azure-client": "2.70.0-361248",
|
|
42
42
|
"@fluidframework/azure-client-legacy": "npm:@fluidframework/azure-client@^1.2.0",
|
|
43
|
-
"@fluidframework/container-definitions": "2.70.0-
|
|
44
|
-
"@fluidframework/container-loader": "2.70.0-
|
|
45
|
-
"@fluidframework/core-interfaces": "2.70.0-
|
|
46
|
-
"@fluidframework/counter": "2.70.0-
|
|
47
|
-
"@fluidframework/datastore-definitions": "2.70.0-
|
|
48
|
-
"@fluidframework/fluid-static": "2.70.0-
|
|
49
|
-
"@fluidframework/map": "2.70.0-
|
|
43
|
+
"@fluidframework/container-definitions": "2.70.0-361248",
|
|
44
|
+
"@fluidframework/container-loader": "2.70.0-361248",
|
|
45
|
+
"@fluidframework/core-interfaces": "2.70.0-361248",
|
|
46
|
+
"@fluidframework/counter": "2.70.0-361248",
|
|
47
|
+
"@fluidframework/datastore-definitions": "2.70.0-361248",
|
|
48
|
+
"@fluidframework/fluid-static": "2.70.0-361248",
|
|
49
|
+
"@fluidframework/map": "2.70.0-361248",
|
|
50
50
|
"@fluidframework/map-legacy": "npm:@fluidframework/map@^1.4.0",
|
|
51
|
-
"@fluidframework/matrix": "2.70.0-
|
|
52
|
-
"@fluidframework/presence": "2.70.0-
|
|
53
|
-
"@fluidframework/runtime-definitions": "2.70.0-
|
|
54
|
-
"@fluidframework/sequence": "2.70.0-
|
|
55
|
-
"@fluidframework/telemetry-utils": "2.70.0-
|
|
56
|
-
"@fluidframework/test-runtime-utils": "2.70.0-
|
|
57
|
-
"@fluidframework/test-utils": "2.70.0-
|
|
58
|
-
"@fluidframework/tree": "2.70.0-
|
|
51
|
+
"@fluidframework/matrix": "2.70.0-361248",
|
|
52
|
+
"@fluidframework/presence": "2.70.0-361248",
|
|
53
|
+
"@fluidframework/runtime-definitions": "2.70.0-361248",
|
|
54
|
+
"@fluidframework/sequence": "2.70.0-361248",
|
|
55
|
+
"@fluidframework/telemetry-utils": "2.70.0-361248",
|
|
56
|
+
"@fluidframework/test-runtime-utils": "2.70.0-361248",
|
|
57
|
+
"@fluidframework/test-utils": "2.70.0-361248",
|
|
58
|
+
"@fluidframework/tree": "2.70.0-361248",
|
|
59
59
|
"axios": "^1.8.4",
|
|
60
60
|
"cross-env": "^7.0.3",
|
|
61
61
|
"mocha": "^10.8.2",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@biomejs/biome": "~1.9.3",
|
|
70
70
|
"@fluidframework/build-common": "^2.0.3",
|
|
71
71
|
"@fluidframework/build-tools": "^0.58.3",
|
|
72
|
-
"@fluidframework/driver-definitions": "2.70.0-
|
|
72
|
+
"@fluidframework/driver-definitions": "2.70.0-361248",
|
|
73
73
|
"@fluidframework/eslint-config-fluid": "^6.1.0",
|
|
74
74
|
"@types/mocha": "^10.0.10",
|
|
75
75
|
"@types/nock": "^9.3.0",
|
|
@@ -187,7 +187,7 @@ export function createAzureClientLegacy(
|
|
|
187
187
|
* currently these are mainly fetched from ephemeralSummaryTrees.ts
|
|
188
188
|
* @param userID - ID for the user creating the container
|
|
189
189
|
* @param userName - Name for the user creating the container
|
|
190
|
-
* @returns
|
|
190
|
+
* @returns An AxiosResponse containing the container ID(response.data.id)
|
|
191
191
|
*/
|
|
192
192
|
export async function createContainerFromPayload(
|
|
193
193
|
requestPayload: object,
|
|
@@ -257,7 +257,7 @@ export async function createContainerFromPayload(
|
|
|
257
257
|
* (Tinylicious has the ID stored at a different path than other services)
|
|
258
258
|
*
|
|
259
259
|
* @param response - A container creation response returned by createContainerFromPayload
|
|
260
|
-
* @returns
|
|
260
|
+
* @returns The ID of the container that was created by createContainerFromPayload
|
|
261
261
|
*/
|
|
262
262
|
export function getContainerIdFromPayloadResponse(response: AxiosResponse): string {
|
|
263
263
|
const useAzure = process.env.FLUID_CLIENT === "azure";
|
package/src/test/utils.ts
CHANGED
|
@@ -59,7 +59,7 @@ export const configProvider = (
|
|
|
59
59
|
* Currently, there is only a test-set for Durable containers and one for Ephemeral containers.
|
|
60
60
|
* The Ephemeral container tests will not run for local tests.
|
|
61
61
|
*
|
|
62
|
-
* @returns
|
|
62
|
+
* @returns The test matrix
|
|
63
63
|
*/
|
|
64
64
|
export function getTestMatrix(): { variant: string; options: { isEphemeral: boolean } }[] {
|
|
65
65
|
const testMatrix = [
|