Repository navigation
Closed
Labels
infrastructureIssues and pull requests related to scripts and tooling for GitHub Desktop
Description
Opening this up to brain dump so it's not just in my head
Travis CI:
- First known occurrence: https://travis-ci.org/desktop/desktop/builds/489742692 ?
- Pull Requests associated with change: Split repository publication settings into two types #6776 and Pull request metrics #6791
AppVeyor:
- First known occurence: https://ci.appveyor.com/project/github-windows/desktop/builds/22206985
- PRs associated with change: Split repository publication settings into two types #6776 and add manual conflict resolution options in merge conflicts modal!! #6777 and Add git function to get branch checkouts from reflog #6664
Other infrastructure: unclear
Problem behaviour:
jestruns to execute launch testspectroninitializes using build application bundle- test fails because of a timeout to launch the app
$ cross-env TEST_ENV=1 ELECTRON_NO_ATTACH_CONSOLE=1 xvfb-maybe --auto-servernum -- jest --config ./app/jest.integration.config.js
FAIL app/test/integration/launch-test.ts (12.399s)
App
✕ opens a window on launch (10008ms)
● App › opens a window on launch
Timeout - Async callback was not invoked within the 10000ms timeout specified by jest.setTimeout.
at mapper (../node_modules/jest-jasmine2/build/queue_runner.js:41:52)
● App › opens a window on launch
TypeError: Cannot read property 'isVisible' of undefined
40 |
41 | it('opens a window on launch', async () => {
> 42 | await app.client.waitUntil(() => app.browserWindow.isVisible(), 5000)
| ^
43 |
44 | const count = await app.client.getWindowCount()
45 | expect(count).toBe(1)
at Object.app.client.waitUntil (test/integration/launch-test.ts:42:56)
at Timer.tick (../node_modules/webdriverio/build/lib/utils/Timer.js:111:31)
at Timer.start (../node_modules/webdriverio/build/lib/utils/Timer.js:75:22)
at new Timer (../node_modules/webdriverio/build/lib/utils/Timer.js:62:14)
at Object.<anonymous>.exports.default (../node_modules/webdriverio/build/lib/commands/waitUntil.js:25:17)
at Object.exec (../node_modules/webdriverio/build/lib/helpers/safeExecute.js:28:24)
at Object.resolve (../node_modules/webdriverio/build/lib/webdriverio.js:190:29)
at lastPromise.then.resolve.call.depth (../node_modules/webdriverio/build/lib/webdriverio.js:485:32)
at _fulfilled (../node_modules/q/q.js:854:54)
at self.promiseDispatch.done (../node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (../node_modules/q/q.js:816:13)
at ../node_modules/q/q.js:570:49
at runSingle (../node_modules/q/q.js:137:13)
at flush (../node_modules/q/q.js:125:13)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 12.976s
Ran all test suites.
jestdoes not terminate
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
- CI is aborted because of inactivity
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated
Root cause ideas:
- Electron 2/3 upgrades? Downgrades between major versions are not recommended, but we've been testing Electron 3 to get ready for next release. Maybe build agent is trying to launch a v2 app against a v3 data directory?
- Build agent unexpected caching files between builds
Spectron upgrade too early and uncovered some sort of v2-specific issue?downgrade does not seem to fix this issueusingignoring for nowjestto drive end-to-end tests and in this case it seems to deadlock- ???
TODO:
verify enablingno change, and no helpful information--detectOpenHandlesdoes not change this behaviourrun the test manually fromdone, see below for contextts-nodeto try and yield logs about the failuretry and get data from Spectron/ChromeDriver/WebDriver logs when build failshttps://gist.github.com/shiftkey/1181223faec6aa8b961ac0d84bd23b34- try and reproduce on a VM we can control
- ???
Metadata
Metadata
Assignees
Labels
infrastructureIssues and pull requests related to scripts and tooling for GitHub Desktop
Activity
[-]investigate uptick in failing integration tests on Travis[/-][+]investigate uptick in failing integration tests on Travis/Appveyor[/+]shiftkey commentedon Feb 8, 2019
So after rewriting the test to something I can interrogate better when running on another server, I was able to grab a ChromeDriver log file that shows, after it does some setup of the test environment, it gets stuck trying to reach this endpoint every 50ms until the 30s timeout kicks in:
And this vague error:
I have a theory that something is persisting within these problem builds as part of downgrading from Electron 3 to Electron 2, but things in
%APPDATA%(on Windows) or~/.config(on Linux) really shouldn't persist between builds, so I'm not sure what other state could be involved here.shiftkey commentedon Feb 8, 2019
Another interesting data point: I wanted to see what version of Electron is found inside
node_modules/electron/dist/electron[.exe]. This is the code that should do the trick:And output something like this:
But on Travis I see that my
execSyncfails because it can't find something thatelectrondepends on:And I can see Appveyor fail in the same way:
Why does this even matter? Because our integration tests are launching the
electronCLI (andyarncreates a shim undernode_modules/.bin/so it's available on yourPATH.https://github.com/desktop/desktop/blob/b4d5fed8a8dfd9e3edc790886ece9eb6dc0b1e88/script/run-integration-tests.ts#L58-L75
More info about this feature here.
So given that I don't seem to have a working
electronbinary to test here, I have a few options, in descending order of impact:node_modules/electronbefore doing ayarn installand see if that affects the integration testsnode_moduleson all CI platformsThe 2nd point is something I've been talking with @iAmWillShepherd about privately this week when he had to workaround what I thought was a different caching issue, but now I feel it's related to this issue:
electronpackage is cached, and it can't downgrade. Turns out I already knew about this. If it was able toyarn install --forcewithout error I believe it'd show the same issue as Travis and Appveyor.shiftkey commentedon Feb 8, 2019
Some notes about how Travis and Appveyor do caching:
Based on that description one could theorize that, when I ran a CI build that used Electron 3 it would cache that, and then serve it up for an Electron 2 CI build after. It's hard to say more, but I've added a commit to #6799 which will hint to Appveyor that
node_modulesshould be cached based on the contents ofpackage.json.Here's the cache lookup for a failing build on #6776:
And here's the cache lookup for a successful build on #6776:
I ended up invalidating the PR cache via the Travis admin portal after I noticed the broken
electron --version, so seeing the build fall back to using the default branch (still Electron 2) is what I expected to happen, and seeing it succeed makes me think this is also related to caching ofnode_modulesfor some branches.shiftkey commentedon Feb 9, 2019
Just encountered a different error error while trying to run the unit tests:
This was after disabling the caching of
node_modules, so it's a new thing to investigate:shiftkey commentedon Feb 14, 2019
Going to close this out because I think we've learned a lot about what was uncovered, and we've made some significant improvements to the CI process to prevent this from happening again:
We'll see if these changes help out the next time things go awry, or whether we need to refine these further.