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
12 changes: 6 additions & 6 deletions .evergreen/buildvariants-and-tasks.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ const SMOKETEST_BUILD_VARIANTS = [
run_on: 'windows-vsCurrent-large',
depends_on: 'package-windows',
},
// {
// name: 'smoketest-rhel',
// display_name: 'Smoketest RHEL',
// run_on: 'rhel80-large',
// depends_on: 'package-rhel',
// },
{
name: 'smoketest-rhel',
display_name: 'Smoketest RHEL',
run_on: 'rhel80-large',
depends_on: 'package-rhel',
},
{
name: 'smoketest-macos-x64',
display_name: 'Smoketest MacOS Intel',
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 @@ -92,6 +92,14 @@ buildvariants:
variant: package-windows
tasks:
- name: smoketest-compass
- name: smoketest-rhel-compass
display_name: Smoketest RHEL (compass)
run_on: rhel80-large
depends_on:
- name: package-compass
variant: package-rhel
tasks:
- name: smoketest-compass
- name: smoketest-macos-x64-compass
display_name: Smoketest MacOS Intel (compass)
run_on: macos-14-gui
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ functions:
fi

if [[ "$IS_RHEL" == "true" ]]; then
# TODO: linux_rpm
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_rpm --tests=time-to-first-query
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_tar --tests=time-to-first-query
fi

Expand Down
3 changes: 3 additions & 0 deletions packages/compass-smoke-tests/src/installers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { installWindowsMSI } from './windows-msi';
import { installWindowsSetup } from './windows-setup';
import { installLinuxTar } from './linux-tar';
import { installLinuxDeb } from './linux-deb';
import { installLinuxRpm } from './linux-rpm';

export function getInstaller(kind: PackageKind) {
if (kind === 'osx_dmg') {
Expand All @@ -22,6 +23,8 @@ export function getInstaller(kind: PackageKind) {
return installLinuxTar;
} else if (kind === 'linux_deb') {
return installLinuxDeb;
} else if (kind === 'linux_rpm') {
return installLinuxRpm;
} else {
throw new Error(`Installer for '${kind}' is not yet implemented`);
}
Expand Down
81 changes: 81 additions & 0 deletions packages/compass-smoke-tests/src/installers/linux-rpm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import assert from 'node:assert/strict';
import cp from 'node:child_process';
import path from 'node:path';
import fs from 'node:fs';

import type { InstalledAppInfo, InstallablePackage } from './types';
import { execute } from '../execute';
/**
* Call dnf to get the package name
*/
function getPackageName(filepath: string) {
const { status, stdout, stderr } = cp.spawnSync(
'rpm',
['--query', '--queryformat', '%{NAME}', '--package', filepath],
{ encoding: 'utf8' }
);
assert.equal(
status,
0,
`Expected a clean exit, got status ${status || 'null'}: ${stderr}`
);
return stdout.trim();
}

/**
* Check if a package is installed (by name)
*/
export function isInstalled(packageName: string) {
const result = cp.spawnSync(
'sudo',
['dnf', 'list', 'installed', packageName],
{
stdio: 'inherit',
}
);
return result.status === 0;
}

export function installLinuxRpm({
appName,
filepath,
}: InstallablePackage): InstalledAppInfo {
const packageName = getPackageName(filepath);
const installPath = `/usr/lib/${packageName}`;
const appPath = path.resolve(installPath, appName);

function uninstall() {
execute('sudo', ['dnf', 'remove', '-y', packageName]);
}

if (isInstalled(packageName)) {
console.warn(
'Found an existing install directory (likely from a previous run): Uninstalling first'
);
uninstall();
}

console.warn(
"Installing globally, since we haven't discovered a way to specify an install path"
);
assert(!isInstalled(packageName), 'Expected the package to not be installed');
assert(
!fs.existsSync(installPath),
`Expected no install directory to exist: ${installPath}`
);
execute('sudo', ['dnf', 'install', '-y', filepath]);

assert(isInstalled(packageName), 'Expected the package to be installed');
assert(
fs.existsSync(installPath),
`Expected an install directory to exist: ${installPath}`
);

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

return {
appPath: installPath,
uninstall,
};
}
Loading