From bd89d96ce3911823492103d1de4e1f1474811d51 Mon Sep 17 00:00:00 2001 From: Sonali Deshpande <48232592+sonalideshpandemsft@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:29:02 +0000 Subject: [PATCH] log data --- .../azure-client/package.json | 6 ++-- .../azure-client/src/test/.mocharc.cjs | 22 ++++++++++++- .../end-to-end-tests/odsp-client/.mocharc.cjs | 12 ------- .../end-to-end-tests/odsp-client/package.json | 2 +- .../odsp-client/src/test/.mocharc.cjs | 32 +++++++++++++++++++ 5 files changed, 57 insertions(+), 17 deletions(-) delete mode 100644 packages/service-clients/end-to-end-tests/odsp-client/.mocharc.cjs create mode 100644 packages/service-clients/end-to-end-tests/odsp-client/src/test/.mocharc.cjs diff --git a/packages/service-clients/end-to-end-tests/azure-client/package.json b/packages/service-clients/end-to-end-tests/azure-client/package.json index 6811a6bec710..e19285fae6f0 100644 --- a/packages/service-clients/end-to-end-tests/azure-client/package.json +++ b/packages/service-clients/end-to-end-tests/azure-client/package.json @@ -32,9 +32,9 @@ "test:coverage": "c8 npm test", "test:realsvc": "npm run test:realsvc:tinylicious", "test:realsvc:azure": "cross-env FLUID_CLIENT=azure npm run test:realsvc:azure:run", - "test:realsvc:azure:run": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit --timeout 20000 --config src/test/.mocharc.cjs", - "test:realsvc:run": "mocha lib/test --config src/test/.mocharc.cjs", - "test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7071 test:realsvc:azure:run", + "test:realsvc:azure:run": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit --timeout 20000 --config src/test/.mocharc.cjs -- --driver=frs --driverEndpoint=frs", + "test:realsvc:run": "mocha lib/test --config src/test/.mocharc.cjs -- --driver=frs --driverEndpoint=frs", + "test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7071 test:realsvc:azure:run --config ./src/test/.mocharc.cjs -- --driver=t9s", "test:realsvc:tinylicious:report": "npm run test:realsvc:tinylicious", "test:realsvc:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:realsvc" }, diff --git a/packages/service-clients/end-to-end-tests/azure-client/src/test/.mocharc.cjs b/packages/service-clients/end-to-end-tests/azure-client/src/test/.mocharc.cjs index b8d46952ff9a..f25f2bb79692 100644 --- a/packages/service-clients/end-to-end-tests/azure-client/src/test/.mocharc.cjs +++ b/packages/service-clients/end-to-end-tests/azure-client/src/test/.mocharc.cjs @@ -8,4 +8,24 @@ const packageDir = `${__dirname}/../..`; const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common"); const config = getFluidTestMochaConfig(packageDir); -module.exports = config; + +const args = process.argv.slice(2); + +function getFluidTestVariant() { + const driverIndex = args.indexOf("--driver"); + const endpointIndex = args.indexOf("--driverEndpoint"); + + const testDriver = driverIndex !== -1 ? args[driverIndex + 1] : ""; + const endpointName = endpointIndex !== -1 ? args[endpointIndex + 1] : ""; + + return `${testDriver}-${endpointName}`; +} + +function getFluidTestMocha(packageDir, additionalRequiredModules = []) { + const testVariant = getFluidTestVariant(); + process.env.FLUID_TEST_VARIANT = testVariant; + + return config(packageDir, additionalRequiredModules, testVariant); +} + +module.exports = getFluidTestMocha; diff --git a/packages/service-clients/end-to-end-tests/odsp-client/.mocharc.cjs b/packages/service-clients/end-to-end-tests/odsp-client/.mocharc.cjs deleted file mode 100644 index cddbf0e44d55..000000000000 --- a/packages/service-clients/end-to-end-tests/odsp-client/.mocharc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -/*! - * Copyright (c) Microsoft Corporation and contributors. All rights reserved. - * Licensed under the MIT License. - */ - -"use strict"; - -const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common"); - -const packageDir = __dirname; -const config = getFluidTestMochaConfig(packageDir); -module.exports = config; diff --git a/packages/service-clients/end-to-end-tests/odsp-client/package.json b/packages/service-clients/end-to-end-tests/odsp-client/package.json index 2cd7a9d43eaf..3f2a12eb3c98 100644 --- a/packages/service-clients/end-to-end-tests/odsp-client/package.json +++ b/packages/service-clients/end-to-end-tests/odsp-client/package.json @@ -30,7 +30,7 @@ "test": "npm run test:realsvc:odsp:run", "test:coverage": "c8 npm test", "test:realsvc:odsp": "cross-env npm run test:realsvc:odsp:run", - "test:realsvc:odsp:run": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit --timeout 20000", + "test:realsvc:odsp:run": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit --timeout 20000 --config src/test/.mocharc.cjs -- --driver=odsp --driverEndpoint=odsp", "test:realsvc:run": "mocha --recursive \"lib/test/**/*.spec.*js\"", "test:realsvc:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:realsvc" }, diff --git a/packages/service-clients/end-to-end-tests/odsp-client/src/test/.mocharc.cjs b/packages/service-clients/end-to-end-tests/odsp-client/src/test/.mocharc.cjs new file mode 100644 index 000000000000..ccb82ba645c8 --- /dev/null +++ b/packages/service-clients/end-to-end-tests/odsp-client/src/test/.mocharc.cjs @@ -0,0 +1,32 @@ +/*! + * Copyright (c) Microsoft Corporation and contributors. All rights reserved. + * Licensed under the MIT License. + */ + +"use strict"; + +const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common"); + +const packageDir = __dirname; +const config = getFluidTestMochaConfig(packageDir); + +const args = process.argv.slice(2); + +function getFluidTestVariant() { + const driverIndex = args.indexOf("--driver"); + const endpointIndex = args.indexOf("--driverEndpoint"); + + const testDriver = driverIndex !== -1 ? args[driverIndex + 1] : ""; + const endpointName = endpointIndex !== -1 ? args[endpointIndex + 1] : ""; + + return `${testDriver}-${endpointName}`; +} + +function getFluidTestMocha(packageDir, additionalRequiredModules = []) { + const testVariant = getFluidTestVariant(); + process.env.FLUID_TEST_VARIANT = testVariant; + + return config(packageDir, additionalRequiredModules, testVariant); +} + +module.exports = getFluidTestMocha;