Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Feb 1, 2023
1 parent f6fe517 commit f19c4a8
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 86 deletions.
105 changes: 54 additions & 51 deletions .evergreen/generate_evergreen_tasks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const versions = [
{ codeName: 'gallium', versionNumber: 16 },
{ codeName: 'hydrogen', versionNumber: 18 }
];
const NODE_VERSIONS = versions.map(({ codeName }) => codeName)
const NODE_VERSIONS = versions.map(({ codeName }) => codeName);
NODE_VERSIONS.sort();
const LOWEST_LTS = NODE_VERSIONS[0];
const LATEST_LTS = NODE_VERSIONS[NODE_VERSIONS.length - 1];
Expand Down Expand Up @@ -373,28 +373,32 @@ for (const VERSION of AWS_AUTH_VERSIONS) {

const BUILD_VARIANTS = [];

for (const
{
name: osName,
display_name: osDisplayName,
run_on,
nodeVersions = NODE_VERSIONS,
clientEncryption,
msvsVersion
} of OPERATING_SYSTEMS) {
for (const {
name: osName,
display_name: osDisplayName,
run_on,
nodeVersions = NODE_VERSIONS,
clientEncryption,
msvsVersion
} of OPERATING_SYSTEMS) {
const testedNodeVersions = NODE_VERSIONS.filter(version => nodeVersions.includes(version));
const os = osName.split('-')[0];
const tasks = BASE_TASKS.concat(TASKS)
.filter(task => {
const isAWSTask = task.name.match(/^aws/);
const isSkippedTaskOnWindows = task.tags && os.match(/^windows/) && task.tags.filter(tag => WINDOWS_SKIP_TAGS.has(tag)).length

return !isAWSTask && !isSkippedTaskOnWindows;
});
const tasks = BASE_TASKS.concat(TASKS).filter(task => {
const isAWSTask = task.name.match(/^aws/);
const isSkippedTaskOnWindows =
task.tags &&
os.match(/^windows/) &&
task.tags.filter(tag => WINDOWS_SKIP_TAGS.has(tag)).length;

return !isAWSTask && !isSkippedTaskOnWindows;
});

for (const NODE_LTS_NAME of testedNodeVersions) {
const nodeVersionNumber = versions.find(({ codeName }) => codeName === NODE_LTS_NAME).versionNumber;
const nodeLtsDisplayName = nodeVersionNumber === undefined ? `Node Latest` : `Node${nodeVersionNumber}`;
const nodeVersionNumber = versions.find(
({ codeName }) => codeName === NODE_LTS_NAME
).versionNumber;
const nodeLtsDisplayName =
nodeVersionNumber === undefined ? `Node Latest` : `Node${nodeVersionNumber}`;
const name = `${osName}-${NODE_LTS_NAME}`;
const display_name = `${osDisplayName} ${nodeLtsDisplayName}`;
const expansions = { NODE_LTS_NAME };
Expand All @@ -408,7 +412,7 @@ for (const
}

BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks: taskNames });
};
}

const configureLatestNodeSmokeTest = os.match(/^rhel/);
if (configureLatestNodeSmokeTest) {
Expand All @@ -418,18 +422,20 @@ for (const
run_on,
expansions: { NODE_LTS_NAME: 'latest' },
tasks: tasks.map(({ name }) => name)
}
};
if (clientEncryption) {
buildVariantData.expansions.CLIENT_ENCRYPTION = true;
}

BUILD_VARIANTS.push(buildVariantData)
BUILD_VARIANTS.push(buildVariantData);
}
}

BUILD_VARIANTS.push({
name: 'macos-1100',
display_name: `MacOS 11 Node${versions.find(version => version.codeName === LATEST_LTS).versionNumber}`,
display_name: `MacOS 11 Node${
versions.find(version => version.codeName === LATEST_LTS).versionNumber
}`,
run_on: 'macos-1100',
expansions: {
NODE_LTS_NAME: LATEST_LTS,
Expand Down Expand Up @@ -472,28 +478,27 @@ SINGLETON_TASKS.push(
);

function* makeTypescriptTasks() {
for (const TS_VERSION of ["next", "current", "4.1.6"]) {
for (const TS_VERSION of ['next', 'current', '4.1.6']) {
// 4.1.6 can consume the public API but not compile the driver
if (TS_VERSION !== '4.1.6'
&& TS_VERSION !== 'next') {
if (TS_VERSION !== '4.1.6' && TS_VERSION !== 'next') {
yield {
name: `compile-driver-typescript-${TS_VERSION}`,
tags: [`compile-driver-typescript-${TS_VERSION}`],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
},
{
func: 'compile driver',
vars: {
TS_VERSION
}
name: `compile-driver-typescript-${TS_VERSION}`,
tags: [`compile-driver-typescript-${TS_VERSION}`],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
]
}
},
{
func: 'compile driver',
vars: {
TS_VERSION
}
}
]
};
}

yield {
Expand All @@ -513,7 +518,7 @@ function* makeTypescriptTasks() {
}
}
]
}
};
}
return {
name: 'run-typescript-next',
Expand All @@ -527,7 +532,7 @@ function* makeTypescriptTasks() {
},
{ func: 'run typescript next' }
]
}
};
}

BUILD_VARIANTS.push({
Expand Down Expand Up @@ -693,7 +698,9 @@ BUILD_VARIANTS.push({

// TODO(NODE-4575): unskip zstd and snappy on node 16
for (const variant of BUILD_VARIANTS.filter(
variant => variant.expansions && ['gallium', 'hydrogen', 'latest'].includes(variant.expansions.NODE_LTS_NAME)
variant =>
variant.expansions &&
['gallium', 'hydrogen', 'latest'].includes(variant.expansions.NODE_LTS_NAME)
)) {
variant.tasks = variant.tasks.filter(
name => !['test-zstd-compression', 'test-snappy-compression'].includes(name)
Expand All @@ -704,18 +711,14 @@ for (const variant of BUILD_VARIANTS.filter(
for (const variant of BUILD_VARIANTS.filter(
variant => variant.expansions && ['hydrogen', 'latest'].includes(variant.expansions.NODE_LTS_NAME)
)) {
variant.tasks = variant.tasks.filter(
name => !['test-auth-kerberos'].includes(name)
);
variant.tasks = variant.tasks.filter(name => !['test-auth-kerberos'].includes(name));
}

// TODO(NODE-4897): Debug socks5 tests on node latest
for (const variant of BUILD_VARIANTS.filter(
variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_NAME)
)) {
variant.tasks = variant.tasks.filter(
name => !['test-socks5'].includes(name)
);
variant.tasks = variant.tasks.filter(name => !['test-socks5'].includes(name));
}

const fileData = yaml.load(fs.readFileSync(`${__dirname}/config.in.yml`, 'utf8'));
Expand Down
73 changes: 38 additions & 35 deletions .evergreen/generate_mongosh_tasks.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { exec as execCb } from "child_process";
import { promisify } from "util";
import { exec as execCb } from 'child_process';
import { promisify } from 'util';

const exec = promisify(execCb);

Expand All @@ -11,44 +11,47 @@ const script = `

const { stdout } = await exec(script);

const scopes = stdout.trim().split('\n').map(scope => scope.replace(/@mongosh\//, ""));
const scopes = stdout
.trim()
.split('\n')
.map(scope => scope.replace(/@mongosh\//, ''));

const mongoshTestTasks = scopes.map(packageName => {
return {
name: `run-mongosh-${packageName}`,
tags: ['run-mongosh-integration-tests'],
depends_on: 'compile-mongosh',
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: 'gallium'
}
},
{
func: 'run mongosh tests for package',
vars: {
mongosh_package: packageName
}
}
]
}
})
return {
name: `run-mongosh-${packageName}`,
tags: ['run-mongosh-integration-tests'],
depends_on: 'compile-mongosh',
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: 'gallium'
}
},
{
func: 'run mongosh tests for package',
vars: {
mongosh_package: packageName
}
}
]
};
});

const compileTask = {
name: `compile-mongosh`,
tags: ['run-mongosh-integration-tests'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: 'gallium'
}
},
{ func: 'compile mongosh' }
]
name: `compile-mongosh`,
tags: ['run-mongosh-integration-tests'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: 'gallium'
}
},
{ func: 'compile mongosh' }
]
};

const tasks = [...mongoshTestTasks, compileTask];

export { tasks }
export { tasks };

0 comments on commit f19c4a8

Please sign in to comment.