From a06ce1f7c500313f1f317ec68bb5c98f5aef1728 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 26 Jun 2023 14:44:50 -0600 Subject: [PATCH 01/27] fix: unset aliases and configs when org is deleted --- src/org/org.ts | 15 ++++++++++++++- test/unit/org/orgTest.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/org/org.ts b/src/org/org.ts index 713c780905..5ea9f0c402 100644 --- a/src/org/org.ts +++ b/src/org/org.ts @@ -1131,7 +1131,20 @@ export class Org extends AsyncOptionalCreatable { try { const devHubConn = devHub.getConnection(); - const username = this.getUsername(); + const username = ensureString(this.getUsername()); + + // unset any aliases referencing this org + const stateAgg = await StateAggregator.getInstance(); + const existingAliases = stateAgg.aliases.getAll(username); + await stateAgg.aliases.unsetValuesAndSave(existingAliases); + + // unset any configs referencing this org + const config = await Config.create(); + [...existingAliases, username] + .map((name) => config.getKeysByValue(name)) + .map((keys) => keys.map((k) => config.unset(k))); + await config.write(); + const activeScratchOrgRecordId = ( await devHubConn.singleRecordQuery<{ Id: string }>( `SELECT Id FROM ActiveScratchOrg WHERE SignupUsername='${username}'` diff --git a/test/unit/org/orgTest.ts b/test/unit/org/orgTest.ts index 6298d3c017..d578cf8b0c 100644 --- a/test/unit/org/orgTest.ts +++ b/test/unit/org/orgTest.ts @@ -329,6 +329,39 @@ describe('Org Tests', () => { } }); + it('should unset the alias and any configs', async () => { + const dev = await createOrgViaAuthInfo(testData.username); + + const orgTestData = new MockTestOrgData(); + const org = await createOrgViaAuthInfo(orgTestData.username, orgTestData); + const username = ensureString(org.getUsername()); + $$.setConfigStubContents('Config', { contents: { [OrgConfigProperties.TARGET_ORG]: username } }); + expect($$.getConfigStubContents('Config')).to.deep.equal({ 'target-org': username }); + const stateAggregator = await StateAggregator.getInstance(); + + await stateAggregator.aliases.setAndSave('deleteThisAlias', username); + expect(stateAggregator.aliases.getUsername('deleteThisAlias')).to.equal(username); + + const devHubQuery = stubMethod($$.SANDBOX, Connection.prototype, 'singleRecordQuery').resolves({ + Id: orgTestData.orgId, + }); + const devHubDelete = stubMethod($$.SANDBOX, Org.prototype, 'destroyScratchOrg').resolves(); + $$.SANDBOX.stub(org, 'getDevHubOrg').resolves(dev); + + await org.delete(); + + expect($$.getConfigStubContents('Config')).to.deep.equal({}); + + expect(stateAggregator.aliases.get(username)).to.be.null; + expect(devHubQuery.calledOnce).to.be.true; + expect(devHubQuery.firstCall.args[0]).to.equal( + `SELECT Id FROM ActiveScratchOrg WHERE SignupUsername='${orgTestData.username}'` + ); + + expect(devHubDelete.calledOnce).to.be.true; + expect(devHubDelete.firstCall.args[1]).to.equal(orgTestData.orgId); + }); + it('should handle SingleRecordQueryErrors.NoRecords errors', async () => { const dev = await createOrgViaAuthInfo(); From b28ef5b29a28be76eb7fbe2ff0a99b2515ea0e25 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 26 Jun 2023 14:46:20 -0600 Subject: [PATCH 02/27] chore: flatMap change --- src/org/org.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/org/org.ts b/src/org/org.ts index 5ea9f0c402..2624a4d255 100644 --- a/src/org/org.ts +++ b/src/org/org.ts @@ -1140,9 +1140,7 @@ export class Org extends AsyncOptionalCreatable { // unset any configs referencing this org const config = await Config.create(); - [...existingAliases, username] - .map((name) => config.getKeysByValue(name)) - .map((keys) => keys.map((k) => config.unset(k))); + [...existingAliases, username].flatMap((name) => config.getKeysByValue(name)).map((key) => config.unset(key)); await config.write(); const activeScratchOrgRecordId = ( From 04367955b4b5e2b0150486a204f08986c2030033 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 26 Jun 2023 15:07:05 -0600 Subject: [PATCH 03/27] chore: bump jsforce --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a5788010f0..716aa12533 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "faye": "^1.4.0", "form-data": "^4.0.0", "js2xmlparser": "^4.0.1", - "jsforce": "^2.0.0-beta.25", + "jsforce": "^2.0.0-beta.27", "jsonwebtoken": "9.0.0", "jszip": "3.10.1", "proper-lockfile": "^4.1.2", @@ -171,4 +171,4 @@ ] } } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 6b7960f2f9..4548a33ab4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2976,10 +2976,10 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -jsforce@^2.0.0-beta.25: - version "2.0.0-beta.25" - resolved "https://registry.yarnpkg.com/jsforce/-/jsforce-2.0.0-beta.25.tgz#120a3999babf96ae18ab8f1232003d56588a9ca5" - integrity sha512-ZtzwJErI4SSJYWrGAw0mHEHPZRB4Idz0RiXHakCtEgEjEWt6JIDR4sNbWRHUzWHdEO4O61z2YSBvdOuag1hkWg== +jsforce@^2.0.0-beta.27: + version "2.0.0-beta.27" + resolved "https://registry.yarnpkg.com/jsforce/-/jsforce-2.0.0-beta.27.tgz#ba822b18b77bea4529491060a9b07bc1009735ac" + integrity sha512-d9dDWWeHwayRKPo8FJBAIUyk8sNXGSHwdUjR6al3yK0YKci27Jc1XfNaQTxEAuymHQJVaCb1gxTKqmA4uznFdQ== dependencies: "@babel/runtime" "^7.12.5" "@babel/runtime-corejs3" "^7.12.5" From 56b3ea1ff886d1a93c84effa709699b3fc3b1035 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 26 Jun 2023 16:05:41 -0600 Subject: [PATCH 04/27] chore: move it so that it works when deleting sandboxes as well --- src/org/org.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/org/org.ts b/src/org/org.ts index 2624a4d255..abdbbb7cd0 100644 --- a/src/org/org.ts +++ b/src/org/org.ts @@ -507,6 +507,18 @@ export class Org extends AsyncOptionalCreatable { * Will delete 'this' instance remotely and any files locally */ public async delete(): Promise { + const username = ensureString(this.getUsername()); + + // unset any aliases referencing this org + const stateAgg = await StateAggregator.getInstance(); + const existingAliases = stateAgg.aliases.getAll(username); + await stateAgg.aliases.unsetValuesAndSave(existingAliases); + + // unset any configs referencing this org + const config = await Config.create(); + [...existingAliases, username].flatMap((name) => config.getKeysByValue(name)).map((key) => config.unset(key)); + await config.write(); + if (await this.isSandbox()) { await this.deleteSandbox(); } else { @@ -1131,17 +1143,7 @@ export class Org extends AsyncOptionalCreatable { try { const devHubConn = devHub.getConnection(); - const username = ensureString(this.getUsername()); - - // unset any aliases referencing this org - const stateAgg = await StateAggregator.getInstance(); - const existingAliases = stateAgg.aliases.getAll(username); - await stateAgg.aliases.unsetValuesAndSave(existingAliases); - - // unset any configs referencing this org - const config = await Config.create(); - [...existingAliases, username].flatMap((name) => config.getKeysByValue(name)).map((key) => config.unset(key)); - await config.write(); + const username = this.getUsername(); const activeScratchOrgRecordId = ( await devHubConn.singleRecordQuery<{ Id: string }>( From d9073503abc18f5e4f4f4aa378823c94a4dd1b19 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 18:18:53 -0500 Subject: [PATCH 05/27] test: perf attempt --- .github/workflows/perf.yml | 40 +++++++++++++++++++++++++++++++++++ package.json | 7 ++++-- test/perf/logger/main.test.ts | 32 ++++++++++++++++++++++++++++ test/tsconfig.json | 2 +- yarn.lock | 20 +++++++++++++++++- 5 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/perf.yml create mode 100644 test/perf/logger/main.test.ts diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml new file mode 100644 index 0000000000..a33f7d84e3 --- /dev/null +++ b/.github/workflows/perf.yml @@ -0,0 +1,40 @@ +# runs some very-large-repo tests (for windows filesystem limits) and commits perf results for comparison +name: perf-tests +on: + push: + branches-ignore: [main] + workflow_dispatch: + +# linux will finish ahead of windows, but prevent other branches/commits from hitting simultaneously +# since we're pushing git commits and there would be conflicts +concurrency: perf-test + +jobs: + perf-tests: + strategy: + matrix: + os: [ubuntu-latest] + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + cache: yarn + - run: yarn test:perf | tee output.text + + # Run `github-action-benchmark` action + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a + with: + tool: 'benchmarkjs' + output-file-path: output.json + comment-on-alert: true + fail-on-alert: true + # Push and deploy GitHub pages branch automatically + # this has a bug where it creates duplicate commits when summary-always and aut-push are both true + # summary-always: true + comment-always: true + benchmark-data-dir-path: perf-${{ runner.os}} + auto-push: true + github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} diff --git a/package.json b/package.json index a5788010f0..8aa08ed640 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "prepack": "sf-prepack", "prepare": "sf-install", "test": "wireit", - "test:only": "wireit" + "test:only": "wireit", + "test:perf": "ts-node test/perf/logger/main.test.ts" }, "keywords": [ "force", @@ -60,6 +61,7 @@ "@salesforce/dev-scripts": "^5.4.2", "@salesforce/prettier-config": "^0.0.3", "@salesforce/ts-sinon": "^1.4.8", + "@types/benchmark": "^2.1.2", "@types/chai-string": "^1.4.2", "@types/debug": "0.0.31", "@types/jsonwebtoken": "9.0.2", @@ -68,6 +70,7 @@ "@types/shelljs": "0.8.12", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.11", + "benchmark": "^2.1.4", "chai": "^4.3.7", "chai-string": "^1.5.0", "eslint": "^8.43.0", @@ -171,4 +174,4 @@ ] } } -} \ No newline at end of file +} diff --git a/test/perf/logger/main.test.ts b/test/perf/logger/main.test.ts new file mode 100644 index 0000000000..e11ba0a4fe --- /dev/null +++ b/test/perf/logger/main.test.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023, salesforce.com, inc. + * All rights reserved. + * Licensed under the BSD 3-Clause license. + * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ +import { Suite } from 'benchmark'; + +const suite = new Suite(); + +// add tests +suite + .add('RegExp#test', () => { + // eslint-disable-next-line @typescript-eslint/prefer-includes + /o/.test('Hello World!'); + }) + .add('String#indexOf', () => { + 'Hello World!'.includes('o'); + }) + // add listeners + .on('cycle', (event: any) => { + // eslint-disable-next-line no-console, @typescript-eslint/no-unsafe-member-access + console.log(String(event.target)); + }) + // .on('complete', function () { + // const fastest = this.filter('fastest').map('name'); + + // // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-plus-operands + // console.log('Fastest is ' + fastest); + // }) + // run async + .run({ async: true }); diff --git a/test/tsconfig.json b/test/tsconfig.json index 4cd4d8cb7c..9bd21999ad 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "@salesforce/dev-config/tsconfig-test-strict", - "include": ["unit/**/*.ts"], + "include": ["unit/**/*.ts", "perf/**/*.ts"], "compilerOptions": { "noEmit": true, "skipLibCheck": true, diff --git a/yarn.lock b/yarn.lock index 6b7960f2f9..27fee592fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -703,6 +703,11 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== +"@types/benchmark@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@types/benchmark/-/benchmark-2.1.2.tgz#b7838408c93dc08ceb4e6e13147dbfbe6a151f82" + integrity sha512-EDKtLYNMKrig22jEvhXq8TBFyFgVNSPmDF2b9UzJ7+eylPqdZVo17PCUMkn1jP6/1A/0u78VqYC6VrX6b8pDWA== + "@types/chai-string@^1.4.2": version "1.4.2" resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.4.2.tgz#0f116504a666b6c6a3c42becf86634316c9a19ac" @@ -1179,6 +1184,14 @@ base64url@^3.0.1: resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== +benchmark@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/benchmark/-/benchmark-2.1.4.tgz#09f3de31c916425d498cc2ee565a0ebf3c2a5629" + integrity sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ== + dependencies: + lodash "^4.17.4" + platform "^1.3.3" + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -3201,7 +3214,7 @@ lodash.upperfirst@^4.3.1: resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg== -lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21: +lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3824,6 +3837,11 @@ pkg-dir@^4.1.0: dependencies: find-up "^4.0.0" +platform@^1.3.3: + version "1.3.6" + resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7" + integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" From e91f910bcb75322867ff798f75f5cf0e8f6cf921 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 18:21:03 -0500 Subject: [PATCH 06/27] test: only perf tests for now --- .github/workflows/test.yml | 70 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5a38d5182..c3ff858f92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,41 +7,41 @@ on: jobs: yarn-lockfile-check: uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main - # Since the Windows unit tests take much longer, we run the linux unit tests first and then run the windows unit tests in parallel with NUTs - linux-unit-tests: - needs: yarn-lockfile-check - uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main - windows-unit-tests: - needs: linux-unit-tests - uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main - nuts: - needs: linux-unit-tests - uses: salesforcecli/github-workflows/.github/workflows/externalNut.yml@main - strategy: - fail-fast: false - matrix: - os: ['ubuntu-latest', 'windows-latest'] - externalProjectGitUrl: - - https://github.com/salesforcecli/plugin-auth - - https://github.com/salesforcecli/plugin-custom-metadata - - https://github.com/salesforcecli/plugin-data - - https://github.com/salesforcecli/plugin-env - - https://github.com/salesforcecli/plugin-limits - - https://github.com/salesforcecli/plugin-org - - https://github.com/salesforcecli/plugin-schema - - https://github.com/salesforcecli/plugin-settings - - https://github.com/salesforcecli/plugin-signups - - https://github.com/salesforcecli/plugin-templates - - https://github.com/salesforcecli/plugin-user - with: - packageName: '@salesforce/core' - externalProjectGitUrl: ${{ matrix.externalProjectGitUrl }} - command: 'yarn test:nuts' - os: ${{ matrix.os }} - useCache: false - preSwapCommands: 'yarn upgrade jsforce@beta; npx yarn-deduplicate; yarn install' - preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' - secrets: inherit + # # Since the Windows unit tests take much longer, we run the linux unit tests first and then run the windows unit tests in parallel with NUTs + # linux-unit-tests: + # needs: yarn-lockfile-check + # uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main + # windows-unit-tests: + # needs: linux-unit-tests + # uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main + # nuts: + # needs: linux-unit-tests + # uses: salesforcecli/github-workflows/.github/workflows/externalNut.yml@main + # strategy: + # fail-fast: false + # matrix: + # os: ['ubuntu-latest', 'windows-latest'] + # externalProjectGitUrl: + # - https://github.com/salesforcecli/plugin-auth + # - https://github.com/salesforcecli/plugin-custom-metadata + # - https://github.com/salesforcecli/plugin-data + # - https://github.com/salesforcecli/plugin-env + # - https://github.com/salesforcecli/plugin-limits + # - https://github.com/salesforcecli/plugin-org + # - https://github.com/salesforcecli/plugin-schema + # - https://github.com/salesforcecli/plugin-settings + # - https://github.com/salesforcecli/plugin-signups + # - https://github.com/salesforcecli/plugin-templates + # - https://github.com/salesforcecli/plugin-user + # with: + # packageName: '@salesforce/core' + # externalProjectGitUrl: ${{ matrix.externalProjectGitUrl }} + # command: 'yarn test:nuts' + # os: ${{ matrix.os }} + # useCache: false + # preSwapCommands: 'yarn upgrade jsforce@beta; npx yarn-deduplicate; yarn install' + # preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' + # secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: # needs: unit-tests From a45fdd8b8210ae0a4d5b5a82b056e61e8f4fa6d8 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 18:22:23 -0500 Subject: [PATCH 07/27] test: filename --- .github/workflows/perf.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index a33f7d84e3..6dc9e5c34d 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -21,14 +21,14 @@ jobs: - uses: actions/setup-node@v3 with: cache: yarn - - run: yarn test:perf | tee output.text + - run: yarn test:perf | tee output.txt # Run `github-action-benchmark` action - name: Store benchmark result uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a with: tool: 'benchmarkjs' - output-file-path: output.json + output-file-path: output.txt comment-on-alert: true fail-on-alert: true # Push and deploy GitHub pages branch automatically From 428d3b00dcb73137fad5f469a3d20bc4ba25137f Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 18:25:13 -0500 Subject: [PATCH 08/27] test: npm not yarn --- .github/workflows/perf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 6dc9e5c34d..9eabc29285 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/setup-node@v3 with: cache: yarn - - run: yarn test:perf | tee output.txt + - run: npm run test:perf | tee output.txt # Run `github-action-benchmark` action - name: Store benchmark result From b04ec4177a139e5ed7409bca0b6c0fc06cbc877d Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 18:38:14 -0500 Subject: [PATCH 09/27] test: install deps --- .github/workflows/perf.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 9eabc29285..c79ddc5fa7 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-node@v3 with: cache: yarn + - run: yarn install - run: npm run test:perf | tee output.txt # Run `github-action-benchmark` action From d3a051a928e412ef7abe26b61015b115d96f3435 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 18:50:45 -0500 Subject: [PATCH 10/27] test: logger specific tests --- test/perf/logger/main.test.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/test/perf/logger/main.test.ts b/test/perf/logger/main.test.ts index e11ba0a4fe..e39e0aac4e 100644 --- a/test/perf/logger/main.test.ts +++ b/test/perf/logger/main.test.ts @@ -5,17 +5,32 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { Suite } from 'benchmark'; +import { Logger } from '../../../src/exported'; const suite = new Suite(); +const logger = new Logger('Benchmarks'); + // add tests suite - .add('RegExp#test', () => { + .add('Child logger creation', () => { // eslint-disable-next-line @typescript-eslint/prefer-includes - /o/.test('Hello World!'); + Logger.childFromRoot('benchmarkChild'); + }) + .add('Logging a string on root logger', () => { + logger.debug('this is a string'); + }) + .add('Logging an object on root logger', () => { + logger.debug({ foo: 1, bar: 2, baz: 3 }); + }) + .add('Logging an object with a message on root logger', () => { + logger.debug({ foo: 1, bar: 2, baz: 3 }, 'this is a message'); + }) + .add('Logging an object with a redacted prop on root logger', () => { + logger.debug({ foo: 1, bar: 2, accessToken: '00D' }); }) - .add('String#indexOf', () => { - 'Hello World!'.includes('o'); + .add('Logging a nested 3-level object on root logger', () => { + logger.debug({ foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: 3 } } }); }) // add listeners .on('cycle', (event: any) => { From ccb69d0034589f734f56394307deb745e6b95b1c Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 19:05:32 -0500 Subject: [PATCH 11/27] test: with cache --- .github/workflows/perf.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index c79ddc5fa7..e89cd70533 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -22,6 +22,11 @@ jobs: with: cache: yarn - run: yarn install + - name: Download previous benchmark data + uses: actions/cache@v3 + with: + path: ./cache + key: ${{ runner.os }}-benchmark - run: npm run test:perf | tee output.txt # Run `github-action-benchmark` action @@ -30,6 +35,7 @@ jobs: with: tool: 'benchmarkjs' output-file-path: output.txt + external-data-json-path: ./cache/${{ runner.os }}-benchmark-data.json comment-on-alert: true fail-on-alert: true # Push and deploy GitHub pages branch automatically From 8708626d019ac4649fbfbabcc4c327b750424007 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 19:10:34 -0500 Subject: [PATCH 12/27] test: no autopush --- .github/workflows/perf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index e89cd70533..04560a3909 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -43,5 +43,5 @@ jobs: # summary-always: true comment-always: true benchmark-data-dir-path: perf-${{ runner.os}} - auto-push: true + # auto-push: true github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} From 5f9a3c2b23424a5f681dc1dc1247e93713a0271c Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 19:24:46 -0500 Subject: [PATCH 13/27] test: new output file path --- .github/workflows/perf.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 04560a3909..0ae44bbc3b 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -27,15 +27,14 @@ jobs: with: path: ./cache key: ${{ runner.os }}-benchmark - - run: npm run test:perf | tee output.txt + - run: npm run test:perf | tee test/perf/output.txt # Run `github-action-benchmark` action - name: Store benchmark result uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a with: tool: 'benchmarkjs' - output-file-path: output.txt - external-data-json-path: ./cache/${{ runner.os }}-benchmark-data.json + output-file-path: test/perf/output.txt comment-on-alert: true fail-on-alert: true # Push and deploy GitHub pages branch automatically @@ -43,5 +42,5 @@ jobs: # summary-always: true comment-always: true benchmark-data-dir-path: perf-${{ runner.os}} - # auto-push: true + auto-push: true github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} From edf6ad5d0a97564ec2e098a024d39a31950ba2e4 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 19:56:47 -0500 Subject: [PATCH 14/27] test: perf on windows --- .github/workflows/perf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 0ae44bbc3b..286508e758 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -13,7 +13,7 @@ jobs: perf-tests: strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest] fail-fast: false runs-on: ${{ matrix.os }} steps: From e7258d67c8f4e2537392b8ce5b5cae5aaf3569f2 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 20:36:08 -0500 Subject: [PATCH 15/27] style: remove example comments --- test/perf/logger/main.test.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/perf/logger/main.test.ts b/test/perf/logger/main.test.ts index e39e0aac4e..d4bd34cefa 100644 --- a/test/perf/logger/main.test.ts +++ b/test/perf/logger/main.test.ts @@ -37,11 +37,4 @@ suite // eslint-disable-next-line no-console, @typescript-eslint/no-unsafe-member-access console.log(String(event.target)); }) - // .on('complete', function () { - // const fastest = this.filter('fastest').map('name'); - - // // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-plus-operands - // console.log('Fastest is ' + fastest); - // }) - // run async .run({ async: true }); From d706ceead6c567cef703977d2db22b7354e9d41d Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 20:55:14 -0500 Subject: [PATCH 16/27] test: os and name --- .github/workflows/perf.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 286508e758..80763f694d 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -33,6 +33,7 @@ jobs: - name: Store benchmark result uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a with: + name: Logger Benchmarks ${{ runner.os}} tool: 'benchmarkjs' output-file-path: test/perf/output.txt comment-on-alert: true From 59d29943c97a5cf996abc6e29fbc730e19e1cf0f Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 21:02:05 -0500 Subject: [PATCH 17/27] test: revert os and name --- .github/workflows/perf.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 80763f694d..286508e758 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -33,7 +33,6 @@ jobs: - name: Store benchmark result uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a with: - name: Logger Benchmarks ${{ runner.os}} tool: 'benchmarkjs' output-file-path: test/perf/output.txt comment-on-alert: true From 2587fdd632e7aa20ed507532d5a6fb966423b698 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 21:36:43 -0500 Subject: [PATCH 18/27] docs: readme and Benchmark names --- .github/workflows/perf.yml | 1 + README.md | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 286508e758..7155ec299f 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -33,6 +33,7 @@ jobs: - name: Store benchmark result uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a with: + name: Logger Benchmarks - ${{ matrix.os }} tool: 'benchmarkjs' output-file-path: test/perf/output.txt comment-on-alert: true diff --git a/README.md b/README.md index 5732478eb1..233705ac90 100644 --- a/README.md +++ b/README.md @@ -69,3 +69,13 @@ In your plugin or library, } ``` + +## Performance Testing + +There are some benchmark.js checks to get a baseline for Logger performance. +https://forcedotcom.github.io/sfdx-core/perf-Linux +https://forcedotcom.github.io/sfdx-core/perf-Windows + +You can add more test cases in test/perf/logger/main.js + +If you add tests for new parts of sfdx-core outside of Logger, add new test Suites and create new jobs in the GHA `perf.yml` From d62da0186fe4031acc248dec68ce7b2b619cab6b Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 27 Jun 2023 21:41:42 -0500 Subject: [PATCH 19/27] test: restore all tests --- .github/workflows/test.yml | 70 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3ff858f92..f5a38d5182 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,41 +7,41 @@ on: jobs: yarn-lockfile-check: uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main - # # Since the Windows unit tests take much longer, we run the linux unit tests first and then run the windows unit tests in parallel with NUTs - # linux-unit-tests: - # needs: yarn-lockfile-check - # uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main - # windows-unit-tests: - # needs: linux-unit-tests - # uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main - # nuts: - # needs: linux-unit-tests - # uses: salesforcecli/github-workflows/.github/workflows/externalNut.yml@main - # strategy: - # fail-fast: false - # matrix: - # os: ['ubuntu-latest', 'windows-latest'] - # externalProjectGitUrl: - # - https://github.com/salesforcecli/plugin-auth - # - https://github.com/salesforcecli/plugin-custom-metadata - # - https://github.com/salesforcecli/plugin-data - # - https://github.com/salesforcecli/plugin-env - # - https://github.com/salesforcecli/plugin-limits - # - https://github.com/salesforcecli/plugin-org - # - https://github.com/salesforcecli/plugin-schema - # - https://github.com/salesforcecli/plugin-settings - # - https://github.com/salesforcecli/plugin-signups - # - https://github.com/salesforcecli/plugin-templates - # - https://github.com/salesforcecli/plugin-user - # with: - # packageName: '@salesforce/core' - # externalProjectGitUrl: ${{ matrix.externalProjectGitUrl }} - # command: 'yarn test:nuts' - # os: ${{ matrix.os }} - # useCache: false - # preSwapCommands: 'yarn upgrade jsforce@beta; npx yarn-deduplicate; yarn install' - # preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' - # secrets: inherit + # Since the Windows unit tests take much longer, we run the linux unit tests first and then run the windows unit tests in parallel with NUTs + linux-unit-tests: + needs: yarn-lockfile-check + uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main + windows-unit-tests: + needs: linux-unit-tests + uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main + nuts: + needs: linux-unit-tests + uses: salesforcecli/github-workflows/.github/workflows/externalNut.yml@main + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest', 'windows-latest'] + externalProjectGitUrl: + - https://github.com/salesforcecli/plugin-auth + - https://github.com/salesforcecli/plugin-custom-metadata + - https://github.com/salesforcecli/plugin-data + - https://github.com/salesforcecli/plugin-env + - https://github.com/salesforcecli/plugin-limits + - https://github.com/salesforcecli/plugin-org + - https://github.com/salesforcecli/plugin-schema + - https://github.com/salesforcecli/plugin-settings + - https://github.com/salesforcecli/plugin-signups + - https://github.com/salesforcecli/plugin-templates + - https://github.com/salesforcecli/plugin-user + with: + packageName: '@salesforce/core' + externalProjectGitUrl: ${{ matrix.externalProjectGitUrl }} + command: 'yarn test:nuts' + os: ${{ matrix.os }} + useCache: false + preSwapCommands: 'yarn upgrade jsforce@beta; npx yarn-deduplicate; yarn install' + preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' + secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: # needs: unit-tests From af4e0716272de067d5393cc95b433184f0164bcd Mon Sep 17 00:00:00 2001 From: mshanemc Date: Wed, 28 Jun 2023 10:04:44 -0500 Subject: [PATCH 20/27] test: use warn level to capture real (non-noop) traffic --- test/perf/logger/main.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/perf/logger/main.test.ts b/test/perf/logger/main.test.ts index d4bd34cefa..b1f8a71e61 100644 --- a/test/perf/logger/main.test.ts +++ b/test/perf/logger/main.test.ts @@ -18,19 +18,19 @@ suite Logger.childFromRoot('benchmarkChild'); }) .add('Logging a string on root logger', () => { - logger.debug('this is a string'); + logger.warn('this is a string'); }) .add('Logging an object on root logger', () => { - logger.debug({ foo: 1, bar: 2, baz: 3 }); + logger.warn({ foo: 1, bar: 2, baz: 3 }); }) .add('Logging an object with a message on root logger', () => { - logger.debug({ foo: 1, bar: 2, baz: 3 }, 'this is a message'); + logger.warn({ foo: 1, bar: 2, baz: 3 }, 'this is a message'); }) .add('Logging an object with a redacted prop on root logger', () => { - logger.debug({ foo: 1, bar: 2, accessToken: '00D' }); + logger.warn({ foo: 1, bar: 2, accessToken: '00D' }); }) .add('Logging a nested 3-level object on root logger', () => { - logger.debug({ foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: 3 } } }); + logger.warn({ foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: 3 } } }); }) // add listeners .on('cycle', (event: any) => { From af8eb5db754f74458727002e39283b2931bc0c5e Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Wed, 28 Jun 2023 09:23:05 -0600 Subject: [PATCH 21/27] chore: qa changes --- src/config/configAggregator.ts | 14 ++++++++++---- src/org/org.ts | 4 +--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/config/configAggregator.ts b/src/config/configAggregator.ts index d170976bdf..412d21f207 100644 --- a/src/config/configAggregator.ts +++ b/src/config/configAggregator.ts @@ -80,8 +80,8 @@ export class ConfigAggregator extends AsyncOptionalCreatable = {}; /** @@ -334,6 +334,13 @@ export class ConfigAggregator extends AsyncOptionalCreatable { + this.localConfig?.getKeysByValue(key).map((k) => this.localConfig?.unset(k)); + this.globalConfig?.getKeysByValue(key).map((k) => this.globalConfig?.unset(k)); + await this.localConfig?.write(); + await this.globalConfig?.write(); + } + /** * Get the config properties that are environment variables. */ @@ -412,8 +419,7 @@ export class ConfigAggregator extends AsyncOptionalCreatable merge(acc, el), json); - return reduced; + return configs.filter(isJsonMap).reduce((acc: JsonMap, el: AnyJson) => merge(acc, el), json); } } diff --git a/src/org/org.ts b/src/org/org.ts index abdbbb7cd0..140e5d33de 100644 --- a/src/org/org.ts +++ b/src/org/org.ts @@ -515,9 +515,7 @@ export class Org extends AsyncOptionalCreatable { await stateAgg.aliases.unsetValuesAndSave(existingAliases); // unset any configs referencing this org - const config = await Config.create(); - [...existingAliases, username].flatMap((name) => config.getKeysByValue(name)).map((key) => config.unset(key)); - await config.write(); + [...existingAliases, username].flatMap((name) => this.configAggregator.unsetByValue(name)); if (await this.isSandbox()) { await this.deleteSandbox(); From b3960eb65378117a27e3b55210fe08d0f17d4055 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Wed, 28 Jun 2023 16:24:42 -0600 Subject: [PATCH 22/27] chore: write only when needed --- src/config/configAggregator.ts | 14 ++++++++++---- test/unit/org/orgTest.ts | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/config/configAggregator.ts b/src/config/configAggregator.ts index 412d21f207..03c75cb2ff 100644 --- a/src/config/configAggregator.ts +++ b/src/config/configAggregator.ts @@ -335,10 +335,16 @@ export class ConfigAggregator extends AsyncOptionalCreatable { - this.localConfig?.getKeysByValue(key).map((k) => this.localConfig?.unset(k)); - this.globalConfig?.getKeysByValue(key).map((k) => this.globalConfig?.unset(k)); - await this.localConfig?.write(); - await this.globalConfig?.write(); + const hasLocalWrites = this.localConfig + ?.getKeysByValue(key) + .map((k) => this.localConfig?.unset(k)) + .some(Boolean); + if (hasLocalWrites) await this.localConfig?.write(); + const hasGlobalWrites = this.globalConfig + ?.getKeysByValue(key) + .map((k) => this.globalConfig?.unset(k)) + .some(Boolean); + if (hasGlobalWrites) await this.globalConfig?.write(); } /** diff --git a/test/unit/org/orgTest.ts b/test/unit/org/orgTest.ts index d578cf8b0c..9d26db419b 100644 --- a/test/unit/org/orgTest.ts +++ b/test/unit/org/orgTest.ts @@ -331,13 +331,13 @@ describe('Org Tests', () => { it('should unset the alias and any configs', async () => { const dev = await createOrgViaAuthInfo(testData.username); - + const stateAggregator = await StateAggregator.getInstance(); + await ConfigAggregator.create(); const orgTestData = new MockTestOrgData(); const org = await createOrgViaAuthInfo(orgTestData.username, orgTestData); const username = ensureString(org.getUsername()); $$.setConfigStubContents('Config', { contents: { [OrgConfigProperties.TARGET_ORG]: username } }); expect($$.getConfigStubContents('Config')).to.deep.equal({ 'target-org': username }); - const stateAggregator = await StateAggregator.getInstance(); await stateAggregator.aliases.setAndSave('deleteThisAlias', username); expect(stateAggregator.aliases.getUsername('deleteThisAlias')).to.equal(username); From 5c3abfbae6e1cb7471c55aa23afbee4e15c2b0fe Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Wed, 28 Jun 2023 16:37:59 -0600 Subject: [PATCH 23/27] test: fix UT --- test/unit/org/orgTest.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/unit/org/orgTest.ts b/test/unit/org/orgTest.ts index 9d26db419b..5b82500020 100644 --- a/test/unit/org/orgTest.ts +++ b/test/unit/org/orgTest.ts @@ -331,13 +331,17 @@ describe('Org Tests', () => { it('should unset the alias and any configs', async () => { const dev = await createOrgViaAuthInfo(testData.username); - const stateAggregator = await StateAggregator.getInstance(); - await ConfigAggregator.create(); + const configAgg = await ConfigAggregator.create(); + const orgTestData = new MockTestOrgData(); const org = await createOrgViaAuthInfo(orgTestData.username, orgTestData); const username = ensureString(org.getUsername()); $$.setConfigStubContents('Config', { contents: { [OrgConfigProperties.TARGET_ORG]: username } }); - expect($$.getConfigStubContents('Config')).to.deep.equal({ 'target-org': username }); + + await configAgg.reload(); + const stateAggregator = await StateAggregator.getInstance(); + + expect(configAgg.getConfig()).to.deep.equal({ 'target-org': username }); await stateAggregator.aliases.setAndSave('deleteThisAlias', username); expect(stateAggregator.aliases.getUsername('deleteThisAlias')).to.equal(username); @@ -349,8 +353,7 @@ describe('Org Tests', () => { $$.SANDBOX.stub(org, 'getDevHubOrg').resolves(dev); await org.delete(); - - expect($$.getConfigStubContents('Config')).to.deep.equal({}); + expect(configAgg.getConfig()).to.deep.equal({}); expect(stateAggregator.aliases.get(username)).to.be.null; expect(devHubQuery.calledOnce).to.be.true; From b3a3d11469415e7e195e081780ffa449045b8345 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Wed, 28 Jun 2023 16:48:32 -0600 Subject: [PATCH 24/27] test: fix UT --- test/unit/org/orgTest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/org/orgTest.ts b/test/unit/org/orgTest.ts index 5b82500020..f72f8dfb98 100644 --- a/test/unit/org/orgTest.ts +++ b/test/unit/org/orgTest.ts @@ -341,7 +341,7 @@ describe('Org Tests', () => { await configAgg.reload(); const stateAggregator = await StateAggregator.getInstance(); - expect(configAgg.getConfig()).to.deep.equal({ 'target-org': username }); + expect(configAgg.getConfig()['target-org']).to.equal(username); await stateAggregator.aliases.setAndSave('deleteThisAlias', username); expect(stateAggregator.aliases.getUsername('deleteThisAlias')).to.equal(username); @@ -353,7 +353,7 @@ describe('Org Tests', () => { $$.SANDBOX.stub(org, 'getDevHubOrg').resolves(dev); await org.delete(); - expect(configAgg.getConfig()).to.deep.equal({}); + expect(configAgg.getConfig()['target-org']).to.equal(undefined); expect(stateAggregator.aliases.get(username)).to.be.null; expect(devHubQuery.calledOnce).to.be.true; From a548663511e01d19964f3bade9366ca4e23ad63c Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 29 Jun 2023 08:12:46 -0500 Subject: [PATCH 25/27] test: build before perf --- .github/workflows/perf.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 7155ec299f..516e6a55ce 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -22,6 +22,7 @@ jobs: with: cache: yarn - run: yarn install + - run: yarn build - name: Download previous benchmark data uses: actions/cache@v3 with: From be3aee2247a9fb84a355e009cecd0da34a25477f Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 29 Jun 2023 08:14:16 -0500 Subject: [PATCH 26/27] test: longer timeout for window lts-1 --- .mocharc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mocharc.json b/.mocharc.json index 90d4ee892d..8bb562fc13 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -4,5 +4,5 @@ "watch-files": ["src", "test"], "recursive": true, "reporter": "spec", - "timeout": 10000 + "timeout": 20000 } From 8ebb20a32771a874fbe7d9756bbf259501143971 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 29 Jun 2023 08:28:57 -0500 Subject: [PATCH 27/27] test: don't need cache --- .github/workflows/perf.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 516e6a55ce..3f330dac16 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -23,11 +23,6 @@ jobs: cache: yarn - run: yarn install - run: yarn build - - name: Download previous benchmark data - uses: actions/cache@v3 - with: - path: ./cache - key: ${{ runner.os }}-benchmark - run: npm run test:perf | tee test/perf/output.txt # Run `github-action-benchmark` action