diff --git a/.evergreen/buildvariants-and-tasks.in.yml b/.evergreen/buildvariants-and-tasks.in.yml index 812a69fef2f..2501c5c1975 100644 --- a/.evergreen/buildvariants-and-tasks.in.yml +++ b/.evergreen/buildvariants-and-tasks.in.yml @@ -217,7 +217,7 @@ buildvariants: <% } %> <% for (const buildVariant of SMOKETEST_BUILD_VARIANTS) { %> -<% for (const distribution of ['compass']) { %> +<% for (const distribution of COMPASS_DISTRIBUTIONS) { %> - name: <%= buildVariant.name %>-<%= distribution %> display_name: <%= buildVariant.display_name %> (<%= distribution %>) run_on: <%= buildVariant.run_on %> @@ -468,7 +468,7 @@ tasks: compass_distribution: <%= distribution %> <% } %> -<% for (const distribution of ['compass']) { %> +<% for (const distribution of COMPASS_DISTRIBUTIONS) { %> - name: smoketest-<%= distribution %> tags: ['required-for-publish', 'run-on-pr'] commands: diff --git a/.evergreen/buildvariants-and-tasks.yml b/.evergreen/buildvariants-and-tasks.yml index 7612fdf3bc5..ee7fe4dc1cc 100644 --- a/.evergreen/buildvariants-and-tasks.yml +++ b/.evergreen/buildvariants-and-tasks.yml @@ -84,6 +84,22 @@ buildvariants: variant: package-ubuntu tasks: - name: smoketest-compass + - name: smoketest-ubuntu-compass-isolated + display_name: Smoketest Ubuntu (compass-isolated) + run_on: ubuntu2004-large + depends_on: + - name: package-compass-isolated + variant: package-ubuntu + tasks: + - name: smoketest-compass-isolated + - name: smoketest-ubuntu-compass-readonly + display_name: Smoketest Ubuntu (compass-readonly) + run_on: ubuntu2004-large + depends_on: + - name: package-compass-readonly + variant: package-ubuntu + tasks: + - name: smoketest-compass-readonly - name: smoketest-windows-compass display_name: Smoketest Windows (compass) run_on: windows-vsCurrent-large @@ -92,6 +108,22 @@ buildvariants: variant: package-windows tasks: - name: smoketest-compass + - name: smoketest-windows-compass-isolated + display_name: Smoketest Windows (compass-isolated) + run_on: windows-vsCurrent-large + depends_on: + - name: package-compass-isolated + variant: package-windows + tasks: + - name: smoketest-compass-isolated + - name: smoketest-windows-compass-readonly + display_name: Smoketest Windows (compass-readonly) + run_on: windows-vsCurrent-large + depends_on: + - name: package-compass-readonly + variant: package-windows + tasks: + - name: smoketest-compass-readonly - name: smoketest-rhel-compass display_name: Smoketest RHEL (compass) run_on: rhel80-large @@ -100,6 +132,22 @@ buildvariants: variant: package-rhel tasks: - name: smoketest-compass + - name: smoketest-rhel-compass-isolated + display_name: Smoketest RHEL (compass-isolated) + run_on: rhel80-large + depends_on: + - name: package-compass-isolated + variant: package-rhel + tasks: + - name: smoketest-compass-isolated + - name: smoketest-rhel-compass-readonly + display_name: Smoketest RHEL (compass-readonly) + run_on: rhel80-large + depends_on: + - name: package-compass-readonly + variant: package-rhel + tasks: + - name: smoketest-compass-readonly - name: smoketest-macos-x64-compass display_name: Smoketest MacOS Intel (compass) run_on: macos-14-gui @@ -108,6 +156,22 @@ buildvariants: variant: package-macos-x64 tasks: - name: smoketest-compass + - name: smoketest-macos-x64-compass-isolated + display_name: Smoketest MacOS Intel (compass-isolated) + run_on: macos-14-gui + depends_on: + - name: package-compass-isolated + variant: package-macos-x64 + tasks: + - name: smoketest-compass-isolated + - name: smoketest-macos-x64-compass-readonly + display_name: Smoketest MacOS Intel (compass-readonly) + run_on: macos-14-gui + depends_on: + - name: package-compass-readonly + variant: package-macos-x64 + tasks: + - name: smoketest-compass-readonly - name: smoketest-macos-arm-compass display_name: Smoketest MacOS Arm64 (compass) run_on: macos-14-arm64-gui @@ -116,6 +180,22 @@ buildvariants: variant: package-macos-arm tasks: - name: smoketest-compass + - name: smoketest-macos-arm-compass-isolated + display_name: Smoketest MacOS Arm64 (compass-isolated) + run_on: macos-14-arm64-gui + depends_on: + - name: package-compass-isolated + variant: package-macos-arm + tasks: + - name: smoketest-compass-isolated + - name: smoketest-macos-arm-compass-readonly + display_name: Smoketest MacOS Arm64 (compass-readonly) + run_on: macos-14-arm64-gui + depends_on: + - name: package-compass-readonly + variant: package-macos-arm + tasks: + - name: smoketest-compass-readonly - name: test-eol-servers display_name: Test EoL Servers run_on: ubuntu1804-large @@ -523,6 +603,36 @@ tasks: mongodb_version: 8.0.x-enterprise compass_distribution: compass debug: compass-e2e-tests*,electron*,hadron*,mongo* + - name: smoketest-compass-isolated + tags: + - required-for-publish + - run-on-pr + commands: + - func: prepare + - func: install + - func: bootstrap + vars: + scope: compass-e2e-tests + - func: smoketest-packaged-app + vars: + mongodb_version: 8.0.x-enterprise + compass_distribution: compass-isolated + debug: compass-e2e-tests*,electron*,hadron*,mongo* + - name: smoketest-compass-readonly + tags: + - required-for-publish + - run-on-pr + commands: + - func: prepare + - func: install + - func: bootstrap + vars: + scope: compass-e2e-tests + - func: smoketest-packaged-app + vars: + mongodb_version: 8.0.x-enterprise + compass_distribution: compass-readonly + debug: compass-e2e-tests*,electron*,hadron*,mongo* - name: test-server-40x-community-1 tags: - required-for-publish diff --git a/.evergreen/functions.yml b/.evergreen/functions.yml index 70fd9ad2e46..49c897cd585 100644 --- a/.evergreen/functions.yml +++ b/.evergreen/functions.yml @@ -677,9 +677,19 @@ functions: npm i -w packages/compass-smoke-tests https://x-access-token:${generated_token}@github.com/10gen/compass-mongodb-com --engine-strict=false if [[ "$IS_WINDOWS" == "true" ]]; then - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_setup --tests time-to-first-query - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_zip --tests auto-update-from - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_msi --tests auto-update-from + if [[ "$HADRON_DISTRIBUTION" == "compass-readonly" ]]; then + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_setup --tests read-only + else + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_setup --tests time-to-first-query + fi + if [[ "$HADRON_DISTRIBUTION" == "compass-isolated" ]]; then + # auto-update is not supported on isolated + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_zip --tests time-to-first-query + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_msi --tests time-to-first-query + else + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_zip --tests auto-update-from + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=windows_msi --tests auto-update-from + fi fi if [[ "$IS_OSX" == "true" ]]; then @@ -688,18 +698,33 @@ functions: # NOTE: We're also skipping auto-update of the macOS app in CI # because it doesn't work. Running a different test to make sure it # can install and run successfully at least. - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_zip --tests=time-to-first-query - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg --tests=time-to-first-query + if [[ "$HADRON_DISTRIBUTION" == "compass-readonly" ]]; then + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_zip --tests=read-only + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg --tests=read-only + else + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_zip --tests=time-to-first-query + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg --tests=time-to-first-query + fi fi if [[ "$IS_UBUNTU" == "true" ]]; then - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_deb --tests=time-to-first-query - npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_tar --tests=time-to-first-query + if [[ "$HADRON_DISTRIBUTION" == "compass-readonly" ]]; then + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_deb --tests=read-only + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_tar --tests=read-only + else + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_deb --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 fi if [[ "$IS_RHEL" == "true" ]]; then - 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 + if [[ "$HADRON_DISTRIBUTION" == "compass-readonly" ]]; then + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_rpm --tests=read-only + npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=linux_tar --tests=read-only + else + 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 fi test-web-sandbox: diff --git a/packages/compass-smoke-tests/src/cli.ts b/packages/compass-smoke-tests/src/cli.ts index da495021da4..3bca08581d0 100755 --- a/packages/compass-smoke-tests/src/cli.ts +++ b/packages/compass-smoke-tests/src/cli.ts @@ -7,6 +7,7 @@ import { SUPPORTED_TESTS } from './tests/types'; import { type SmokeTestsContext } from './context'; import { SUPPORTED_PACKAGES } from './packages'; import { testTimeToFirstQuery } from './tests/time-to-first-query'; +import { testReadOnly } from './tests/read-only'; import { testAutoUpdateFrom } from './tests/auto-update-from'; import { testAutoUpdateTo } from './tests/auto-update-to'; @@ -126,6 +127,8 @@ async function run() { if (testName === 'time-to-first-query') { await testTimeToFirstQuery(context); + } else if (testName === 'read-only') { + await testReadOnly(context); } else if (testName === 'auto-update-from') { await testAutoUpdateFrom(context); } else if (testName === 'auto-update-to') { diff --git a/packages/compass-smoke-tests/src/tests/read-only.ts b/packages/compass-smoke-tests/src/tests/read-only.ts new file mode 100644 index 00000000000..3e93099d519 --- /dev/null +++ b/packages/compass-smoke-tests/src/tests/read-only.ts @@ -0,0 +1,57 @@ +import fs from 'node:fs'; +import { type SmokeTestsContext } from '../context'; +import { execute } from '../execute'; +import { getInstaller } from '../installers'; +import { createSandbox } from '../directories'; +import { getTestSubject } from '../test-subject'; + +export async function testReadOnly(context: SmokeTestsContext) { + const sandboxPath = createSandbox(); + const { kind, appName, filepath } = await getTestSubject({ + ...context, + sandboxPath, + }); + + try { + const install = getInstaller(kind); + + const { appPath, uninstall } = install({ + appName, + filepath, + destinationPath: sandboxPath, + }); + + try { + execute( + 'npm', + [ + 'run', + '--unsafe-perm', + 'test-packaged', + '--workspace', + 'compass-e2e-tests', + '--', + '--test-filter=read-only', + ], + { + // We need to use a shell to get environment variables setup correctly + shell: true, + env: { + ...process.env, + COMPASS_APP_NAME: appName, + COMPASS_APP_PATH: appPath, + }, + } + ); + } finally { + await uninstall(); + } + } finally { + if (context.skipCleanup) { + console.log(`Skipped cleaning up sandbox: ${sandboxPath}`); + } else { + console.log(`Cleaning up sandbox: ${sandboxPath}`); + fs.rmSync(sandboxPath, { recursive: true }); + } + } +} diff --git a/packages/compass-smoke-tests/src/tests/types.ts b/packages/compass-smoke-tests/src/tests/types.ts index df5695dc8f9..8a0b28f4997 100644 --- a/packages/compass-smoke-tests/src/tests/types.ts +++ b/packages/compass-smoke-tests/src/tests/types.ts @@ -1,5 +1,6 @@ export const SUPPORTED_TESTS = [ 'time-to-first-query', + 'read-only', 'auto-update-from', 'auto-update-to', ] as const;