Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cmap/auth/gssapi.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -97,7 +98,7 @@ async function makeKerberosClient(authContext: AuthContext): Promise<KerberosCli
}

const spnHost = mechanismProperties.SERVICE_HOST ?? host;
let spn = `${serviceName}${process.platform === 'win32' ? '/' : '@'}${spnHost}`;
let spn = `${serviceName}${os.platform() === 'win32' ? '/' : '@'}${spnHost}`;
if ('SERVICE_REALM' in mechanismProperties) {
spn = `${spn}@${mechanismProperties.SERVICE_REALM}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/handshake/client_metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export async function makeClientMetadata(

// Note: order matters, os.type is last so it will be removed last if we're at maxSize
const osInfo = new Map()
.set('name', process.platform)
.set('name', os.platform())
.set('architecture', process.arch)
.set('version', os.release())
.set('type', os.type());
Expand Down
2 changes: 1 addition & 1 deletion test/benchmarks/driver_bench/src/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const systemInfo = () =>
`\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`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/integration/node-specific/ipv6.test.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion test/integration/uri-options/uri.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from 'chai';
import * as os from 'os';
import * as sinon from 'sinon';

import { Topology } from '../../../src/sdam/topology';
Expand Down Expand Up @@ -45,7 +46,7 @@ describe('URI', function () {
metadata: { requires: { topology: 'single' } },

test: async function () {
if (process.platform === 'win32') {
if (os.platform() === 'win32') {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion test/manual/kerberos.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion test/manual/tls_support.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion test/tools/runner/filters/client_encryption_filter.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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.');
}
Expand Down
4 changes: 3 additions & 1 deletion test/tools/runner/filters/os_filter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as os from 'os';

import { Filter } from './filter';

/**
Expand All @@ -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 }) {
Expand Down
3 changes: 2 additions & 1 deletion test/tools/runner/hooks/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions test/unit/cmap/handshake/client_metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('client metadata module', () => {
},
os: {
type: os.type(),
name: process.platform,
name: os.platform(),
architecture: process.arch,
version: os.release()
},
Expand All @@ -179,7 +179,7 @@ describe('client metadata module', () => {
},
os: {
type: os.type(),
name: process.platform,
name: os.platform(),
architecture: process.arch,
version: os.release()
},
Expand All @@ -203,7 +203,7 @@ describe('client metadata module', () => {
},
os: {
type: os.type(),
name: process.platform,
name: os.platform(),
architecture: process.arch,
version: os.release()
},
Expand All @@ -229,7 +229,7 @@ describe('client metadata module', () => {
},
os: {
type: os.type(),
name: process.platform,
name: os.platform(),
architecture: process.arch,
version: os.release()
},
Expand All @@ -248,7 +248,7 @@ describe('client metadata module', () => {
},
os: {
type: os.type(),
name: process.platform,
name: os.platform(),
architecture: process.arch,
version: os.release()
},
Expand Down