Skip to content

Commit 8886861

Browse files
committed
Fix and allow downgrade in auto-update-to tests
1 parent 0fd15f6 commit 8886861

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

packages/compass-smoke-tests/src/tests/auto-update-to.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,37 @@ export async function testAutoUpdateTo(context: SmokeTestsContext) {
2020
const sandboxPath = createSandbox();
2121
const subject = getTestSubjectDetails({ ...context, sandboxPath });
2222
const {
23-
kind,
24-
autoUpdatable,
2523
buildInfo: { channel, version },
2624
} = subject;
2725

2826
try {
29-
const install = getInstaller(getLatestReleaseKindByKind(kind));
27+
// Derive the kind of package needed to install the latest release
28+
const latestApp = getTestSubjectDetails({
29+
...context,
30+
sandboxPath,
31+
package: getLatestReleaseKindByKind(subject.kind),
32+
});
33+
34+
assert.equal(latestApp.buildInfo.channel, subject.buildInfo.channel);
35+
36+
const install = getInstaller(latestApp.kind);
3037
const filepath = await getLatestRelease(
3138
channel,
3239
context.arch,
33-
kind,
40+
latestApp.kind,
3441
context.forceDownload
3542
);
3643

3744
const { appPath, appName, uninstall } = install({
38-
...subject,
45+
...latestApp,
3946
filepath,
47+
filename: subject.filename,
4048
sandboxPath,
4149
});
4250

4351
try {
4452
process.env.PORT = '0'; // dynamic port
53+
process.env.UPDATE_CHECKER_ALLOW_DOWNGRADES = 'true';
4554

4655
if (channel === 'dev') {
4756
process.env.DEV_RELEASE = JSON.stringify({
@@ -82,7 +91,7 @@ export async function testAutoUpdateTo(context: SmokeTestsContext) {
8291
env: {
8392
...process.env,
8493
HADRON_AUTO_UPDATE_ENDPOINT_OVERRIDE,
85-
AUTO_UPDATE_UPDATABLE: (!!autoUpdatable).toString(),
94+
AUTO_UPDATE_UPDATABLE: (!!subject.autoUpdatable).toString(),
8695
TEST_NAME: 'auto-update-to',
8796
EXPECTED_UPDATE_VERSION: version,
8897
COMPASS_APP_NAME: appName,
@@ -95,6 +104,7 @@ export async function testAutoUpdateTo(context: SmokeTestsContext) {
95104
server.close();
96105
delete process.env.DEV_RELEASE;
97106
delete process.env.PUBLISHED_RELEASES;
107+
delete process.env.UPDATE_CHECKER_ALLOW_DOWNGRADES;
98108
}
99109
} finally {
100110
await uninstall();

0 commit comments

Comments
 (0)