Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(smoke-tests): test updating from the latest release to the newly packaged app COMPASS-8532 COMPASS-8535 #6669

Merged
merged 11 commits into from
Feb 7, 2025

Conversation

lerouxb
Copy link
Contributor

@lerouxb lerouxb commented Jan 30, 2025

Unfortunately because we skip the update tests on mac in CI and we don't have the windows .exe installer done yet (needed when installing the latest release windows), this won't actually run in CI yet.

@lerouxb lerouxb added the no release notes Fix or feature not for release notes label Jan 30, 2025
@github-actions github-actions bot added the feat label Jan 30, 2025
@lerouxb lerouxb requested a review from kraenhansen February 4, 2025 12:17
console.log(
'pause to make sure the app properly exited before starting again'
);
await wait(10_000);
Copy link
Contributor

@kraenhansen kraenhansen Feb 5, 2025

Choose a reason for hiding this comment

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

Could we poll the ps with some pid instead? 🤔 Ideally from within the cleanup function. These timeouts always makes me nervous and often adds unneeded delays.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but where do we get the pid? I think we can clean it up but in an effort to get somewhere let's do that as a follow-up.

Selectors.AutoUpdateReleaseNotesLink
);
await releaseNotesLink.waitForDisplayed();
// for now we only know the new version in the auto-update-to case
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be easier to get to now that we're running the update server from within the CLI process?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. Haven't thought of it. But if we do I'd just do it in a follow-up.


export function assertCommonBuildInfo(
buildInfo: unknown
): asserts buildInfo is CommonBuildInfo {
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
assert(
SUPPORTED_CHANNELS.includes(buildInfo.channel as Channel),
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

Comment on lines 217 to 225
const installerPath =
testName === 'auto-update-to'
? await getLatestRelease(
channel,
context.arch,
kind,
context.forceDownload
)
: filepath;
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this depend on the order if multiple tests are passed to the CLI?
I suggest we make this a bit less powerful and run only one test per invocation of the CLI (effectively changing context.tests to context.test) to make it easier to reason about what installer needs to run first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this again, it does feel a bit misplaced here, instead of being a part of the actual test function, which would increase the cohesion 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK what I've done now is move all this stuff into the tests. I also changed it so that auto-update-to does not unnecessarily download the newly packaged app when it is going to be installing the latest release anyway.

Let me know what you think.

version,
bucketKeyPrefix,
}: RunUpdateToTestOptions) {
process.env.PORT = '0'; // dynamic port
Copy link
Contributor

@kraenhansen kraenhansen Feb 5, 2025

Choose a reason for hiding this comment

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

While this works, this isn't type-safe and we would ideally be passing this through the default function exported by the update server package, which would then be passed to the UpdateChecker constructor deep merging with any default config values:

https://github.com/10gen/compass-mongodb-com/blob/a1fb99908815d3c3ab0efb5960430cc3faf99a15/src/update-checker.js#L40

To be honest, it feels the way config is passed through environment variables here are a remains of the fact that this was invoked as a sub-process earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah it is a bit janky at the moment. That's not where the port is even used, though. update-checker is not the server itself. I think we can make a PR to compass-mongodb-com to allow us to clean it up, then another one here to use that. I'd do it as a follow-up, though, so we can have the tests running in the meantime.

Copy link
Contributor

@kraenhansen kraenhansen left a comment

Choose a reason for hiding this comment

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

Great stuff overall - I have a few requests, non of which are necessarily blocking.

@lerouxb lerouxb merged commit 29090f4 into main Feb 7, 2025
25 of 28 checks passed
@lerouxb lerouxb deleted the autoupdate-to branch February 7, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants