From fc49d410a6144e7298b0d4a0b8a5d730b64189a3 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Mon, 16 May 2022 13:14:43 -0700 Subject: [PATCH 01/42] feat!: Update library to use Node 12 --- .kokoro/continuous/node10/common.cfg | 34 ------------------- .kokoro/continuous/node10/docs.cfg | 4 --- .kokoro/continuous/node10/test.cfg | 9 ----- .kokoro/continuous/node8/common.cfg | 24 ------------- .kokoro/continuous/node8/docs.cfg | 4 --- .kokoro/continuous/node8/lint.cfg | 4 --- .kokoro/continuous/node8/samples-test.cfg | 7 ---- .../continuous/node8/system-test-grpcjs.cfg | 12 ------- .kokoro/continuous/node8/system-test.cfg | 7 ---- .kokoro/continuous/node8/test.cfg | 0 .kokoro/presubmit/node10/common.cfg | 34 ------------------- .kokoro/presubmit/node10/docs.cfg | 4 --- .kokoro/presubmit/node10/lint.cfg | 4 --- .kokoro/presubmit/node10/test.cfg | 0 package.json | 6 ++-- samples/package.json | 4 +-- 16 files changed, 5 insertions(+), 152 deletions(-) delete mode 100644 .kokoro/continuous/node10/common.cfg delete mode 100644 .kokoro/continuous/node10/docs.cfg delete mode 100644 .kokoro/continuous/node10/test.cfg delete mode 100644 .kokoro/continuous/node8/common.cfg delete mode 100644 .kokoro/continuous/node8/docs.cfg delete mode 100644 .kokoro/continuous/node8/lint.cfg delete mode 100644 .kokoro/continuous/node8/samples-test.cfg delete mode 100644 .kokoro/continuous/node8/system-test-grpcjs.cfg delete mode 100644 .kokoro/continuous/node8/system-test.cfg delete mode 100644 .kokoro/continuous/node8/test.cfg delete mode 100644 .kokoro/presubmit/node10/common.cfg delete mode 100644 .kokoro/presubmit/node10/docs.cfg delete mode 100644 .kokoro/presubmit/node10/lint.cfg delete mode 100644 .kokoro/presubmit/node10/test.cfg diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg deleted file mode 100644 index 44967882..00000000 --- a/.kokoro/continuous/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "cloud-profiler-nodejs/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node10/docs.cfg b/.kokoro/continuous/node10/docs.cfg deleted file mode 100644 index 59c1e9b8..00000000 --- a/.kokoro/continuous/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/docs.sh" -} diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg deleted file mode 100644 index 609c0cf0..00000000 --- a/.kokoro/continuous/node10/test.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} diff --git a/.kokoro/continuous/node8/common.cfg b/.kokoro/continuous/node8/common.cfg deleted file mode 100644 index e210785d..00000000 --- a/.kokoro/continuous/node8/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "cloud-profiler-nodejs/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node8/docs.cfg b/.kokoro/continuous/node8/docs.cfg deleted file mode 100644 index 59c1e9b8..00000000 --- a/.kokoro/continuous/node8/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/docs.sh" -} diff --git a/.kokoro/continuous/node8/lint.cfg b/.kokoro/continuous/node8/lint.cfg deleted file mode 100644 index 2c5b2bb0..00000000 --- a/.kokoro/continuous/node8/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/lint.sh" -} diff --git a/.kokoro/continuous/node8/samples-test.cfg b/.kokoro/continuous/node8/samples-test.cfg deleted file mode 100644 index 1ebf12ab..00000000 --- a/.kokoro/continuous/node8/samples-test.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/samples-test.sh" -} diff --git a/.kokoro/continuous/node8/system-test-grpcjs.cfg b/.kokoro/continuous/node8/system-test-grpcjs.cfg deleted file mode 100644 index 32bc7310..00000000 --- a/.kokoro/continuous/node8/system-test-grpcjs.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/system-test.sh" -} - -env_vars: { - key: "GOOGLE_CLOUD_USE_GRPC_JS" - value: "1" -} diff --git a/.kokoro/continuous/node8/system-test.cfg b/.kokoro/continuous/node8/system-test.cfg deleted file mode 100644 index 68bdaa30..00000000 --- a/.kokoro/continuous/node8/system-test.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/system-test.sh" -} diff --git a/.kokoro/continuous/node8/test.cfg b/.kokoro/continuous/node8/test.cfg deleted file mode 100644 index e69de29b..00000000 diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg deleted file mode 100644 index 44967882..00000000 --- a/.kokoro/presubmit/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "cloud-profiler-nodejs/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node10/docs.cfg b/.kokoro/presubmit/node10/docs.cfg deleted file mode 100644 index 59c1e9b8..00000000 --- a/.kokoro/presubmit/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/docs.sh" -} diff --git a/.kokoro/presubmit/node10/lint.cfg b/.kokoro/presubmit/node10/lint.cfg deleted file mode 100644 index 2c5b2bb0..00000000 --- a/.kokoro/presubmit/node10/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/cloud-profiler-nodejs/.kokoro/lint.sh" -} diff --git a/.kokoro/presubmit/node10/test.cfg b/.kokoro/presubmit/node10/test.cfg deleted file mode 100644 index e69de29b..00000000 diff --git a/package.json b/package.json index c0d66833..2e1996af 100644 --- a/package.json +++ b/package.json @@ -60,12 +60,12 @@ "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", "linkinator": "^2.0.0", - "mocha": "^8.0.0", + "mocha": "^9.2.2", "nock": "^13.0.0", "sinon": "^14.0.0", "source-map": "^0.7.0", "tmp": "0.2.1", - "typescript": "^3.8.3" + "typescript": "^4.6.4" }, "files": [ "build/src", @@ -81,6 +81,6 @@ ] }, "engines": { - "node": ">=10.4.1" + "node": ">=12.0.0" } } diff --git a/samples/package.json b/samples/package.json index 58311b51..f518b931 100644 --- a/samples/package.json +++ b/samples/package.json @@ -8,7 +8,7 @@ "test": "echo 'no test yet'" }, "engines": { - "node": ">=10.4.1" + "node": ">=12.0.0" }, "repository": { "type": "git", @@ -22,4 +22,4 @@ "files": [ "*.js" ] -} +} \ No newline at end of file From 9cd10467d06675e3450c146a14427a9bdf7c3d68 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Mon, 16 May 2022 14:01:05 -0700 Subject: [PATCH 02/42] dep: update gts --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e1996af..83fa5302 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@types/tmp": "0.2.3", "c8": "^7.0.0", "codecov": "^3.0.0", - "gts": "^2.0.0", + "gts": "^3.1.0", "js-green-licenses": "^3.0.0", "jsdoc": "^3.6.2", "jsdoc-fresh": "^1.0.1", From 44c6284d3aac05627e280e426540ed488e1f00ab Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 17 May 2022 15:44:01 -0700 Subject: [PATCH 03/42] run lint --- samples/package.json | 2 +- src/profiler.ts | 11 ++++++++--- test/test-init-config.ts | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/samples/package.json b/samples/package.json index f518b931..2d2420db 100644 --- a/samples/package.json +++ b/samples/package.json @@ -22,4 +22,4 @@ "files": [ "*.js" ] -} \ No newline at end of file +} diff --git a/src/profiler.ts b/src/profiler.ts index cadcd560..1b017f3e 100644 --- a/src/profiler.ts +++ b/src/profiler.ts @@ -392,11 +392,16 @@ export class Profiler extends ServiceObject { try { prof = await this.createProfile(); } catch (err) { - if (isBackoffResponseError(err)) { + if (isBackoffResponseError(err as BackoffResponseError)) { this.logger.debug( - `Must wait ${msToStr(err.backoffMillis)} to create profile: ${err}` + `Must wait ${msToStr( + (err as BackoffResponseError).backoffMillis + )} to create profile: ${err}` + ); + return Math.min( + (err as BackoffResponseError).backoffMillis, + this.config.serverBackoffCapMillis ); - return Math.min(err.backoffMillis, this.config.serverBackoffCapMillis); } const backoff = this.retryer.getBackoff(); this.logger.warn( diff --git a/test/test-init-config.ts b/test/test-init-config.ts index 393347a3..01b3af53 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -256,7 +256,7 @@ describe('createProfiler', () => { assert.fail('expected an error because invalid service was specified'); } catch (e) { assert.strictEqual( - e.message, + (e as Error).message, 'Service serviceName does not match regular expression "/^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$/"' ); } @@ -283,7 +283,7 @@ describe('createProfiler', () => { assert.fail('expected an error because invalid service was specified'); } catch (e) { assert.strictEqual( - e.message, + (e as Error).message, 'Project ID must be specified in the configuration' ); } @@ -335,7 +335,7 @@ describe('createProfiler', () => { assert.fail('expected an error because invalid service was specified'); } catch (e) { assert.strictEqual( - e.message, + (e as Error).message, 'serviceMapSearchPath is an empty array. Use disableSourceMaps ' + 'to disable source map support instead.' ); From a421da4d9e054618bf443f5c9273bd2f2860e52e Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 17 May 2022 15:46:41 -0700 Subject: [PATCH 04/42] run lint --- src/profiler.ts | 2 +- test/test-profiler.ts | 32 +++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/profiler.ts b/src/profiler.ts index 1b017f3e..8e333422 100644 --- a/src/profiler.ts +++ b/src/profiler.ts @@ -196,7 +196,7 @@ async function profileBytes(p: perftools.profiles.IProfile): Promise { /** * Error constructed from HTTP server response which indicates backoff. */ -class BackoffResponseError extends Error { +export class BackoffResponseError extends Error { constructor(message: string | undefined, readonly backoffMillis: number) { super(message); } diff --git a/test/test-profiler.ts b/test/test-profiler.ts index 9251fb6d..44ebb3c3 100644 --- a/test/test-profiler.ts +++ b/test/test-profiler.ts @@ -28,7 +28,12 @@ import * as zlib from 'zlib'; import {perftools} from '../protos/profile'; import {ProfilerConfig} from '../src/config'; -import {parseBackoffDuration, Profiler, Retryer} from '../src/profiler'; +import { + parseBackoffDuration, + Profiler, + Retryer, + BackoffResponseError, +} from '../src/profiler'; import { decodedHeapProfile, @@ -163,7 +168,10 @@ describe('Profiler', () => { await profiler.profile(requestProf); assert.fail('Expected an error to be thrown,'); } catch (err) { - assert.strictEqual(err.message, 'Unexpected profile type UNKNOWN.'); + assert.strictEqual( + (err as Error).message, + 'Unexpected profile type UNKNOWN.' + ); } }); }); @@ -214,7 +222,7 @@ describe('Profiler', () => { assert.fail('expected error, no error thrown'); } catch (err) { assert.strictEqual( - err.message, + (err as Error).message, 'Cannot collect time profile, time profiler not enabled.' ); } @@ -265,7 +273,7 @@ describe('Profiler', () => { assert.fail('expected error, no error thrown'); } catch (err) { assert.strictEqual( - err.message, + (err as Error).message, 'Cannot collect heap profile, heap profiler not enabled.' ); } @@ -536,7 +544,7 @@ describe('Profiler', () => { assert.fail('expected error, no error thrown'); } catch (err) { assert.strictEqual( - err.message, + (err as Error).message, 'Profile not valid: ' + '{"name":"projects/12345678901/test-projectId"}.' ); @@ -662,7 +670,7 @@ describe('Profiler', () => { await profiler.createProfile(); assert.fail('expected error, no error thrown'); } catch (err) { - assert.strictEqual(err.message, 'Network error'); + assert.strictEqual((err as Error).message, 'Network error'); } }); it('should throw status message when response has non-200 status.', async () => { @@ -679,7 +687,7 @@ describe('Profiler', () => { await profiler.createProfile(); assert.fail('expected error, no error thrown'); } catch (err) { - assert.strictEqual(err.message, '500 status code'); + assert.strictEqual((err as Error).message, '500 status code'); } }); it( @@ -701,7 +709,10 @@ describe('Profiler', () => { await profiler.createProfile(); assert.fail('expected error, no error thrown'); } catch (err) { - assert.strictEqual(err.backoffMillis, 50000); + assert.strictEqual( + (err as BackoffResponseError).backoffMillis, + 50000 + ); } } ); @@ -716,7 +727,10 @@ describe('Profiler', () => { await profiler.createProfile(); assert.fail('expected error, no error thrown'); } catch (err) { - assert.strictEqual(err.message, 'Profile not valid: undefined.'); + assert.strictEqual( + (err as Error).message, + 'Profile not valid: undefined.' + ); } }); }); From 00e0f354387a92b141ef87f986a47c1e1be764b1 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 17 May 2022 15:49:15 -0700 Subject: [PATCH 05/42] fix templates --- .github/sync-repo-settings.yaml | 1 - .github/workflows/ci.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 679fc497..0be16649 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -34,7 +34,6 @@ branchProtectionRules: - "cla/google" - "docs" - "lint" - - "test (10)" - "test (12)" - "test (14)" - "test (16)" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 244587e5..457c72c3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [10, 12, 14, 16] + node: [12, 14, 16] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 From 326d150edc9626eee32eae28ba2740360ebce4a0 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 17 May 2022 15:54:01 -0700 Subject: [PATCH 06/42] update versions in test --- test/test-init-config.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index 01b3af53..d2ca9aef 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -23,22 +23,22 @@ import {Profiler} from '../src/profiler'; describe('nodeVersionOkay', () => { it('should accept alpha versions', () => { - assert.strictEqual(true, nodeVersionOkay('v11.0.0-alpha.1')); + assert.strictEqual(true, nodeVersionOkay('v12.0.0-alpha.1')); }); it('should accept beta versions', () => { assert.strictEqual(true, nodeVersionOkay('v12.9.10-beta.2')); }); it('should accept nightly versions', () => { - assert.strictEqual(true, nodeVersionOkay('v11.0.0-nightly2018000000')); + assert.strictEqual(true, nodeVersionOkay('v12.0.0-nightly2018000000')); }); it('should accept pre-release versions', () => { - assert.strictEqual(true, nodeVersionOkay('v11.0.0-pre')); + assert.strictEqual(true, nodeVersionOkay('v12.0.0-pre')); }); - it('should accept v10.4.1', () => { - assert.strictEqual(true, nodeVersionOkay('v10.4.1')); + it('should accept v12.4.1', () => { + assert.strictEqual(true, nodeVersionOkay('v12.4.1')); }); - it('should not accept v10.4.0', () => { - assert.strictEqual(false, nodeVersionOkay('v10.4.0')); + it('should not accept v12.4.0', () => { + assert.strictEqual(false, nodeVersionOkay('v12.4.0')); }); }); From 9dfc232236c9d5f90504f1be080c26ce2c79fb4d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 14:07:06 -0700 Subject: [PATCH 07/42] fix tests --- test/test-init-config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index d2ca9aef..ea4e818e 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -37,8 +37,8 @@ describe('nodeVersionOkay', () => { it('should accept v12.4.1', () => { assert.strictEqual(true, nodeVersionOkay('v12.4.1')); }); - it('should not accept v12.4.0', () => { - assert.strictEqual(false, nodeVersionOkay('v12.4.0')); + it('should not accept v11.4.0', () => { + assert.strictEqual(false, nodeVersionOkay('v11.4.0')); }); }); From 3a3767a83236d589af1c89ca2549b5f4873fbcb1 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 14:15:08 -0700 Subject: [PATCH 08/42] make tests smarter --- test/test-init-config.ts | 17 +++++++++++------ tsconfig.json | 6 ++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index ea4e818e..831f13fb 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -20,25 +20,30 @@ import * as sinon from 'sinon'; import {createProfiler, nodeVersionOkay} from '../src/index'; import {Profiler} from '../src/profiler'; +import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { + const version = Math.trunc(Number(packageJson.engines.node)); it('should accept alpha versions', () => { - assert.strictEqual(true, nodeVersionOkay('v12.0.0-alpha.1')); + assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); }); it('should accept beta versions', () => { - assert.strictEqual(true, nodeVersionOkay('v12.9.10-beta.2')); + assert.strictEqual(true, nodeVersionOkay(`v${version}.9.10-beta.2`)); }); it('should accept nightly versions', () => { - assert.strictEqual(true, nodeVersionOkay('v12.0.0-nightly2018000000')); + assert.strictEqual( + true, + nodeVersionOkay(`v${version}.0.0-nightly2018000000`) + ); }); it('should accept pre-release versions', () => { - assert.strictEqual(true, nodeVersionOkay('v12.0.0-pre')); + assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-pre`)); }); it('should accept v12.4.1', () => { - assert.strictEqual(true, nodeVersionOkay('v12.4.1')); + assert.strictEqual(true, nodeVersionOkay(`v${version}.4.1`)); }); it('should not accept v11.4.0', () => { - assert.strictEqual(false, nodeVersionOkay('v11.4.0')); + assert.strictEqual(false, nodeVersionOkay(`v${version - 1}.4.0`)); }); }); diff --git a/tsconfig.json b/tsconfig.json index b10ee498..7c0c10de 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,11 +2,13 @@ "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "rootDir": ".", - "outDir": "build" + "outDir": "build", + "resolveJsonModule": true }, "include": [ "src/*.ts", "test/*.ts", - "system-test/*.ts" + "system-test/*.ts", + "package.json" ] } From f70c7814c6a3d59e0f3c23b599f080c99b57cb93 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 14:22:27 -0700 Subject: [PATCH 09/42] retry --- test/test-init-config.ts | 3 ++- tsconfig.json | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index 831f13fb..d9e9809b 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -24,7 +24,8 @@ import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { const version = Math.trunc(Number(packageJson.engines.node)); - it('should accept alpha versions', () => { + it.only('should accept alpha versions', () => { + console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); }); it('should accept beta versions', () => { diff --git a/tsconfig.json b/tsconfig.json index 7c0c10de..e10fede8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "include": [ "src/*.ts", "test/*.ts", - "system-test/*.ts", - "package.json" + "system-test/*.ts" ] } From b2d6ae7056b6ad01b2cdde48f82fabdd1e615e9e Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 14:25:54 -0700 Subject: [PATCH 10/42] print version --- test/test-init-config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index d9e9809b..a8cb70bb 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -23,8 +23,9 @@ import {Profiler} from '../src/profiler'; import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { - const version = Math.trunc(Number(packageJson.engines.node)); + const version = parseInt(packageJson.engines.node); it.only('should accept alpha versions', () => { + const version = packageJson.engines.node; console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); }); From adc08d6203613cb0e6118d05637b35eb02ff1d01 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 14:34:03 -0700 Subject: [PATCH 11/42] make tests smarter --- test/test-init-config.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index a8cb70bb..37398b21 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -24,9 +24,7 @@ import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { const version = parseInt(packageJson.engines.node); - it.only('should accept alpha versions', () => { - const version = packageJson.engines.node; - console.log(version); + it('should accept alpha versions', () => { assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); }); it('should accept beta versions', () => { From d45d33e50fc6876b2925de97a2dd0a75436b916d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 14:43:07 -0700 Subject: [PATCH 12/42] add logging --- test/test-init-config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index 37398b21..0425d0f6 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -25,24 +25,30 @@ import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { const version = parseInt(packageJson.engines.node); it('should accept alpha versions', () => { + console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); }); it('should accept beta versions', () => { + console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.9.10-beta.2`)); }); it('should accept nightly versions', () => { + console.log(version); assert.strictEqual( true, nodeVersionOkay(`v${version}.0.0-nightly2018000000`) ); }); it('should accept pre-release versions', () => { + console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-pre`)); }); it('should accept v12.4.1', () => { + console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.4.1`)); }); it('should not accept v11.4.0', () => { + console.log(version); assert.strictEqual(false, nodeVersionOkay(`v${version - 1}.4.0`)); }); }); From ed1ea94570195a9ee182c039a16ca2ea381d4fa3 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 15:15:41 -0700 Subject: [PATCH 13/42] fix test --- test/test-init-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-init-config.ts b/test/test-init-config.ts index 0425d0f6..3487a62d 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -23,7 +23,7 @@ import {Profiler} from '../src/profiler'; import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { - const version = parseInt(packageJson.engines.node); + const version = parseInt(packageJson.engines.node.replace('>=', '')); it('should accept alpha versions', () => { console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); From ded0143783f914a3636757dd3647cc98a6eda0f2 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 18 May 2022 16:37:59 -0700 Subject: [PATCH 14/42] update teeny-request --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 83fa5302..3d693df0 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "pretty-ms": "^7.0.0", "protobufjs": "~6.11.0", "semver": "^7.0.0", - "teeny-request": "^7.0.0" + "teeny-request": "^8.0.0" }, "devDependencies": { "@types/extend": "^3.0.0", From f0a27fc8ea20558eadec6cd5c231fe2374504f72 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 20 May 2022 13:05:23 -0700 Subject: [PATCH 15/42] add dependency --- system-test/busybench/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index 20dd71ea..ebbebb5e 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -1,5 +1,5 @@ { - "name": "", + "name": "samples", "version": "0.0.0", "description": "", "main": "build/src/index.js", @@ -20,5 +20,7 @@ "posttest": "npm run check" }, "devDependencies": {}, - "dependencies": {} + "dependencies": { + "@google-cloud/profiler": "^4.2.0" + } } From 4b5a626ae793cdca761e7e2821980cfa31c5c6bb Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 20 May 2022 13:25:46 -0700 Subject: [PATCH 16/42] fix missing compiler option --- package.json | 2 +- system-test/busybench/package.json | 2 +- system-test/busybench/tsconfig.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3d693df0..64b85e8c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "types": "build/src/index.d.ts", "scripts": { "test": "c8 mocha build/test/test-*.js", - "system-test": "c8 --no-clean mocha build/system-test/test-*.js --timeout=60000", + "system-test": "cd system-test; npm link ../ && c8 --no-clean mocha build/system-test/test-*.js --timeout=60000", "samples-test": "echo 'no sample tests'", "clean": "gts clean", "compile": "tsc -p . && cp -R protos build", diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index ebbebb5e..5cd4cda1 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -1,5 +1,5 @@ { - "name": "samples", + "name": "system-test", "version": "0.0.0", "description": "", "main": "build/src/index.js", diff --git a/system-test/busybench/tsconfig.json b/system-test/busybench/tsconfig.json index 79fba47f..2be65cf8 100644 --- a/system-test/busybench/tsconfig.json +++ b/system-test/busybench/tsconfig.json @@ -1,10 +1,10 @@ { - "extends": "./node_modules/gts/tsconfig-google.json", + "extends": "../../node_modules/gts/tsconfig-google.json", "compilerOptions": { "rootDir": ".", "outDir": "build", - "lib": [ "es2015" ], - "target": "es2015" + "resolveJsonModule": true, + "lib": [ "es2018" ], }, "include": [ "src/*.ts" From 92b9a44e95d3e7a43e9901c7c636e434b40e82ef Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 20 May 2022 13:28:41 -0700 Subject: [PATCH 17/42] add compile step --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 64b85e8c..2ed54d87 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "types": "build/src/index.d.ts", "scripts": { "test": "c8 mocha build/test/test-*.js", - "system-test": "cd system-test; npm link ../ && c8 --no-clean mocha build/system-test/test-*.js --timeout=60000", + "system-test": "cd system-test; npm link ../; npm run compile && c8 --no-clean mocha build/system-test/test-*.js --timeout=60000", "samples-test": "echo 'no sample tests'", "clean": "gts clean", "compile": "tsc -p . && cp -R protos build", From ff40bfa2da5e445e17d82f045a8e19c974bc2b85 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 15:20:21 -0700 Subject: [PATCH 18/42] fix breaking test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ed54d87..3d693df0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "types": "build/src/index.d.ts", "scripts": { "test": "c8 mocha build/test/test-*.js", - "system-test": "cd system-test; npm link ../; npm run compile && c8 --no-clean mocha build/system-test/test-*.js --timeout=60000", + "system-test": "c8 --no-clean mocha build/system-test/test-*.js --timeout=60000", "samples-test": "echo 'no sample tests'", "clean": "gts clean", "compile": "tsc -p . && cp -R protos build", From 7c2335036c9aae3b40c605d0952a94ef9f0ad911 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 15:30:25 -0700 Subject: [PATCH 19/42] revert changes --- system-test/busybench/tsconfig.json | 6 +++--- tsconfig.json | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/system-test/busybench/tsconfig.json b/system-test/busybench/tsconfig.json index 2be65cf8..79fba47f 100644 --- a/system-test/busybench/tsconfig.json +++ b/system-test/busybench/tsconfig.json @@ -1,10 +1,10 @@ { - "extends": "../../node_modules/gts/tsconfig-google.json", + "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "rootDir": ".", "outDir": "build", - "resolveJsonModule": true, - "lib": [ "es2018" ], + "lib": [ "es2015" ], + "target": "es2015" }, "include": [ "src/*.ts" diff --git a/tsconfig.json b/tsconfig.json index e10fede8..371d4fa8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "rootDir": ".", "outDir": "build", - "resolveJsonModule": true }, "include": [ "src/*.ts", From 656f9a029d26070599b0ed90db5bf9c0e0fc8df7 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 15:33:08 -0700 Subject: [PATCH 20/42] import package.json --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 371d4fa8..e10fede8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "rootDir": ".", "outDir": "build", + "resolveJsonModule": true }, "include": [ "src/*.ts", From 1a3df1ac8c8f550ecca35b90a88566aba77ff25e Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 15:41:34 -0700 Subject: [PATCH 21/42] retry --- system-test/integration_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/system-test/integration_test.sh b/system-test/integration_test.sh index b935f510..5f397fa2 100755 --- a/system-test/integration_test.sh +++ b/system-test/integration_test.sh @@ -26,6 +26,7 @@ export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Run test. cd "system-test" +npm install # Ensure a newer version of Go is used so it is compatible with newer libraries. # Here we install v1.17.7 which is the current version as of when this code From 852bb95cc78be427c8583255bfd941fcb69107f7 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 15:51:04 -0700 Subject: [PATCH 22/42] add engines --- system-test/busybench/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index 5cd4cda1..dfb1e18a 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -7,6 +7,9 @@ "files": [ "build/src" ], + "engines": { + "node": ">=12.0.0" + }, "license": "Apache-2.0", "keywords": [], "scripts": { From 4b67e0d9da801edcf36f1bc0dbbe249c3d0e1371 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 15:57:16 -0700 Subject: [PATCH 23/42] retry --- system-test/integration_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/integration_test.sh b/system-test/integration_test.sh index 5f397fa2..ff9bef9b 100755 --- a/system-test/integration_test.sh +++ b/system-test/integration_test.sh @@ -25,7 +25,7 @@ export GCLOUD_TESTS_NODEJS_ZONE="us-east4-b" export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Run test. -cd "system-test" +cd "system-test/busybench" npm install # Ensure a newer version of Go is used so it is compatible with newer libraries. From e9a1afc88098a519d119ae315317d332d679e9e9 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 24 May 2022 16:13:14 -0700 Subject: [PATCH 24/42] retryg --- package.json | 2 +- system-test/busybench/package.json | 5 ++++- system-test/integration_test.sh | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3d693df0..fab91f7d 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "sinon": "^14.0.0", "source-map": "^0.7.0", "tmp": "0.2.1", - "typescript": "^4.6.4" + "typescript": "^4.7.2" }, "files": [ "build/src", diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index dfb1e18a..9f1dde2b 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -22,7 +22,10 @@ "pretest": "npm run compile", "posttest": "npm run check" }, - "devDependencies": {}, + "devDependencies": { + "gts": "^3.1.0", + "typescript": "^4.7.2" + }, "dependencies": { "@google-cloud/profiler": "^4.2.0" } diff --git a/system-test/integration_test.sh b/system-test/integration_test.sh index ff9bef9b..5f397fa2 100755 --- a/system-test/integration_test.sh +++ b/system-test/integration_test.sh @@ -25,7 +25,7 @@ export GCLOUD_TESTS_NODEJS_ZONE="us-east4-b" export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Run test. -cd "system-test/busybench" +cd "system-test" npm install # Ensure a newer version of Go is used so it is compatible with newer libraries. From 7dc4923395d4556f6faa37785f8911bdfd5e0090 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 27 May 2022 13:45:32 -0700 Subject: [PATCH 25/42] retry --- package.json | 3 ++- tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fab91f7d..fe644f41 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,8 @@ "sinon": "^14.0.0", "source-map": "^0.7.0", "tmp": "0.2.1", - "typescript": "^4.7.2" + "typescript": "^4.7.2", + "yargs-parser": "^21.0.1" }, "files": [ "build/src", diff --git a/tsconfig.json b/tsconfig.json index e10fede8..c7d0241d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "rootDir": ".", "outDir": "build", + "moduleResolution": "node", "resolveJsonModule": true }, "include": [ From 096dbbde7d8ea67e337174fc9d9ff791f0b54bd6 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 27 May 2022 13:56:57 -0700 Subject: [PATCH 26/42] update dependency that is now deprecated --- package.json | 3 +-- system-test/integration_test.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fe644f41..fab91f7d 100644 --- a/package.json +++ b/package.json @@ -65,8 +65,7 @@ "sinon": "^14.0.0", "source-map": "^0.7.0", "tmp": "0.2.1", - "typescript": "^4.7.2", - "yargs-parser": "^21.0.1" + "typescript": "^4.7.2" }, "files": [ "build/src", diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 6c357a97..55c977b8 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -106,7 +106,7 @@ mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -retry npm_install node-pre-gyp +retry npm_install @mapbox/node-pre-gyp retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts npm run compile From 7fce8779da24b7fd3474e3a1921d0da3949c6bea Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 27 May 2022 14:02:57 -0700 Subject: [PATCH 27/42] fix --- system-test/busybench/package.json | 9 ++------- system-test/integration_test.go | 2 +- system-test/integration_test.sh | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index 9f1dde2b..3bc77cee 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -22,11 +22,6 @@ "pretest": "npm run compile", "posttest": "npm run check" }, - "devDependencies": { - "gts": "^3.1.0", - "typescript": "^4.7.2" - }, - "dependencies": { - "@google-cloud/profiler": "^4.2.0" - } + "devDependencies": {}, + "dependencies": {} } diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 55c977b8..f5a73361 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -106,7 +106,7 @@ mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -retry npm_install @mapbox/node-pre-gyp +retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts npm run compile diff --git a/system-test/integration_test.sh b/system-test/integration_test.sh index 5f397fa2..b935f510 100755 --- a/system-test/integration_test.sh +++ b/system-test/integration_test.sh @@ -26,7 +26,6 @@ export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}" # Run test. cd "system-test" -npm install # Ensure a newer version of Go is used so it is compatible with newer libraries. # Here we install v1.17.7 which is the current version as of when this code From 4e0fb2974e0fcbaf4de46212e9617eb445aca384 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 27 May 2022 23:20:26 -0700 Subject: [PATCH 28/42] retry --- system-test/busybench/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index 3bc77cee..dfb1e18a 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -23,5 +23,7 @@ "posttest": "npm run check" }, "devDependencies": {}, - "dependencies": {} + "dependencies": { + "@google-cloud/profiler": "^4.2.0" + } } From 6793eb92354465776e85dba914ea17daf3d879f0 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 27 May 2022 23:33:10 -0700 Subject: [PATCH 29/42] retry --- system-test/integration_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index f5a73361..97f120d1 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -108,6 +108,7 @@ cd "$TESTDIR/busybench" retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts +retry npm_install @google-cloud/profiler npm run compile From 45606dd59eb77a715a13c38bc49d072b1b693cdc Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 27 May 2022 23:39:09 -0700 Subject: [PATCH 30/42] retry --- system-test/integration_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 97f120d1..3681ad77 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -266,12 +266,12 @@ func TestAgentIntegration(t *testing.T) { InstanceConfig: proftest.InstanceConfig{ ProjectID: projectID, Zone: zone, - Name: fmt.Sprintf("profiler-test-node10-%s", runID), + Name: fmt.Sprintf("profiler-test-node12-%s", runID), MachineType: "n1-standard-1", }, - name: fmt.Sprintf("profiler-test-node10-%s-gce", runID), + name: fmt.Sprintf("profiler-test-node12-%s-gce", runID), wantProfiles: wantProfiles, - nodeVersion: "10", + nodeVersion: "12", timeout: gceTestTimeout, benchDuration: gceBenchDuration, }, From 3dae4c4e62bb5023b56f3ab72c31e4b1d22b1196 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 13:54:41 -0700 Subject: [PATCH 31/42] retry npm installg --- system-test/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 3681ad77..887537a2 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -95,6 +95,7 @@ git checkout pull_branch git reset --hard {{.Commit}} retry npm_install --nodedir="$NODEDIR" +retry npm_install @google-cloud/profiler npm run compile npm pack --nodedir="$NODEDIR" >/dev/null @@ -108,7 +109,6 @@ cd "$TESTDIR/busybench" retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts -retry npm_install @google-cloud/profiler npm run compile From 18dcf346d8146588b439f1a0e36cbb4ed2c8a792 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 14:13:12 -0700 Subject: [PATCH 32/42] retry --- system-test/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 887537a2..86cc7163 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -95,7 +95,6 @@ git checkout pull_branch git reset --hard {{.Commit}} retry npm_install --nodedir="$NODEDIR" -retry npm_install @google-cloud/profiler npm run compile npm pack --nodedir="$NODEDIR" >/dev/null @@ -106,6 +105,7 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" +npm link ../; npm_install retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts From 21c786c2a941812d023ea0a4683ee60cddeaac40 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 15:35:59 -0700 Subject: [PATCH 33/42] retry --- system-test/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 86cc7163..cdab5ae4 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,7 +105,7 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -npm link ../; npm_install +npm link ../../; npm_install retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts From ca68c2a711faf3ed29c993cda9c6298e03d069b3 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 16:22:49 -0700 Subject: [PATCH 34/42] retry --- system-test/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index cdab5ae4..ba721368 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,7 +105,7 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -npm link ../../; npm_install +npm link ../..; npm_install retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts From 9df39e690e5340cca18849eaadf30a37c9594994 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 16:32:04 -0700 Subject: [PATCH 35/42] retry --- system-test/integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index ba721368..d99ff837 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,7 +105,7 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -npm link ../..; npm_install +npm link ../../@google-cloud/profiler; npm_install retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts From 48f75b413352e75156a841f99c42e7993f131d57 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 16:33:20 -0700 Subject: [PATCH 36/42] retry --- system-test/integration_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index d99ff837..1f1e4032 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,6 +105,7 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" +ls -a ../../ npm link ../../@google-cloud/profiler; npm_install retry npm_install @mapbox/node-pre-gyp --save From 075f3f7d71067e6d028833bfd4c5de7cb8937c6b Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 16:38:28 -0700 Subject: [PATCH 37/42] retry --- system-test/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 1f1e4032..05b96ecc 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,8 +105,8 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -ls -a ../../ -npm link ../../@google-cloud/profiler; npm_install +ls -a ../ +npm link ../; npm_install retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts From 2aa3277670f93f41d00852cb43cd8f244d94c5b3 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 16:52:35 -0700 Subject: [PATCH 38/42] correct path --- system-test/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 05b96ecc..dcb14014 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,8 +105,8 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -ls -a ../ -npm link ../; npm_install +ls -a ../../cloud-profiler-nodejs +npm link ../../cloud-profiler-nodejs; npm_install retry npm_install @mapbox/node-pre-gyp --save retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts From 6f8bc19ce3bb6b7ffb88579174f9879bb8df34b4 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 31 May 2022 17:00:07 -0700 Subject: [PATCH 39/42] retry --- system-test/busybench/package.json | 4 ++-- system-test/integration_test.go | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index dfb1e18a..0ae52a76 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -18,8 +18,8 @@ "clean": "gts clean", "compile": "tsc -p .", "fix": "gts fix", - "prepare": "npm run compile", - "pretest": "npm run compile", + "prepare": "npm link ../../cloud-profiler-nodejs; npm run compile", + "pretest": "npm link ../../cloud-profiler-nodejs; npm run compile", "posttest": "npm run check" }, "devDependencies": {}, diff --git a/system-test/integration_test.go b/system-test/integration_test.go index dcb14014..6a7b7793 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -105,7 +105,6 @@ TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -ls -a ../../cloud-profiler-nodejs npm link ../../cloud-profiler-nodejs; npm_install retry npm_install @mapbox/node-pre-gyp --save From d2c414f29b6364d30c770108d833dcb9287a04c5 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 1 Jun 2022 10:47:31 -0700 Subject: [PATCH 40/42] retry --- system-test/busybench/package.json | 4 ++-- system-test/integration_test.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/system-test/busybench/package.json b/system-test/busybench/package.json index 0ae52a76..dfb1e18a 100644 --- a/system-test/busybench/package.json +++ b/system-test/busybench/package.json @@ -18,8 +18,8 @@ "clean": "gts clean", "compile": "tsc -p .", "fix": "gts fix", - "prepare": "npm link ../../cloud-profiler-nodejs; npm run compile", - "pretest": "npm link ../../cloud-profiler-nodejs; npm run compile", + "prepare": "npm run compile", + "pretest": "npm run compile", "posttest": "npm run check" }, "devDependencies": {}, diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 6a7b7793..7b60547a 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -99,16 +99,14 @@ retry npm_install --nodedir="$NODEDIR" npm run compile npm pack --nodedir="$NODEDIR" >/dev/null VERSION=$(node -e "console.log(require('./package.json').version);") -PROFILER="$HOME/cloud-profiler-nodejs/google-cloud-profiler-$VERSION.tgz" TESTDIR="$HOME/test" mkdir -p "$TESTDIR" cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" -npm link ../../cloud-profiler-nodejs; npm_install retry npm_install @mapbox/node-pre-gyp --save -retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts +retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts; npm link ../../cloud-profiler-nodejs npm run compile From c397ef1c2ca27f9c60c4689bbc512005fa8c9251 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 1 Jun 2022 11:09:17 -0700 Subject: [PATCH 41/42] remove an extra node 12 test; --- system-test/integration_test.go | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 7b60547a..caed6c29 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -273,19 +273,6 @@ func TestAgentIntegration(t *testing.T) { timeout: gceTestTimeout, benchDuration: gceBenchDuration, }, - { - InstanceConfig: proftest.InstanceConfig{ - ProjectID: projectID, - Zone: zone, - Name: fmt.Sprintf("profiler-test-node12-%s", runID), - MachineType: "n1-standard-1", - }, - name: fmt.Sprintf("profiler-test-node12-%s-gce", runID), - wantProfiles: wantProfiles, - nodeVersion: "12", - timeout: gceTestTimeout, - benchDuration: gceBenchDuration, - }, { InstanceConfig: proftest.InstanceConfig{ ProjectID: projectID, From 9da5d6516ae53dbefc2b87aedab718462a638933 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 1 Jun 2022 11:44:25 -0700 Subject: [PATCH 42/42] fix broken Kokoro configuration test --- system-test/integration_test.go | 2 +- test/test-init-config.ts | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/system-test/integration_test.go b/system-test/integration_test.go index caed6c29..d6c497d6 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -106,7 +106,7 @@ cp -r "system-test/busybench" "$TESTDIR" cd "$TESTDIR/busybench" retry npm_install @mapbox/node-pre-gyp --save -retry npm_install --nodedir="$NODEDIR" "$PROFILER" typescript gts; npm link ../../cloud-profiler-nodejs +retry npm_install --nodedir="$NODEDIR" typescript gts; npm link ../../cloud-profiler-nodejs npm run compile diff --git a/test/test-init-config.ts b/test/test-init-config.ts index 3487a62d..d14423fb 100644 --- a/test/test-init-config.ts +++ b/test/test-init-config.ts @@ -25,30 +25,24 @@ import * as packageJson from '../package.json'; describe('nodeVersionOkay', () => { const version = parseInt(packageJson.engines.node.replace('>=', '')); it('should accept alpha versions', () => { - console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-alpha.1`)); }); it('should accept beta versions', () => { - console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.9.10-beta.2`)); }); it('should accept nightly versions', () => { - console.log(version); assert.strictEqual( true, nodeVersionOkay(`v${version}.0.0-nightly2018000000`) ); }); it('should accept pre-release versions', () => { - console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.0.0-pre`)); }); it('should accept v12.4.1', () => { - console.log(version); assert.strictEqual(true, nodeVersionOkay(`v${version}.4.1`)); }); it('should not accept v11.4.0', () => { - console.log(version); assert.strictEqual(false, nodeVersionOkay(`v${version - 1}.4.0`)); }); });