diff --git a/src/cmap/auth/gssapi.ts b/src/cmap/auth/gssapi.ts index 430b97d213..d18cb6b360 100644 --- a/src/cmap/auth/gssapi.ts +++ b/src/cmap/auth/gssapi.ts @@ -1,4 +1,5 @@ import * as dns from 'dns'; +import * as os from 'os'; import { getKerberos, type Kerberos, type KerberosClient } from '../../deps'; import { MongoInvalidArgumentError, MongoMissingCredentialsError } from '../../error'; @@ -97,7 +98,7 @@ async function makeKerberosClient(authContext: AuthContext): Promise `\n- cpu: ${platform.name}`, `- cores: ${platform.cores}`, `- arch: ${os.arch()}`, - `- os: ${process.platform} (${os.release()})`, + `- os: ${os.platform()} (${os.release()})`, `- ram: ${platform.ram}`, `- node: ${process.version}`, `- running ${total} benchmarks`, diff --git a/test/integration/node-specific/examples/change_streams.test.js b/test/integration/node-specific/examples/change_streams.test.js index 90737e2ddf..90020f33d5 100644 --- a/test/integration/node-specific/examples/change_streams.test.js +++ b/test/integration/node-specific/examples/change_streams.test.js @@ -4,9 +4,10 @@ const { setTimeout } = require('timers'); const setupDatabase = require('../../shared').setupDatabase; const expect = require('chai').expect; +const os = require('os'); // TODO: NODE-3819: Unskip flaky MacOS/Windows tests. -const maybeDescribe = process.platform !== 'linux' ? describe.skip : describe; +const maybeDescribe = os.platform() !== 'linux' ? describe.skip : describe; maybeDescribe('examples(change-stream):', function () { let client; let db; diff --git a/test/integration/node-specific/ipv6.test.ts b/test/integration/node-specific/ipv6.test.ts index b3b76c8517..09157633b8 100644 --- a/test/integration/node-specific/ipv6.test.ts +++ b/test/integration/node-specific/ipv6.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as net from 'net'; -import * as process from 'process'; +import * as os from 'os'; import * as sinon from 'sinon'; import { @@ -16,7 +16,7 @@ describe('IPv6 Addresses', () => { beforeEach(async function () { if ( - process.platform === 'linux' || + os.platform() === 'linux' || this.configuration.topologyType !== TopologyType.ReplicaSetWithPrimary ) { if (this.currentTest) { diff --git a/test/integration/uri-options/uri.test.ts b/test/integration/uri-options/uri.test.ts index dde75c48f0..6734a6ccb3 100644 --- a/test/integration/uri-options/uri.test.ts +++ b/test/integration/uri-options/uri.test.ts @@ -1,4 +1,5 @@ import { expect } from 'chai'; +import * as os from 'os'; import * as sinon from 'sinon'; import { Topology } from '../../../src/sdam/topology'; @@ -45,7 +46,7 @@ describe('URI', function () { metadata: { requires: { topology: 'single' } }, test: async function () { - if (process.platform === 'win32') { + if (os.platform() === 'win32') { return; } diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 92111b2585..24007128f2 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -1,5 +1,6 @@ import * as chai from 'chai'; import { promises as dns } from 'dns'; +import * as os from 'os'; import * as sinon from 'sinon'; import { MongoClient } from '../../src'; @@ -50,7 +51,7 @@ describe('Kerberos', function () { context('when passing in CANONICALIZE_HOST_NAME', function () { beforeEach(function () { - if (process.platform === 'darwin') { + if (os.platform() === 'darwin') { this.currentTest.skipReason = 'DNS does not resolve with proper CNAME record on evergreen MacOS'; this.skip(); diff --git a/test/manual/tls_support.test.ts b/test/manual/tls_support.test.ts index 4db67b1203..4c3bffd54f 100644 --- a/test/manual/tls_support.test.ts +++ b/test/manual/tls_support.test.ts @@ -4,6 +4,7 @@ import * as tls from 'node:tls'; import { expect } from 'chai'; import { promises as fs } from 'fs'; import ConnectionString from 'mongodb-connection-string-url'; +import * as os from 'os'; import * as sinon from 'sinon'; import { MongoClient, type MongoClientOptions, MongoServerSelectionError } from '../../src'; @@ -36,7 +37,7 @@ describe('TLS Support', function () { beforeEach(function () { if ( this.currentTest?.title === 'should connect with tls via url options' && - process.platform === 'win32' + os.platform() === 'win32' ) { this.currentTest.skipReason = 'TODO(NODE-5803): Un-skip Windows TLS tests via URL'; return this.skip(); diff --git a/test/tools/runner/filters/client_encryption_filter.ts b/test/tools/runner/filters/client_encryption_filter.ts index 8f51f3ab2f..5a16881683 100644 --- a/test/tools/runner/filters/client_encryption_filter.ts +++ b/test/tools/runner/filters/client_encryption_filter.ts @@ -1,4 +1,5 @@ import { readFile } from 'fs/promises'; +import * as os from 'os'; import { dirname, resolve } from 'path'; import * as process from 'process'; import { satisfies } from 'semver'; @@ -74,7 +75,7 @@ export class ClientSideEncryptionFilter extends Filter { } // TODO(NODE-3401): unskip csfle tests on windows - if (process.env.TEST_CSFLE && process.platform !== 'win32') { + if (process.env.TEST_CSFLE && os.platform() !== 'win32') { if (this.version == null) { throw new Error('FLE tests must run, but mongodb client encryption was not installed.'); } diff --git a/test/tools/runner/filters/os_filter.ts b/test/tools/runner/filters/os_filter.ts index 50e6201ed1..9137db9e4d 100755 --- a/test/tools/runner/filters/os_filter.ts +++ b/test/tools/runner/filters/os_filter.ts @@ -1,3 +1,5 @@ +import * as os from 'os'; + import { Filter } from './filter'; /** @@ -17,7 +19,7 @@ export class OSFilter extends Filter { constructor() { super(); // Get environmental variables that are known - this.platform = process.platform; + this.platform = os.platform(); } filter(test: { metadata?: MongoDBMetadataUI }) { diff --git a/test/tools/runner/hooks/configuration.ts b/test/tools/runner/hooks/configuration.ts index 9fdc5c6c91..d8c7d375db 100644 --- a/test/tools/runner/hooks/configuration.ts +++ b/test/tools/runner/hooks/configuration.ts @@ -5,6 +5,7 @@ require('source-map-support').install({ hookRequire: true }); +import * as os from 'os'; import { MongoClient } from '../../../../src'; import { AlpineTestConfiguration, AstrolabeTestConfiguration, TestConfiguration } from '../config'; import { getEnvironmentalOptions } from '../../utils'; @@ -151,7 +152,7 @@ const testConfigBeforeHook = async function () { topology: this.configuration.topologyType, version: this.configuration.buildInfo.version, node: process.version, - os: process.platform, + os: os.platform(), alpineLinux: Boolean(process.env.ALPINE), cryptdUri: process.env.MONGOCRYPTD_URI, pid: process.pid, diff --git a/test/unit/cmap/handshake/client_metadata.test.ts b/test/unit/cmap/handshake/client_metadata.test.ts index 87069dacc3..afdd47cad2 100644 --- a/test/unit/cmap/handshake/client_metadata.test.ts +++ b/test/unit/cmap/handshake/client_metadata.test.ts @@ -153,7 +153,7 @@ describe('client metadata module', () => { }, os: { type: os.type(), - name: process.platform, + name: os.platform(), architecture: process.arch, version: os.release() }, @@ -179,7 +179,7 @@ describe('client metadata module', () => { }, os: { type: os.type(), - name: process.platform, + name: os.platform(), architecture: process.arch, version: os.release() }, @@ -203,7 +203,7 @@ describe('client metadata module', () => { }, os: { type: os.type(), - name: process.platform, + name: os.platform(), architecture: process.arch, version: os.release() }, @@ -229,7 +229,7 @@ describe('client metadata module', () => { }, os: { type: os.type(), - name: process.platform, + name: os.platform(), architecture: process.arch, version: os.release() }, @@ -248,7 +248,7 @@ describe('client metadata module', () => { }, os: { type: os.type(), - name: process.platform, + name: os.platform(), architecture: process.arch, version: os.release() },