diff --git a/packages/dds/map/src/test/memory/.mocharc.cjs b/packages/dds/map/src/test/memory/.mocharc.cjs index 6735dcc1ea43..bc28b0f6da23 100644 --- a/packages/dds/map/src/test/memory/.mocharc.cjs +++ b/packages/dds/map/src/test/memory/.mocharc.cjs @@ -14,7 +14,7 @@ module.exports = { "recursive": true, "reporter": "@fluid-tools/benchmark/dist/MochaReporter.js", "reporterOptions": ["reportDir=.memoryTestsOutput/"], - "require": ["node_modules/@fluid-internal/mocha-test-setup"], + "require": ["@fluid-internal/mocha-test-setup"], "spec": ["dist/test/memory/**/*.spec.*js", "--perfMode"], "timeout": "60000", }; diff --git a/packages/dds/matrix/src/test/memory/.mocharc.cjs b/packages/dds/matrix/src/test/memory/.mocharc.cjs index c6834a01044e..6f6e7ad33954 100644 --- a/packages/dds/matrix/src/test/memory/.mocharc.cjs +++ b/packages/dds/matrix/src/test/memory/.mocharc.cjs @@ -14,7 +14,7 @@ module.exports = { "recursive": true, "reporter": "@fluid-tools/benchmark/dist/MochaReporter.js", "reporterOptions": ["reportDir=.memoryTestsOutput/"], - "require": ["node_modules/@fluid-internal/mocha-test-setup"], + "require": ["@fluid-internal/mocha-test-setup"], "spec": ["dist/test/memory/**/*.spec.*js", "--perfMode"], "timeout": "90000", }; diff --git a/packages/dds/matrix/src/test/time/.mocharc.cjs b/packages/dds/matrix/src/test/time/.mocharc.cjs index 2dffc2e71898..de599f4f78af 100644 --- a/packages/dds/matrix/src/test/time/.mocharc.cjs +++ b/packages/dds/matrix/src/test/time/.mocharc.cjs @@ -12,7 +12,7 @@ module.exports = { "node-option": ["expose-gc", "gc-global", "unhandled-rejections=strict"], // without leading "--" "recursive": true, "reporter": "@fluid-tools/benchmark/dist/MochaReporter.js", - "require": ["node_modules/@fluid-internal/mocha-test-setup"], + "require": ["@fluid-internal/mocha-test-setup"], "spec": ["dist/test/time/**/*.spec.*js", "--perfMode"], "timeout": "15000", }; diff --git a/packages/dds/sequence/src/test/memory/.mocharc.cjs b/packages/dds/sequence/src/test/memory/.mocharc.cjs index 6735dcc1ea43..bc28b0f6da23 100644 --- a/packages/dds/sequence/src/test/memory/.mocharc.cjs +++ b/packages/dds/sequence/src/test/memory/.mocharc.cjs @@ -14,7 +14,7 @@ module.exports = { "recursive": true, "reporter": "@fluid-tools/benchmark/dist/MochaReporter.js", "reporterOptions": ["reportDir=.memoryTestsOutput/"], - "require": ["node_modules/@fluid-internal/mocha-test-setup"], + "require": ["@fluid-internal/mocha-test-setup"], "spec": ["dist/test/memory/**/*.spec.*js", "--perfMode"], "timeout": "60000", }; diff --git a/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.memory.cjs b/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.memory.cjs index 57a7bb3be476..3705e593ef19 100644 --- a/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.memory.cjs +++ b/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.memory.cjs @@ -18,7 +18,7 @@ const newConfig = { "recursive": true, "reporter": "@fluid-tools/benchmark/dist/MochaReporter.js", "reporterOptions": ["reportDir=.memoryTestsOutput/"], - "require": [...config.require, "node_modules/@fluid-internal/mocha-test-setup"], + "require": [...config.require, "@fluid-internal/mocha-test-setup"], "spec": [ "lib/test/benchmark/**/*.memory.spec.*js", "lib/test/benchmark/**/*.all.spec.*js", diff --git a/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.time.cjs b/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.time.cjs index cf8481a73c71..9f51ea4740a4 100644 --- a/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.time.cjs +++ b/packages/test/test-end-to-end-tests/src/test/benchmark/.mocharc.time.cjs @@ -18,7 +18,7 @@ const newConfig = { "recursive": true, "reporter": "@fluid-tools/benchmark/dist/MochaReporter.js", "reporterOptions": ["reportDir=.timeTestsOutput/"], - "require": [...config.require, "node_modules/@fluid-internal/mocha-test-setup"], + "require": [...config.require, "@fluid-internal/mocha-test-setup"], "spec": [ "lib/test/benchmark/**/*.time.spec.*js", "lib/test/benchmark/**/*.all.spec.*js", diff --git a/tools/pipelines/templates/include-copy-dev-dependencies.yml b/tools/pipelines/templates/include-copy-dev-dependencies.yml new file mode 100644 index 000000000000..decad35aa223 --- /dev/null +++ b/tools/pipelines/templates/include-copy-dev-dependencies.yml @@ -0,0 +1,60 @@ +# Copyright (c) Microsoft Corporation and contributors. All rights reserved. +# Licensed under the MIT License. + +# Copy runtime devDependencies from an installed package to somewhere else (usually the root package in the workspace) +# and install them. +# This is useful for test workloads that don't run in the original context of the package (i.e. that need to install it) +# such as the performance benchmarks and e2e test pipelines. + +parameters: +- name: sourcePackageLocation + type: string + +- name: destPackageLocation + type: string + +steps: +# The test workload we are running frequently depends on devDependencies of the package being installed. +# To make sure these are available, copy them to the root package.json and reinstall. +- task: Bash@3 + displayName: Copy devDependencies + inputs: + targetType: 'inline' + script: | + set -eu -o pipefail + + testPkgJsonPath=${{ parameters.sourcePackageLocation }}/package.json + pkgJsonPath=${{ parameters.destPackageLocation }}/package.json + node -e " + const { devDependencies } = require('$testPkgJsonPath'); + const pkg = require('$pkgJsonPath'); + if (!pkg.devDependencies) { + pkg.devDependencies = {}; + } + // Avoid copying some common dev dependencies that should only be required at build time. + // Keeping the dependency tree small helps reduce job time and likelihood of install failures, since + // dependencies added as part of this step won't be reproducible via pnpm-lock. + const avoidCopying = new Set([ + '@types/node', + 'typescript', + '@microsoft/api-extractor', + '@fluid-tools/build-cli', + '@fluidframework/build-common', + '@fluidframework/build-tools' + ]); + for (const [k, v] of Object.entries(devDependencies)) { + if (!pkg.devDependencies[k] && !avoidCopying.has(k)) { + // Note that if you use string interpolation, bash interpreting the dollar sign takes precedence. + console.log('Adding devDependency ' + k + '@' + v); + pkg.devDependencies[k] = v; + } + } + require('fs').writeFileSync('$pkgJsonPath', JSON.stringify(pkg)); + " + +- task: Bash@3 + displayName: 'pnpm install - extra dependencies for test files' + retryCountOnTaskFailure: 10 + inputs: + targetType: 'inline' + script: 'pnpm install --no-frozen-lockfile' diff --git a/tools/pipelines/templates/include-install.yml b/tools/pipelines/templates/include-install.yml index 153b428a5a09..81e1d471c491 100644 --- a/tools/pipelines/templates/include-install.yml +++ b/tools/pipelines/templates/include-install.yml @@ -13,11 +13,21 @@ parameters: - name: packageManagerInstallCommand type: string +- name: primaryRegistry + type: string + default: $(ado-feeds-primary-registry) + +- name: userNpmrcPath + type: string + default: $(Agent.TempDirectory)/.npmrc + steps: - ${{ if eq(parameters.packageManager, 'pnpm') }}: - template: /tools/pipelines/templates/include-install-pnpm.yml@self parameters: buildDirectory: ${{ parameters.buildDirectory }} + primaryRegistry: ${{ parameters.primaryRegistry }} + userNpmrcPath: ${{ parameters.userNpmrcPath }} - task: Bash@3 displayName: Install dependencies diff --git a/tools/pipelines/templates/include-setup-npmrc-for-download.yml b/tools/pipelines/templates/include-setup-npmrc-for-download.yml index 9653291d649b..c94f7a5d837b 100644 --- a/tools/pipelines/templates/include-setup-npmrc-for-download.yml +++ b/tools/pipelines/templates/include-setup-npmrc-for-download.yml @@ -12,8 +12,7 @@ parameters: # Location for the .npmrc file. -# NOTE: Do not override the default value. It's a parameter just for reusability. -- name: npmrcLocation +- name: userNpmrcDirectory type: string default: $(Agent.TempDirectory)/global-download-npmrc @@ -43,8 +42,8 @@ steps: script: | set -eu -o pipefail - mkdir -p ${{ parameters.npmrcLocation }} - cd ${{ parameters.npmrcLocation }} + mkdir -p ${{ parameters.userNpmrcDirectory }} + cd ${{ parameters.userNpmrcDirectory }} echo "Generating .npmrc" @@ -57,14 +56,14 @@ steps: displayName: 'Authenticate to internal ADO feeds' retryCountOnTaskFailure: 1 inputs: - workingFile: ${{ parameters.npmrcLocation }}/.npmrc + workingFile: ${{ parameters.userNpmrcDirectory }}/.npmrc - task: Bash@3 displayName: Use the authenticated .npmrc file globally inputs: targetType: 'inline' script: | - TARGET_FILE=${{ parameters.npmrcLocation }}/.npmrc + TARGET_FILE=${{ parameters.userNpmrcDirectory }}/.npmrc # Configure the copied file to be the default user-level .npmrc file, so all invocations of npm use it. # Particularly relevant for the ones that occur when we install older version for compat tests. diff --git a/tools/pipelines/templates/include-test-perf-benchmarks-install-package.yml b/tools/pipelines/templates/include-test-perf-benchmarks-install-package.yml index d2183e105962..6e8e10d10a9c 100644 --- a/tools/pipelines/templates/include-test-perf-benchmarks-install-package.yml +++ b/tools/pipelines/templates/include-test-perf-benchmarks-install-package.yml @@ -108,7 +108,7 @@ steps: ls -1 $TEST_PACKAGE_PATH_PATTERN if [[ `ls -1 $TEST_PACKAGE_PATH_PATTERN | wc -l` -eq 1 ]]; then - npm install $(ls $TEST_PACKAGE_PATH_PATTERN) + pnpm install $(ls $TEST_PACKAGE_PATH_PATTERN) else echo "##vso[task.logissue type=error]Test package '${{ parameters.testPackageName }}' not found, or more than one possible match found. See messages above." exit -1 diff --git a/tools/pipelines/templates/include-test-perf-benchmarks.yml b/tools/pipelines/templates/include-test-perf-benchmarks.yml index 10751ecedaec..919bcdc8f343 100644 --- a/tools/pipelines/templates/include-test-perf-benchmarks.yml +++ b/tools/pipelines/templates/include-test-perf-benchmarks.yml @@ -15,28 +15,22 @@ parameters: - name: artifactBuildId type: string -# Path where the packages with perf tests will be installed. -# The template will create it, and install aria-logger in it. -- name: testWorkspace - type: string - # Path to the folder where the test files artifact should be downloaded. - name: testFilesPath type: string -# Path where the telemetry-generator package should be installed. -# It should be an empty directory so that it doesn't interfere with anything else. -# The caller of this template will need to know this in order to point to the correct locations for the handlers, -# which will be under /node_modules/@ff-internal/telemetry-generator/dist/handlers/. -- name: pathForTelemetryGeneratorInstall - type: string - # Name of the service that the tests are running against. - name: endpointName type: string default: '' +- name: userNpmrcDirectory + type: string + default: $(Agent.TempDirectory) + steps: +- checkout: git://internal/ff_pipeline_host + - task: Bash@3 displayName: Print parameter/variable values for troubleshooting inputs: @@ -48,17 +42,24 @@ steps: artifactBuildId=${{ parameters.artifactBuildId }} artifactPipeline=${{ parameters.artifactPipeline }} testFilesPath=${{ parameters.testFilesPath }} - testWorkspace=${{ parameters.testWorkspace }} Build Params SourceBranch=$(Build.SourceBranch) " +# Note: there is some duplication between the .npmrc setup here, the pnpm configuration in the next step, and the +# base .npmrc file in ff_pipeline_host which could be cleaned up. - template: /tools/pipelines/templates/include-setup-npmrc-for-download.yml@self + parameters: + userNpmrcDirectory: ${{ parameters.userNpmrcDirectory }} -- template: /tools/pipelines/templates/include-telemetry-setup.yml@self +- template: /tools/pipelines/templates/include-install.yml@self parameters: - pathForTelemetryGeneratorInstall: ${{ parameters.pathForTelemetryGeneratorInstall }} + packageManager: pnpm + buildDirectory: $(Build.SourcesDirectory) + packageManagerInstallCommand: pnpm install + primaryRegistry: $(ado-feeds-ff-download-only) + userNpmrcPath: ${{ parameters.userNpmrcDirectory }}/.npmrc # Download artifact with test files - task: DownloadPipelineArtifact@2 @@ -80,22 +81,6 @@ steps: # allowPartiallySucceededBuilds: true # No effect as long as we have buildVersionToDownload: specific # branchName: $(Build.SourceBranch) # No effect as long as we have buildVersionToDownload: specific -- task: Bash@3 - displayName: Create test directory - inputs: - targetType: 'inline' - script: | - mkdir ${{ parameters.testWorkspace }} - -# Install aria-logger -- task: Bash@3 - displayName: 'npm install aria logger' - retryCountOnTaskFailure: 4 - inputs: - workingDirectory: ${{ parameters.testWorkspace }} - targetType: 'inline' - script: 'npm install @ff-internal/aria-logger' - - ${{ if eq(parameters.endpointName, 'odsp') }}: # Log in to Azure to retrieve tenant credentials - task: AzureCLI@2 @@ -117,11 +102,10 @@ steps: env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) inputs: - workingDirectory: ${{ parameters.testWorkspace }} targetType: 'inline' script: | set -eu -o pipefail # Increase the maximum time to wait for a tenant to 1 hour to accommodate multiple test runs at the same time. - npx --package=@ff-internal/trips-setup@0.0.5 -- trips-setup --waitTime=3600 --accessToken=$SYSTEM_ACCESSTOKEN + pnpm exec trips-setup --waitTime=3600 --accessToken=$SYSTEM_ACCESSTOKEN echo "##vso[task.setvariable variable=tenantSetupSuccess;]true" diff --git a/tools/pipelines/templates/include-test-real-service.yml b/tools/pipelines/templates/include-test-real-service.yml index b3c6e416e46c..1f9e68d03ba0 100644 --- a/tools/pipelines/templates/include-test-real-service.yml +++ b/tools/pipelines/templates/include-test-real-service.yml @@ -309,50 +309,10 @@ stages: tar --extract --verbose --file $TAR_PATH ./dist/test tar --extract --verbose --file $TAR_PATH ./src/test - # The test workload we are running frequently depends on devDependencies of the package being installed. - # To make sure these are available, copy them to the root package.json and reinstall. - - task: Bash@3 - displayName: Copy devDependencies - inputs: - targetType: 'inline' - script: | - set -eu -o pipefail - - testPkgJsonPath=$(Build.SourcesDirectory)/node_modules/${{ parameters.testPackage }}/package.json - pkgJsonPath=$(Build.SourcesDirectory)/package.json - node -e " - const { devDependencies } = require('$testPkgJsonPath'); - const pkg = require('$pkgJsonPath'); - if (!pkg.devDependencies) { - pkg.devDependencies = {}; - } - // Avoid copying some common dev dependencies that should only be required at build time. - // Keeping the dependency tree small helps reduce job time and likelihood of install failures, since - // dependencies added as part of this step won't be reproducible via pnpm-lock. - const avoidCopying = new Set([ - '@types/node', - 'typescript', - '@microsoft/api-extractor', - '@fluid-tools/build-cli', - '@fluidframework/build-common', - '@fluidframework/build-tools' - ]); - for (const [k, v] of Object.entries(devDependencies)) { - if (!pkg.devDependencies[k] && !avoidCopying.has(k)) { - // Note that if you use string interpolation, bash interpreting the dollar sign takes precedence. - console.log('Adding devDependency ' + k + '@' + v); - pkg.devDependencies[k] = v; - } - } - require('fs').writeFileSync('$pkgJsonPath', JSON.stringify(pkg)); - " - - - task: Bash@3 - displayName: 'pnpm install - extra dependencies for test files' - retryCountOnTaskFailure: 10 - inputs: - targetType: 'inline' - script: 'pnpm install --no-frozen-lockfile' + - template: /tools/pipelines/templates/include-copy-dev-dependencies.yml@self + parameters: + sourcePackageLocation: $(Build.SourcesDirectory)/node_modules/${{ parameters.testPackage }} + destPackageLocation: $(Build.SourcesDirectory) - ${{ if eq(parameters.cacheCompatVersionsInstalls, true) }}: - task: Cache@2 diff --git a/tools/pipelines/templates/include-vars-telemetry-generator.yml b/tools/pipelines/templates/include-vars-telemetry-generator.yml index d7c6155e8bc8..beda17245e7c 100644 --- a/tools/pipelines/templates/include-vars-telemetry-generator.yml +++ b/tools/pipelines/templates/include-vars-telemetry-generator.yml @@ -11,14 +11,19 @@ variables: - name: pathToTelemetryGenerator value: $(Agent.TempDirectory)/telemetry-generator readonly: true + # Path where the handlers for telemetry-generator are located. Convenient because every call to the tool needs to # provide this as an absolute path. - name: pathToTelemetryGeneratorHandlers - value: $(pathToTelemetryGenerator)/node_modules/@ff-internal/telemetry-generator/dist/handlers/ + value: $(pathToTelemetryGenerator)/node_modules/@ff-internal/telemetry-generator/dist/handlers readonly: true -# Path where the handlers for telemetry-generator are located when using the ff_pipeline_host repository +# Same semantics as above two variables, but for pipelines that use the new ff_pipeline_host repository setup # for shared internal dependencies. +- name: pathToTelemetryGeneratorNew + value: $(Build.SourcesDirectory)/node_modules/@ff-internal/telemetry-generator + readonly: true + - name: pathToTelemetryGeneratorHandlersNew - value: $(Build.SourcesDirectory)/node_modules/@ff-internal/telemetry-generator/dist/handlers/ + value: $(Build.SourcesDirectory)/node_modules/@ff-internal/telemetry-generator/dist/handlers readonly: true diff --git a/tools/pipelines/test-perf-benchmarks.yml b/tools/pipelines/test-perf-benchmarks.yml index 2a14468a53b1..bc48aa19a7c0 100644 --- a/tools/pipelines/test-perf-benchmarks.yml +++ b/tools/pipelines/test-perf-benchmarks.yml @@ -66,7 +66,7 @@ variables: value: 1 readonly: true - name: testWorkspace - value: $(Pipeline.Workspace)/test + value: $(Build.SourcesDirectory) readonly: true - name: testFilesPath value: $(Pipeline.Workspace)/test-files @@ -107,8 +107,6 @@ stages: artifactBuildId: $(artifactBuildId) artifactPipeline: $(artifactPipeline) testFilesPath: $(testFilesPath) - testWorkspace: $(testWorkspace) - pathForTelemetryGeneratorInstall: $(pathToTelemetryGenerator) # Run tests for each package that has them - ${{ each testPackage in parameters.executionTestPackages }}: @@ -143,13 +141,10 @@ stages: tar --extract --verbose --file $TAR_PATH ./src/test # Install package dependencies (this gets devDependencies installed so we can then run the package's tests). - - task: Bash@3 - displayName: Install dependencies - ${{ testPackage }} - retryCountOnTaskFailure: 4 - inputs: - workingDirectory: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} - targetType: 'inline' - script: 'npm install' + - template: /tools/pipelines/templates/include-copy-dev-dependencies.yml@self + parameters: + sourcePackageLocation: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} + destPackageLocation: $(Build.SourcesDirectory) # Run tests - task: Npm@1 @@ -159,11 +154,25 @@ stages: workingDir: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} customCommand: 'run test:benchmark:report' + - task: Bash@3 + displayName: Compute benchmark output folder - ${{ testPackage }} + inputs: + targetType: 'inline' + workingDirectory: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} + script: | + set -eu -o pipefail + node --input-type=module -e " + const benchmarkIndexUrl = await import.meta.resolve('@fluid-tools/benchmark'); + const absolutePath = new URL(benchmarkIndexUrl.replace('index.js', '.output')).pathname; + console.log('Resolved @fluid-tools/benchmark output folder to ' + absolutePath); + console.log('##vso[task.setvariable variable=benchmarkOutputFolder]' + absolutePath); + " + # Consolidate output files - task: CopyFiles@2 displayName: Consolidate output files - ${{ testPackage }} inputs: - sourceFolder: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }}/node_modules/@fluid-tools/benchmark/dist/.output/ + sourceFolder: $(benchmarkOutputFolder) contents: '**' targetFolder: ${{ variables.consolidatedTestsOutputFolder }}/${{ testPackage }} @@ -182,12 +191,11 @@ stages: displayName: Write measurements to Aria/Kusto inputs: targetType: 'inline' - workingDirectory: $(pathToTelemetryGenerator) script: | set -eu -o pipefail echo "Write the following benchmark output to Aria/Kusto" ls -laR ${{ variables.consolidatedTestsOutputFolder }}; - npx telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlers)/executionTimeTestHandler.js --dir '${{ variables.consolidatedTestsOutputFolder }}'; + pnpm exec telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlersNew)/executionTimeTestHandler.js --dir '${{ variables.consolidatedTestsOutputFolder }}'; - task: PublishPipelineArtifact@1 displayName: Publish Artifact - Perf tests output - execution time @@ -223,8 +231,6 @@ stages: artifactBuildId: $(artifactBuildId) artifactPipeline: $(artifactPipeline) testFilesPath: $(testFilesPath) - testWorkspace: $(testWorkspace) - pathForTelemetryGeneratorInstall: $(pathToTelemetryGenerator) # Run tests for each package that has them - ${{ each testPackage in parameters.memoryTestPackages }}: @@ -258,14 +264,11 @@ stages: tar --extract --verbose --file $TAR_PATH ./dist/test tar --extract --verbose --file $TAR_PATH ./src/test - # Install package dependencies (this gets devDependencies installed so we can then run the package's tests) - - task: Bash@3 - displayName: Install dependencies - ${{ testPackage }} - retryCountOnTaskFailure: 4 - inputs: - workingDirectory: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} - targetType: 'inline' - script: 'npm install' + # Install package dependencies (this gets devDependencies installed so we can then run the package's tests). + - template: /tools/pipelines/templates/include-copy-dev-dependencies.yml@self + parameters: + sourcePackageLocation: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} + destPackageLocation: $(Build.SourcesDirectory) # Run tests - task: Npm@1 @@ -298,12 +301,11 @@ stages: displayName: Write measurements to Aria/Kusto inputs: targetType: 'inline' - workingDirectory: $(pathToTelemetryGenerator) script: | set -eu -o pipefail echo "Write the following benchmark output to Aria/Kusto"; ls -laR ${{ variables.consolidatedTestsOutputFolder }}; - npx telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlers)/memoryUsageTestHandler.js --dir ${{ variables.consolidatedTestsOutputFolder }}; + pnpm exec telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlersNew)/memoryUsageTestHandler.js --dir ${{ variables.consolidatedTestsOutputFolder }}; - task: PublishPipelineArtifact@1 displayName: Publish Artifact - Perf tests output - memory usage @@ -338,8 +340,6 @@ stages: artifactBuildId: $(artifactBuildId) artifactPipeline: $(artifactPipeline) testFilesPath: $(testFilesPath) - testWorkspace: $(testWorkspace) - pathForTelemetryGeneratorInstall: $(pathToTelemetryGenerator) # Run tests for each package that has them - ${{ each testPackage in parameters.customBenchmarkTestPackages }}: @@ -373,14 +373,11 @@ stages: tar --extract --verbose --file $TAR_PATH ./dist/test tar --extract --verbose --file $TAR_PATH ./src/test - # Install package dependencies (this gets devDependencies installed so we can then run the package's tests) - - task: Bash@3 - displayName: Install dependencies - ${{ testPackage }} - retryCountOnTaskFailure: 4 - inputs: - workingDirectory: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} - targetType: 'inline' - script: 'npm install' + # Install package dependencies (this gets devDependencies installed so we can then run the package's tests). + - template: /tools/pipelines/templates/include-copy-dev-dependencies.yml@self + parameters: + sourcePackageLocation: ${{ variables.testWorkspace }}/node_modules/${{ testPackage }} + destPackageLocation: $(Build.SourcesDirectory) - task: Npm@1 displayName: Run custom data performance tests - ${{ testPackage }} @@ -412,12 +409,11 @@ stages: displayName: Write measurements to Aria/Kusto inputs: targetType: 'inline' - workingDirectory: $(pathToTelemetryGenerator) script: | set -eu -o pipefail echo "Write the following benchmark output to Aria/Kusto"; ls -laR ${{ variables.consolidatedTestsOutputFolder }}; - npx telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlers)/customBenchmarkHandler.js --dir ${{ variables.consolidatedTestsOutputFolder }}; + pnpm exec telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlersNew)/customBenchmarkHandler.js --dir ${{ variables.consolidatedTestsOutputFolder }}; - task: PublishPipelineArtifact@1 displayName: Publish Artifact - Perf tests output - custom data usage @@ -468,8 +464,6 @@ stages: artifactBuildId: $(artifactBuildId) artifactPipeline: $(artifactPipeline) testFilesPath: $(testFilesPath) - testWorkspace: $(testWorkspace) - pathForTelemetryGeneratorInstall: $(pathToTelemetryGenerator) endpointName: ${{ endpointObject.endpointName }} # Download and install package with performance tests @@ -480,13 +474,11 @@ stages: testPackageName: $(testPackage) installPath: $(testWorkspace) - - task: Bash@3 - displayName: Install dependencies - ${{ endpointObject.endpointName }} - retryCountOnTaskFailure: 4 - inputs: - workingDirectory: ${{ variables.testWorkspace }}/node_modules/${{ variables.testPackage }} - targetType: 'inline' - script: 'npm install' + # Install package dependencies (this gets devDependencies installed so we can then run the package's tests). + - template: /tools/pipelines/templates/include-copy-dev-dependencies.yml@self + parameters: + sourcePackageLocation: ${{ variables.testWorkspace }}/node_modules/$(testPackage) + destPackageLocation: $(Build.SourcesDirectory) # We run both types of tests in the same bash step so we can make sure to run the second set even if the first # one fails. @@ -551,12 +543,11 @@ stages: condition: succeededOrFailed() inputs: targetType: 'inline' - workingDirectory: $(pathToTelemetryGenerator) script: | set -eu -o pipefail echo "Writing the following performance tests results to Aria/Kusto - ${{ endpointObject.endpointName }}" ls -la ${{ variables.executionTimeTestOutputFolder }}; - npx telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlers)/executionTimeTestHandler.js --dir ${{ variables.executionTimeTestOutputFolder }}; + pnpm exec telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlersNew)/executionTimeTestHandler.js --dir ${{ variables.executionTimeTestOutputFolder }}; env: FLUID_ENDPOINTNAME: ${{ endpointObject.endpointName }} @@ -565,12 +556,11 @@ stages: condition: succeededOrFailed() inputs: targetType: 'inline' - workingDirectory: $(pathToTelemetryGenerator) script: | set -eu -o pipefail echo "Writing the following performance tests results to Aria/Kusto - ${{ endpointObject.endpointName }}" ls -la ${{ variables.memoryUsageTestOutputFolder }}; - npx telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlers)/memoryUsageTestHandler.js --dir ${{ variables.memoryUsageTestOutputFolder }}; + pnpm exec telemetry-generator --handlerModule $(pathToTelemetryGeneratorHandlersNew)/memoryUsageTestHandler.js --dir ${{ variables.memoryUsageTestOutputFolder }}; env: FLUID_ENDPOINTNAME: ${{ endpointObject.endpointName }} @@ -593,7 +583,7 @@ stages: displayName: Remove Output Folders from local server run ${{ endpointObject.endpointName }} inputs: targetType: 'inline' - workingDirectory: $(pathToTelemetryGenerator) + workingDirectory: $(pathToTelemetryGeneratorNew) script: | set -eu -o pipefail ls -laR ${{ variables.executionTimeTestOutputFolder }}; @@ -626,7 +616,7 @@ stages: script: | set -eu -o pipefail - npx --package=@ff-internal/trips-setup@0.0.5 -- trips-cleanup --reservationId=$(stringBearerToken) + pnpm exec trips-cleanup --reservationId=$(stringBearerToken) condition: eq(variables['tenantSetupSuccess'], 'true') - template: /tools/pipelines/templates/include-upload-npm-logs.yml@self