Skip to content

Commit

Permalink
ci: fix classic confinement tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VerteDinde committed Mar 31, 2022
1 parent 596cc18 commit d0a73cf
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+*
Expand Down
4 changes: 2 additions & 2 deletions resources/classic/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: |
App description
grade: devel
confinement: devmode
confinement: classic

apps:
electronApp:
Expand All @@ -24,7 +24,7 @@ apps:
TMPDIR: $XDG_RUNTIME_DIR

parts:
electron-deps:
electronApp:
source: .
plugin: nil
stage-packages:
Expand Down
7 changes: 6 additions & 1 deletion test/snapcraft.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
})
15 changes: 15 additions & 0 deletions test/yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit d0a73cf

Please sign in to comment.