Test target _testTarget_ encountered an error (Early unexpected exit, operation never finished bootstrapping

Running Tests using Bitrise Test step fails at signing a testTarget

Description of the issue

Have a swift .xcodeproj with a main target and 3 test targets (unit, Pact, UI).
Project builds and unit tests pass locally at 95% coverage.
Running bitriseCLI locally with identical bitrise.yml to the one on Bitrise.io passes all ok.
Pushing code to remote and Bitrise picks it up, builds and reaches the Test step.
Logs show that it signs the main target ok. It signs the UITesting target ok. It signs Pact Tests unit target ok.
Fails to sign unit tests target!

Environment:

Occurs on Bitrise.io: `9.3.x on macOS 10.3 (High Sierra)

Step: xcode-test@1.18.13

Reproducibility

  • Does a “Rebuild” help? : NO
  • Does a rebuild without caches help? : NO
  • Does the issue happen sporadically, or every time? : EVERY TIME
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : When calling a function to call a remote endpoint in a ViewController lifecycle method (viewDidAppear(_))

The Initial ViewController calls a function with closure in viewDidAppear(_). If I remove that and implement a button to manually call that same function, it passes on Bitrise.io!?!?

Log says “Unexpectedly found nil while unwrapping an Optional value” though.
Where?!
Why wouldn’t it hit the same error locally!?

Local reproduction

Cannot reproduce locally!

Build log

https://www.bitrise.io/build/f25a13b67363e770

…
Signing /Users/vagrant/Library/Developer/Xcode/DerivedData/projectName-eqheaaeiffcrougxlxoqlhosgerw/Build/Products/Debug-iphonesimulator/projectName.app/PlugIns/projectNameTests.xctest
Automatic retry reason found in log: Early unexpected exit, operation never finished bootstrapping - no restart will be attempted
isAutomaticRetryOnReason=false, no more retry, stopping the test!
xcode test exit code: 65
xcode test failed, error: exit status 65
Last lines of the Xcode’s build log:
Fatal error: Unexpectedly found nil while unwrapping an Optional value
2018-04-22 20:33:05.825204-0700 projectName[4849:27578] Fatal error: Unexpectedly found nil while unwrapping an Optional value
2018-04-22 20:33:13.572 xcodebuild[4254:25051] Error Domain=IDETestOperationsObserverErrorDomain Code=6 “Early unexpected exit, operation never finished bootstrapping - no restart will be attempted” UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}
2018-04-22 20:33:13.572 xcodebuild[4254:25051] Error Domain=IDETestOperationsObserverErrorDomain Code=6 “Early unexpected exit, operation never finished bootstrapping - no restart will be attempted” UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}
Generating coverage data…
Testing failed:
Test target projectNameTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
Test target projectNamePactTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
** TEST FAILED **

Hi there,
We are looking into it and will get back to you here as soon as possible!

1 Like

Hi @mjustinek,

It seems the issue is in your unit test, most likely. From the error log:

Fatal error: Unexpectedly found nil while unwrapping an Optional value

See e.g.:

You can also Remote Desktop into the MacOS build VM and try it in Xcode directly: https://gist.github.com/viktorbenei/c6d4fe1e68de739dbb5f4f15de76b9db

If none of these would help or if you’d have any questions just let us know! :wink:

Yeah, it’s amazing how it always only failed just before “signing unit test target” on bitrise.io, but never failed locally or when running BitriseCLI locally with the same workflow configuration as online.

I’ve already gone around this. I can’t remember exactly how. Too many commits ago.

At least the RD link could be useful going forward.

This topic was automatically closed after 14 days. New replies are no longer allowed.