From d0a73cf1ad333392474fa2ab3311e3d4d47359fe Mon Sep 17 00:00:00 2001 From: VerteDinde Date: Wed, 30 Mar 2022 20:00:45 -0700 Subject: [PATCH] ci: fix classic confinement tests --- .github/workflows/ci.yml | 2 +- resources/classic/snapcraft.yaml | 4 ++-- test/snapcraft.js | 7 ++++++- test/yaml.js | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93646d7..6f7f0e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: + branches: - master tags: - v[0-9]+.[0-9]+.[0-9]+* diff --git a/resources/classic/snapcraft.yaml b/resources/classic/snapcraft.yaml index 6b29c6e..de17e2c 100644 --- a/resources/classic/snapcraft.yaml +++ b/resources/classic/snapcraft.yaml @@ -5,7 +5,7 @@ description: | App description grade: devel -confinement: devmode +confinement: classic apps: electronApp: @@ -24,7 +24,7 @@ apps: TMPDIR: $XDG_RUNTIME_DIR parts: - electron-deps: + electronApp: source: . plugin: nil stage-packages: diff --git a/test/snapcraft.js b/test/snapcraft.js index f191655..0588a73 100644 --- a/test/snapcraft.js +++ b/test/snapcraft.js @@ -33,5 +33,10 @@ test('generateArgs flags and options', t => { const snapcraft = new Snapcraft() const args = snapcraft.generateArgs('nonexistent', { a: 1, b: null }, ['foo', 'bar']) - t.deepEqual(args, ['nonexistent', '--a=1', '--b', '--destructive-mode', 'foo', 'bar'], 'generated args') + // Note: --destructive-mode and --debug are enabled by default in CI + if (process.env.ci) { + t.deepEqual(args, ['nonexistent', '--a=1', '--b', '--destructive-mode', '--debug', 'foo', 'bar'], 'generated args') + } else { + t.deepEqual(args, ['nonexistent', '--a=1', '--b', '--destructive-mode', 'foo', 'bar'], 'generated args') + } }) diff --git a/test/yaml.js b/test/yaml.js index a32c5c5..aa46cd2 100644 --- a/test/yaml.js +++ b/test/yaml.js @@ -115,6 +115,21 @@ test('custom app config', async t => { t.true(apps.electronAppName.daemon, 'daemon is set in app') }) +test('use gnome extensions with strict confinement', async t => { + const { apps } = await createYaml(t, { name: 'electronAppName' }) + t.deepEqual(apps.electronAppName.extensions, ['gnome-3-34']) +}) + +test('Electron < 2 classic confinement apps use desktop-gtk2', async t => { + const { parts } = await createYaml(t, { name: 'electronAppName', confinement: 'classic' }, '1.8.2') + t.deepEqual(parts.electronAppName.after, ['desktop-gtk2']) +}) + +test('Electron 2 classic confinement apps use desktop-gtk3', async t => { + const { parts } = await createYaml(t, { name: 'electronAppName', confinement: 'classic' }, '2.0.0-beta.1') + t.deepEqual(parts.electronAppName.after, ['desktop-gtk3']) +}) + test('Electron < 4 apps require gconf', async t => { const snapcraftYaml = await createYaml(t, { name: 'electronAppName' }, '1.8.2') assertStagedPackage(t, snapcraftYaml, 'libgconf-2-4')