Skip to content

spec: add tests for the autoUpdater on macOS that actually test if it works - #17442

Merged
MarshallOfSound merged 7 commits into
masterfrom
auto-update-darwin-spec
Mar 30, 2019
Merged

MarshallOfSound merged 7 commits into
masterfrom
auto-update-darwin-spec

Conversation

@MarshallOfSound

@MarshallOfSound MarshallOfSound commented Mar 19, 2019 •

Copy link
Copy Markdown
Member

Description of Change

This is part of some ongoing work to increase confidence in our CI runs / releases. Previously our autoUpdater specs only tested the methods didn't throw errors, or correctly returned the previously set feedUrl.

These specs actually go E2E in the update process to ensure that an app can actually successfully update if they are using the built in updater API.

These tests will only run if:

  • You are running the test son macOS
  • There is a valid code signing cert on your machine
  • You are running in a non-component build (testing/release). This means debug builds will not run these tests

If there is not a valid code signing cert on your machine the tests will be skipped unless running in CI mode in which case the tests will be marked as failed so that the fact their isn't a valid code signing cert on the machine can be addressed.

On CI I have added a self-signed code signing certificate to our build, this certificate is useless to anyone (as it's self-signed) and the password for the cert is securely stored in 1Password / CI secrets.

Release Notes

Notes: no-notes

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 19, 2019
@MarshallOfSound
MarshallOfSound marked this pull request as ready for review March 19, 2019 02:48
@MarshallOfSound
MarshallOfSound force-pushed the auto-update-darwin-spec branch from eae5f99 to 5f6213e Compare March 19, 2019 03:20
const fixturesPath = path.resolve(__dirname, '../spec/fixtures')

// We can only test the auto updater on darwin non-component builds
const describeFn = (process.platform === 'darwin' && !process.mas && !features.isComponentBuild() ? describe : describe.skip)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see the value in this style but i think it makes things a bit harder to read potentially 🤔

@codebytere codebytere left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks thorough and good to me, although given it's a big diff i'd like another review to ensure that i didn't miss anything!

@nornagon nornagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason to have a passphrase on the private key?

Comment thread script/codesign/get-trusted-identity.sh Resolved
let identity = ''

beforeEach(function () {
const result = cp.spawnSync('bash', [path.resolve(__dirname, '../script/codesign/get-trusted-identity.sh')])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't believe you need bash here if the .sh is +x

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nornagon You'd think so, but it worked on CI without bash and blew up locally. This seemed like a reasonable option to ensure it worked everywhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blew up how? that seems relevant

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENOENT iirc

@MarshallOfSound

Copy link
Copy Markdown
Member Author

Is there any particular reason to have a passphrase on the private key?

Why not when we can 😄 Hypotheticals come to mind around our CI machine and it trusting things signed with that cert and so on 🤔 Better safe than sorry 👍

@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 20, 2019
@MarshallOfSound
MarshallOfSound force-pushed the auto-update-darwin-spec branch 2 times, most recently from a7f6839 to 809a8b5 Compare March 21, 2019 23:50
@MarshallOfSound
MarshallOfSound merged commit b8dbe4b into master Mar 30, 2019
@release-clerk

release-clerk Bot commented Mar 30, 2019

Copy link
Copy Markdown

No Release Notes

@MarshallOfSound
MarshallOfSound deleted the auto-update-darwin-spec branch March 30, 2019 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants