Skip to content
Merged
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
13 changes: 6 additions & 7 deletions .evergreen/buildvariants-and-tasks.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ const SMOKETEST_BUILD_VARIANTS = [
// run_on: 'ubuntu2004-large',
// depends_on: 'package-ubuntu',
// },

// {
// name: 'smoketest-windows',
// display_name: 'Smoketest Windows',
// run_on: 'windows-vsCurrent-large',
// depends_on: 'package-windows',
// },
{
name: 'smoketest-windows',
display_name: 'Smoketest Windows',
run_on: 'windows-vsCurrent-large',
depends_on: 'package-windows',
},
// {
// name: 'smoketest-rhel',
// display_name: 'Smoketest RHEL',
Expand Down
8 changes: 8 additions & 0 deletions .evergreen/buildvariants-and-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ buildvariants:
- name: package-compass
- name: package-compass-isolated
- name: package-compass-readonly
- name: smoketest-windows-compass
display_name: Smoketest Windows (compass)
run_on: windows-vsCurrent-large
depends_on:
- name: package-compass
variant: package-windows
tasks:
- name: smoketest-compass
- name: smoketest-macos-x64-compass
display_name: Smoketest MacOS Intel (compass)
run_on: macos-14-gui
Expand Down
8 changes: 4 additions & 4 deletions .evergreen/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -678,17 +678,17 @@ functions:
# Load environment variables
eval $(.evergreen/print-compass-env.sh)

#if [[ "$IS_WINDOWS" == "true" ]]; then
if [[ "$IS_WINDOWS" == "true" ]]; then
# TODO: windows_setup
# TODO: windows_msi
# TODO: windows_zip
#fi
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_zip
fi

if [[ "$IS_OSX" == "true" ]]; then
echo "Disabling clipboard usage in e2e tests (TODO: https://jira.mongodb.org/browse/BUILD-14780)"
export COMPASS_E2E_DISABLE_CLIPBOARD_USAGE="true"
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg
# TODO: osx_zip
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_zip
fi

#if [[ "$IS_UBUNTU" == "true" ]]; then
Expand Down
47 changes: 45 additions & 2 deletions packages/compass-smoke-tests/src/build-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,65 @@ export const windowsFilenameKeys = [
'windows_nupkg_full_filename',
] as const;
export type WindowsBuildInfo = CommonBuildInfo &
Record<typeof windowsFilenameKeys[number], string>;
Record<typeof windowsFilenameKeys[number], string> & {
installerOptions: {
name: string;
};
};

export function assertBuildInfoIsWindows(
buildInfo: unknown
): asserts buildInfo is WindowsBuildInfo {
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
assertObjectHasKeys(buildInfo, 'buildInfo', windowsFilenameKeys);
assert(typeof buildInfo === 'object', 'Expected buildInfo to be an object');
assert(buildInfo !== null, 'Expected buildInfo to be an object');
assert(
'installerOptions' in buildInfo &&
typeof buildInfo.installerOptions === 'object',
'Expected buildInfo.installerOptions to be an object'
);
const { installerOptions } = buildInfo;
assert(
typeof installerOptions === 'object' &&
installerOptions !== null &&
'name' in installerOptions &&
typeof installerOptions.name === 'string',
'Expected buildInfo.installerOptions.name to be a string'
);
}

export const osxFilenameKeys = [
'osx_dmg_filename',
'osx_zip_filename',
] as const;
export type OSXBuildInfo = CommonBuildInfo &
Record<typeof osxFilenameKeys[number], string>;
Record<typeof osxFilenameKeys[number], string> & {
installerOptions: {
title: string;
};
};

export function assertBuildInfoIsOSX(
buildInfo: unknown
): asserts buildInfo is OSXBuildInfo {
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
assertObjectHasKeys(buildInfo, 'buildInfo', osxFilenameKeys);
assert(typeof buildInfo === 'object', 'Expected buildInfo to be an object');
assert(buildInfo !== null, 'Expected buildInfo to be an object');
assert(
'installerOptions' in buildInfo &&
typeof buildInfo.installerOptions === 'object',
'Expected buildInfo.installerOptions to be an object'
);
const { installerOptions } = buildInfo;
assert(
typeof installerOptions === 'object' &&
installerOptions !== null &&
'title' in installerOptions &&
typeof installerOptions.title === 'string',
'Expected buildInfo.installerOptions.title to be a string'
);
}

export const ubuntuFilenameKeys = [
Expand Down Expand Up @@ -93,6 +131,7 @@ export type PackageDetails = {
kind: PackageKind;
filename: string;
autoUpdatable: boolean;
appName: string;
} & (
| {
kind: 'windows_setup' | 'windows_msi' | 'windows_zip';
Expand Down Expand Up @@ -129,6 +168,7 @@ export function getPackageDetails(
kind,
buildInfo,
filename: buildInfo[`${kind}_filename`],
appName: buildInfo.installerOptions.name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have examples of how these differ from productName? Just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needed to be MongoDBCompassDev on windows (no spaces).

autoUpdatable: kind === 'windows_setup',
};
} else if (kind === 'osx_dmg' || kind === 'osx_zip') {
Expand All @@ -137,6 +177,7 @@ export function getPackageDetails(
kind,
buildInfo,
filename: buildInfo[`${kind}_filename`],
appName: buildInfo.installerOptions.title,
autoUpdatable: true,
};
} else if (kind === 'linux_deb' || kind === 'linux_tar') {
Expand All @@ -145,6 +186,7 @@ export function getPackageDetails(
kind,
buildInfo,
filename: buildInfo[`${kind}_filename`],
appName: buildInfo.productName,
autoUpdatable: false,
};
} else if (kind === 'linux_rpm' || kind === 'rhel_tar') {
Expand All @@ -153,6 +195,7 @@ export function getPackageDetails(
kind,
buildInfo,
filename: buildInfo[`${kind}_filename`],
appName: buildInfo.productName,
autoUpdatable: false,
};
} else {
Expand Down
12 changes: 8 additions & 4 deletions packages/compass-smoke-tests/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import path from 'node:path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { pick } from 'lodash';
import { installMacDMG } from './installers/mac-dmg';
import { execute } from './execute';
import {
type PackageDetails,
Expand All @@ -17,7 +16,10 @@ import { createSandbox } from './directories';
import { downloadFile } from './downloads';
import { type PackageKind, SUPPORTED_PACKAGES } from './packages';
import { type SmokeTestsContext } from './context';

import { installMacDMG } from './installers/mac-dmg';
import { installMacZIP } from './installers/mac-zip';
import { installWindowsZIP } from './installers/windows-zip';

const SUPPORTED_PLATFORMS = ['win32', 'darwin', 'linux'] as const;
const SUPPORTED_ARCHS = ['x64', 'arm64'] as const;
Expand Down Expand Up @@ -150,6 +152,8 @@ function getInstaller(kind: PackageKind) {
return installMacDMG;
} else if (kind === 'osx_zip') {
return installMacZIP;
} else if (kind === 'windows_zip') {
return installWindowsZIP;
} else {
throw new Error(`Installer for '${kind}' is not yet implemented`);
}
Expand All @@ -175,12 +179,10 @@ async function run() {
])
);

const { kind, buildInfo, filepath } = await getTestSubject(context);
const { kind, filepath, appName } = await getTestSubject(context);
const install = getInstaller(kind);

try {
const appName = buildInfo.productName;

const { appPath, uninstall } = install({
appName,
filepath,
Expand Down Expand Up @@ -216,6 +218,8 @@ function runTest({ appName, appPath }: RunTestOptions) {
'--test-filter=time-to-first-query',
],
{
// We need to use a shell to get environment variables setup correctly
shell: true,
Copy link
Contributor

@lerouxb lerouxb Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

(I think I noticed the same in an open PR)

env: {
...process.env,
COMPASS_APP_NAME: appName,
Expand Down
24 changes: 24 additions & 0 deletions packages/compass-smoke-tests/src/installers/windows-zip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from 'node:path';

import type { InstalledAppInfo, InstallablePackage } from './types';
import { execute } from '../execute';

export function installWindowsZIP({
appName,
filepath,
destinationPath,
}: InstallablePackage): InstalledAppInfo {
const appPath = path.resolve(destinationPath, `${appName}.exe`);

execute('unzip', [filepath, '-d', destinationPath]);

// see if the executable will run without being quarantined or similar
execute(appPath, ['--version']);

return {
appPath: destinationPath,
uninstall: async function () {
/* TODO */
},
};
}
Loading