Skip to content

Commit 0e5ac49

Browse files
authored
Merge branch 'main' into CLOUDP-286331
2 parents 4c77061 + 4916ea6 commit 0e5ac49

File tree

5 files changed

+76
-37
lines changed

5 files changed

+76
-37
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **Mongodb Compass**.
2-
This document was automatically generated on Mon Jan 13 2025.
2+
This document was automatically generated on Tue Jan 14 2025.
33

44
## List of dependencies
55

docs/tracking-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Compass Tracking Plan
33

4-
Generated on Mon, Jan 13, 2025 at 02:06 PM
4+
Generated on Tue, Jan 14, 2025 at 03:51 PM
55

66
## Table of Contents
77

packages/compass-e2e-tests/smoke-test.ts

Lines changed: 63 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,47 @@ import {
1919
assertCommonBuildInfo,
2020
} from './helpers/buildinfo';
2121

22+
const SUPPORTED_PLATFORMS = ['win32', 'darwin', 'linux'] as const;
23+
const SUPPORTED_ARCHS = ['x64', 'arm64'] as const;
24+
25+
function isSupportedPlatform(
26+
value: unknown
27+
): value is typeof SUPPORTED_PLATFORMS[number] {
28+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
29+
return SUPPORTED_PLATFORMS.includes(value as any);
30+
}
31+
32+
function isSupportedArch(
33+
value: unknown
34+
): value is typeof SUPPORTED_ARCHS[number] {
35+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
36+
return SUPPORTED_ARCHS.includes(value as any);
37+
}
38+
39+
function getDefaultPlatform() {
40+
const {
41+
platform,
42+
env: { PLATFORM },
43+
} = process;
44+
if (isSupportedPlatform(PLATFORM)) {
45+
return PLATFORM;
46+
} else if (isSupportedPlatform(platform)) {
47+
return platform;
48+
}
49+
}
50+
51+
function getDefaultArch() {
52+
const {
53+
arch,
54+
env: { ARCH },
55+
} = process;
56+
if (isSupportedArch(ARCH)) {
57+
return ARCH;
58+
} else if (isSupportedArch(arch)) {
59+
return arch;
60+
}
61+
}
62+
2263
const argv = yargs(hideBin(process.argv))
2364
.scriptName('smoke-tests')
2465
.detectLocale(false)
@@ -32,26 +73,15 @@ const argv = yargs(hideBin(process.argv))
3273
type: 'string',
3374
default: process.env.EVERGREEN_BUCKET_KEY_PREFIX,
3475
})
35-
.option('version', {
36-
type: 'string',
37-
// For dev versions we need this from evergreen. For beta or stable (or by
38-
// default, ie. when testing a locally packaged app) we get it from the
39-
// package.json
40-
default: process.env.DEV_VERSION_IDENTIFIER,
41-
description:
42-
'Will be read from packages/compass/package.json if not specified',
43-
})
4476
.option('platform', {
45-
type: 'string',
46-
choices: ['win32', 'darwin', 'linux'],
77+
choices: SUPPORTED_PLATFORMS,
4778
demandOption: true,
48-
default: process.env.PLATFORM ?? process.platform,
79+
default: getDefaultPlatform(),
4980
})
5081
.option('arch', {
51-
type: 'string',
52-
choices: ['x64', 'arm64'],
82+
choices: SUPPORTED_ARCHS,
5383
demandOption: true,
54-
default: process.env.ARCH ?? process.arch,
84+
default: getDefaultArch(),
5585
})
5686
.option('package', {
5787
type: 'string',
@@ -65,7 +95,7 @@ const argv = yargs(hideBin(process.argv))
6595
'linux_tar',
6696
'linux_rpm',
6797
'rhel_tar',
68-
],
98+
] as const,
6999
demandOption: true,
70100
description: 'Which package to test',
71101
})
@@ -88,7 +118,6 @@ const argv = yargs(hideBin(process.argv))
88118
type SmokeTestsContext = {
89119
bucketName?: string;
90120
bucketKeyPrefix?: string;
91-
version?: string;
92121
platform: 'win32' | 'darwin' | 'linux';
93122
arch: 'x64' | 'arm64';
94123
package:
@@ -112,48 +141,49 @@ async function readJson<T extends object>(...segments: string[]): Promise<T> {
112141
return result as T;
113142
}
114143

115-
async function readPackageVersion(packagePath: string) {
116-
const pkg = await readJson(packagePath, 'package.json');
117-
assert(
118-
'version' in pkg && typeof pkg.version === 'string',
119-
'Expected a package version'
120-
);
121-
return pkg.version;
122-
}
123-
124144
async function run() {
125-
const parsedArgs = argv.parseSync();
126-
127-
const context = parsedArgs as SmokeTestsContext;
145+
const context: SmokeTestsContext = argv.parseSync();
128146

129147
console.log(
130148
'context',
131149
pick(context, [
132150
'skipDownload',
133151
'bucketName',
134152
'bucketKeyPrefix',
135-
'version',
136153
'platform',
137154
'arch',
138155
'package',
139156
])
140157
);
141158

142159
const compassDir = path.resolve(__dirname, '..', '..', 'packages', 'compass');
143-
// use the specified DEV_VERSION_IDENTIFIER if set or load version from packages/compass/package.json
144-
const version = context.version ?? (await readPackageVersion(compassDir));
145160
const outPath = path.resolve(__dirname, 'hadron-build-info.json');
146161

147162
// build-info
148163
const infoArgs = {
149164
format: 'json',
150165
dir: compassDir,
151-
version,
152166
platform: context.platform,
153167
arch: context.arch,
154168
out: outPath,
155169
};
156170
console.log('infoArgs', infoArgs);
171+
172+
// These are known environment variables that will affect the way
173+
// writeBuildInfo works. Log them as a reminder and for our own sanity
174+
console.log(
175+
'info env vars',
176+
pick(process.env, [
177+
'HADRON_DISTRIBUTION',
178+
'HADRON_APP_VERSION',
179+
'HADRON_PRODUCT',
180+
'HADRON_PRODUCT_NAME',
181+
'HADRON_READONLY',
182+
'HADRON_ISOLATED',
183+
'DEV_VERSION_IDENTIFIER',
184+
'IS_RHEL',
185+
])
186+
);
157187
writeBuildInfo(infoArgs);
158188
const buildInfo = await readJson(infoArgs.out);
159189

packages/compass/src/app/components/update-toasts.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const RestartCompassToastContent = ({
5353
<button
5454
className={cx(buttonStyles, darkmode && buttonDarkStyles)}
5555
onClick={onUpdateClicked}
56+
data-testid="auto-update-restart-button"
5657
>
5758
Restart
5859
</button>
@@ -83,6 +84,7 @@ export function onAutoupdateExternally({
8384
Compass features.
8485
</Body>
8586
<Link
87+
data-testid="auto-update-download-link"
8688
as="a"
8789
target="_blank"
8890
href={'https://www.mongodb.com/try/download/compass'}
@@ -137,6 +139,7 @@ export function onAutoupdateInstalled({ newVersion }: { newVersion: string }) {
137139
title: `Compass ${newVersion} installed successfully`,
138140
description: (
139141
<Link
142+
data-testid="auto-update-release-notes-link"
140143
as="a"
141144
target="_blank"
142145
href={`https://github.com/mongodb-js/compass/releases/tag/v${newVersion}`}

packages/compass/src/app/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,15 @@ const app = {
379379
});
380380
}
381381

382+
log.info(mongoLogId(1_001_000_338), 'Main Window', 'Recent version info', {
383+
previousVersion: state.previousVersion,
384+
highestInstalledVersion: state.highestInstalledVersion,
385+
APP_VERSION,
386+
});
387+
382388
if (
383-
semver.gt(APP_VERSION, state.previousVersion) &&
384-
state.previousVersion !== DEFAULT_APP_VERSION
389+
state.previousVersion !== DEFAULT_APP_VERSION &&
390+
APP_VERSION !== state.previousVersion
385391
) {
386392
// Wait a bit before showing the update toast.
387393
setTimeout(() => {

0 commit comments

Comments
 (0)