Skip to content

Commit 1dd3ac8

Browse files
committed
refactor smoke-test.ts structure
1 parent 0ca8439 commit 1dd3ac8

File tree

7 files changed

+258
-252
lines changed

7 files changed

+258
-252
lines changed

.evergreen/buildvariants-and-tasks.in.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ const PACKAGE_BUILD_VARIANTS = [
6161
];
6262
6363
const SMOKETEST_BUILD_VARIANTS = [
64-
{
65-
name: 'smoketest-ubuntu',
66-
display_name: 'Smoketest Ubuntu',
67-
run_on: 'ubuntu2004-large',
68-
depends_on: 'package-ubuntu',
69-
},
64+
// {
65+
// name: 'smoketest-ubuntu',
66+
// display_name: 'Smoketest Ubuntu',
67+
// run_on: 'ubuntu2004-large',
68+
// depends_on: 'package-ubuntu',
69+
// },
7070
7171
// {
7272
// name: 'smoketest-windows',

.evergreen/buildvariants-and-tasks.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ buildvariants:
7676
- name: package-compass
7777
- name: package-compass-isolated
7878
- name: package-compass-readonly
79-
- name: smoketest-ubuntu-compass
80-
display_name: Smoketest Ubuntu (compass)
81-
run_on: ubuntu2004-large
82-
depends_on:
83-
- name: package-compass
84-
variant: package-ubuntu
85-
tasks:
86-
- name: smoketest-compass
8779
- name: smoketest-macos-x64-compass
8880
display_name: Smoketest MacOS Intel (compass)
8981
run_on: macos-14-gui

.evergreen/functions.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,29 @@ functions:
669669
# Load environment variables
670670
eval $(.evergreen/print-compass-env.sh)
671671
672+
if [[ "$IS_WINDOWS" == "true" ]]; then
673+
// TODO: windows_setup
674+
// TODO: windows_msi
675+
// TODO: windows_zip
676+
fi
677+
672678
if [[ "$IS_OSX" == "true" ]]; then
673679
echo "Disabling clipboard usage in e2e tests (TODO: https://jira.mongodb.org/browse/BUILD-14780)"
674680
export COMPASS_E2E_DISABLE_CLIPBOARD_USAGE="true"
681+
npm run --unsafe-perm --workspace compass-e2e-tests smoketest -- --package=osx_dmg
682+
// TODO: osx_zip
683+
fi
684+
685+
if [[ "$IS_UBUNTU" == "true" ]]; then
686+
// TODO: linux_deb
687+
// TODO: linux_tar
688+
fi
689+
690+
if [[ "$IS_RHEL" == "true" ]]; then
691+
// TODO: linux_rpm
692+
// TODO: rhel_tar
675693
fi
676694
677-
npm run --unsafe-perm --workspace compass-e2e-tests smoketest
678695
679696
test-web-sandbox:
680697
- command: shell.exec
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import assert from 'node:assert/strict';
2+
3+
// subsets of the hadron-build info result
4+
5+
const commonKeys = ['productName'];
6+
type CommonBuildInfo = Record<typeof commonKeys[number], string>;
7+
8+
function assertObjectHasKeys(obj: any, name: string, keys: readonly string[]) {
9+
assert(
10+
typeof obj === 'object' && obj !== null,
11+
'Expected buildInfo to be an object'
12+
);
13+
14+
for (const key of keys) {
15+
assert(key in obj, `Expected '${name}' to have '${key}'`);
16+
}
17+
}
18+
19+
export function assertCommonBuildInfo(
20+
buildInfo: unknown
21+
): asserts buildInfo is CommonBuildInfo {
22+
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
23+
}
24+
25+
const windowsFilenameKeys = [
26+
'windows_setup_filename',
27+
'windows_msi_filename',
28+
'windows_zip_filename',
29+
'windows_nupkg_full_filename',
30+
] as const;
31+
type WindowsBuildInfo = CommonBuildInfo &
32+
Record<typeof windowsFilenameKeys[number], string>;
33+
34+
const osxFilenameKeys = ['osx_dmg_filename', 'osx_zip_filename'] as const;
35+
type OSXBuildInfo = CommonBuildInfo &
36+
Record<typeof osxFilenameKeys[number], string>;
37+
38+
const ubuntuFilenameKeys = [
39+
'linux_deb_filename',
40+
'linux_tar_filename',
41+
] as const;
42+
type UbuntuBuildInfo = CommonBuildInfo &
43+
Record<typeof ubuntuFilenameKeys[number], string>;
44+
45+
const rhelFilenameKeys = ['linux_rpm_filename', 'rhel_tar_filename'] as const;
46+
type RHELBuildInfo = CommonBuildInfo &
47+
Record<typeof rhelFilenameKeys[number], string>;
48+
49+
export function assertBuildInfoIsWindows(
50+
buildInfo: any
51+
): asserts buildInfo is WindowsBuildInfo {
52+
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
53+
assertObjectHasKeys(buildInfo, 'buildInfo', windowsFilenameKeys);
54+
}
55+
56+
export function assertBuildInfoIsOSX(
57+
buildInfo: any
58+
): asserts buildInfo is OSXBuildInfo {
59+
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
60+
assertObjectHasKeys(buildInfo, 'buildInfo', osxFilenameKeys);
61+
}
62+
63+
export function assertBuildInfoIsUbuntu(
64+
buildInfo: any
65+
): buildInfo is UbuntuBuildInfo {
66+
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
67+
assertObjectHasKeys(buildInfo, 'buildInfo', ubuntuFilenameKeys);
68+
return true;
69+
}
70+
71+
export function assertBuildInfoIsRHEL(
72+
buildInfo: any
73+
): asserts buildInfo is RHELBuildInfo {
74+
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
75+
assertObjectHasKeys(buildInfo, 'buildInfo', rhelFilenameKeys);
76+
}

packages/compass-e2e-tests/installers/mac-dmg.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import path from 'path';
22
import { existsSync } from 'fs';
3-
import type { InstalledAppInfo, Package } from './types';
3+
import type { InstalledAppInfo, InstallablePackage } from './types';
44
import { execute } from './helpers';
55

6-
export async function installMacDMG(
7-
appName: string,
8-
{ filepath }: Package
9-
): Promise<InstalledAppInfo> {
6+
export async function installMacDMG({
7+
appName,
8+
filepath,
9+
}: InstallablePackage): Promise<InstalledAppInfo> {
10+
// TODO: rather copy this to a temporary directory
1011
const fullDestinationPath = `/Applications/${appName}.app`;
1112

1213
if (existsSync(fullDestinationPath)) {
@@ -47,7 +48,9 @@ export async function installMacDMG(
4748
}
4849

4950
return Promise.resolve({
50-
appName,
5151
appPath: `/Applications/${appName}.app`,
52+
uninstall: async function () {
53+
/* TODO */
54+
},
5255
});
5356
}
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
export type Installer = (pkg: InstallablePackage) => Promise<InstalledAppInfo>;
2+
13
export type Package = {
2-
filename: string;
4+
appName: string;
5+
packageFilepath: string;
6+
// TODO: once we can download the most recent release
7+
//releaseFilepath: string;
8+
installer: Installer;
9+
};
10+
11+
export type InstallablePackage = {
12+
appName: string;
313
filepath: string;
414
};
515

616
export type InstalledAppInfo = {
7-
appName: string;
817
appPath: string;
18+
uninstall: () => Promise<void>;
919
};

0 commit comments

Comments
 (0)