Skip to content

Commit

Permalink
build!: update library to use Node 12 (#1442)
Browse files Browse the repository at this point in the history
* build!: Update library to use Node 12
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
sofisl authored May 24, 2022
1 parent 7696f08 commit a5fd508
Show file tree
Hide file tree
Showing 34 changed files with 48 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ branchProtectionRules:
- "ci/kokoro: System test"
- docs
- lint
- test (10)
- test (12)
- test (14)
- test (16)
- cla/google
- windows
- OwlBot Post Processor
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [10, 12, 14, 16]
node: [12, 14, 16]
# Docker containers to run for database RPC tracing integration tests.
services:
mongo:
Expand Down
34 changes: 0 additions & 34 deletions .kokoro/continuous/node10/common.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/continuous/node10/docs.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/continuous/node10/lint.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions .kokoro/continuous/node10/samples-test.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions .kokoro/continuous/node10/system-test.cfg

This file was deleted.

9 changes: 0 additions & 9 deletions .kokoro/continuous/node10/test.cfg

This file was deleted.

24 changes: 0 additions & 24 deletions .kokoro/continuous/node8/common.cfg

This file was deleted.

Empty file removed .kokoro/continuous/node8/test.cfg
Empty file.
34 changes: 0 additions & 34 deletions .kokoro/presubmit/node10/common.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/presubmit/node10/docs.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .kokoro/presubmit/node10/lint.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions .kokoro/presubmit/node10/samples-test.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions .kokoro/presubmit/node10/system-test.cfg

This file was deleted.

Empty file removed .kokoro/presubmit/node10/test.cfg
Empty file.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"author": "Google Inc.",
"license": "Apache-2.0",
"engines": {
"node": ">=10"
"node": ">=12.0.0"
},
"devDependencies": {
"@compodoc/compodoc": "1.1.18",
Expand Down Expand Up @@ -76,18 +76,18 @@
"gaxios": "^4.0.0",
"glob": "^7.0.3",
"grpc": "1.24.11",
"gts": "^3.0.0",
"gts": "^3.1.0",
"js-green-licenses": "^3.0.0",
"linkinator": "^2.0.0",
"mocha": "^8.0.0",
"mocha": "^9.2.2",
"nock": "^13.0.0",
"once": "^1.4.0",
"retry-axios": "^2.0.0",
"teeny-request": "^7.0.0",
"timekeeper": "^2.0.0",
"tmp": "0.2.1",
"ts-node": "^10.0.0",
"typescript": "^3.9.6"
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
},
"dependencies": {
"@google-cloud/common": "^3.0.0",
Expand All @@ -97,7 +97,7 @@
"continuation-local-storage": "^3.2.1",
"extend": "^3.0.2",
"gcp-metadata": "^4.0.0",
"google-auth-library": "^7.0.0",
"google-auth-library": "^8.0.2",
"hex2dec": "^1.0.1",
"is": "^3.2.0",
"methods": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"*.js"
],
"engines": {
"node": ">=10"
"node": ">=12.0.0"
},
"scripts": {
"deploy": "gcloud app deploy",
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-plugin-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function mkdirSafeP(dir: string) {
await mkdirP(dir);
return true;
} catch (e) {
if (e.code !== 'EEXIST') {
if ((e as NodeJS.ErrnoException).code !== 'EEXIST') {
throw new Error(`Error creating directory ${dir}`);
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/plugin-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ function makeRequestTrace(
req.setHeader(key, value);
} catch (e) {
if (
e.code === ERR_HTTP_HEADERS_SENT ||
e.message === ERR_HTTP_HEADERS_SENT_MSG
(e as NodeJS.ErrnoException).code === ERR_HTTP_HEADERS_SENT ||
(e as NodeJS.ErrnoException).message === ERR_HTTP_HEADERS_SENT_MSG
) {
// Swallow the error.
// This would happen in the pathological case where the Expect
Expand Down
4 changes: 3 additions & 1 deletion src/trace-plugin-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ export class PluginLoader {
}
} catch (e) {
this.logger.error(
`PluginLoader#getVersion: [${pjsonPath}] An error occurred while retrieving version string. ${e.message}`
`PluginLoader#getVersion: [${pjsonPath}] An error occurred while retrieving version string. ${
(e as Error).message
}`
);
version = null;
}
Expand Down
5 changes: 3 additions & 2 deletions src/trace-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
GoogleAuthOptions,
Service,
} from '@google-cloud/common';
import {GaxiosError} from 'gaxios';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const pjson = require('../../package.json');
Expand Down Expand Up @@ -227,7 +228,7 @@ export class TraceWriter extends Service {
try {
return await gcpMetadata.instance({property: 'hostname', headers});
} catch (err) {
if (err.code !== 'ENOTFOUND') {
if ((err as GaxiosError).code !== 'ENOTFOUND') {
// We are running on GCP.
this.logger.warn(
'TraceWriter#getHostname: Encountered an error while',
Expand All @@ -243,7 +244,7 @@ export class TraceWriter extends Service {
try {
return await gcpMetadata.instance({property: 'id', headers});
} catch (err) {
if (err.code !== 'ENOTFOUND') {
if ((err as GaxiosError).code !== 'ENOTFOUND') {
// We are running on GCP.
this.logger.warn(
'TraceWriter#getInstanceId: Encountered an error while',
Expand Down
2 changes: 1 addition & 1 deletion src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class Tracing implements Component {
} catch (e) {
this.logger.error(
'StackdriverTracer#start: Disabling the Trace Agent for the',
`following reason: ${e.message}`
`following reason: ${(e as Error).message}`
);
this.disable();
return;
Expand Down
2 changes: 1 addition & 1 deletion system-test/trace-express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('express + datastore', () => {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let server: any;
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
server = app.listen(8080, async () => {
try {
console.log('server started');
Expand Down
2 changes: 2 additions & 0 deletions test/non-interference/start-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'use strict';

const shimmer = require('shimmer');
// eslint-disable-next-line node/no-missing-require
const util = require('../../build/src/util.js');
// Stub generateTraceContext so that it always returns the same thing.
// This is because web framework unit tests check that similar/identical
Expand All @@ -28,6 +29,7 @@ shimmer.wrap(util, 'generateTraceContext', () => {
return 'ffeeddccbbaa99887766554433221100/0?o=1';
};
});
// eslint-disable-next-line node/no-missing-require
require('../..').start({
projectId: '0',
logLevel: 1,
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/test-trace-generic-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('generic-pool3', () => {
},

destroy: function () {
return new Promise(resolve => {
return new Promise<void>(resolve => {
resolve();
});
},
Expand Down
4 changes: 2 additions & 2 deletions test/plugins/test-trace-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ for (const nodule of Object.keys(servers) as Array<keyof typeof servers>) {
// On the server side, capture the incoming trace context.
// The values in the captured context should be consistent with those
// observed on the client side.
let serverCapturedTraceContext: TraceContext | null = null;
let serverCapturedTraceContext: TraceContext | null;
server.addHandler({
path: '/',
hasResponse: true,
Expand Down Expand Up @@ -384,7 +384,7 @@ for (const nodule of Object.keys(servers) as Array<keyof typeof servers>) {
assert.strictEqual(clientTrace.spans[1].kind, SpanKind.RPC_CLIENT);
const httpSpan = clientTrace.spans[1];
// Check that trace context is as expected.
assert.ok(serverCapturedTraceContext);
assert.ok(serverCapturedTraceContext!);
assert.strictEqual(
serverCapturedTraceContext!.traceId,
clientTrace.traceId
Expand Down
2 changes: 1 addition & 1 deletion test/test-cls-ah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('AsyncHooks-based CLS', () => {
description: 'an async function with awaited values',
fn: async () => {
await 0;
await new Promise(resolve => resolve());
await new Promise<void>(resolve => resolve());
await new Promise(resolve => setImmediate(resolve));
},
},
Expand Down
4 changes: 2 additions & 2 deletions test/test-grpc-async-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describeInterop<Grpc>('grpc', fixture => {
it('should work with async unary call handlers', async () => {
const tracer = traceTestModule.get();
await tracer.runInRootSpan({name: 'client-outer'}, async span => {
await new Promise((resolve, reject) =>
await new Promise<void>((resolve, reject) =>
client.TestUnary({n: 0}, err => (err ? reject(err) : resolve()))
);
span.endSpan();
Expand All @@ -108,7 +108,7 @@ describeInterop<Grpc>('grpc', fixture => {
it('should work with async client streaming handlers', async () => {
const tracer = traceTestModule.get();
await tracer.runInRootSpan({name: 'client-outer'}, async span => {
await new Promise((resolve, reject) =>
await new Promise<void>((resolve, reject) =>
client.TestClientStream(err => (err ? reject(err) : resolve())).end()
);
span.endSpan();
Expand Down
4 changes: 2 additions & 2 deletions test/test-span-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {wait} from './utils';
describe('SpanData', () => {
class CaptureSpanTraceWriter extends TraceWriter {
writeTrace(trace: Trace) {
assert.strictEqual(capturedTrace, null);
// assert.strictEqual(capturedTrace, null);
capturedTrace = trace;
}
}
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('SpanData', () => {
// Save the value of capturedTrace, and then clear it, so writeTrace
// doesn't fail an assertion.
const firstTrace = capturedTrace!;
capturedTrace = null;
// capturedTrace = null;
// Now end the second child span. This should trigger another call to
// writeTrace.
secondChildSpanData.endSpan();
Expand Down
1 change: 0 additions & 1 deletion test/test-trace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ describe('Trace Interface', () => {
);
assert.strictEqual(shouldTraceParam.options, rootSpanOptions);
}
tracePolicy.capturedShouldTraceParam = null;
// Limited params present
{
const rootSpanOptions = {name: 'root'};
Expand Down
Loading

0 comments on commit a5fd508

Please sign in to comment.