Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix result when test task fails so that correct exit code is returned #303

Merged
merged 4 commits into from
Jun 14, 2019

Conversation

smaifullerton-wk
Copy link
Contributor

@smaifullerton-wk smaifullerton-wk commented Jun 13, 2019

In the test task, the outputProcessed future was only completed if the tests ran or if the test regex didn't match any test names. If anything else happened, the task's done future never completed, the result was never returned to dart_dev_cli.dart, and no matter what happened in the task, an exit code of 0 was returned.

This PR makes sure that the future is completed in the test task no matter what. As a result, we can remove the extra build that was going on in the test task before. Now, if you run ddev test and the build fails, an exit code of 1 will be returned.

QA +1 Instructions

  • Pull into a repo that builds on Dart 2 that has the config.test.deleteConflictingOutputs option set to true.
  • Run ddev test with a passing build, ensure that the --delete-conflicting-outputs flag is passed to the build command, and tests run successfully.
  • Break something in the repo so the build will fail, re-run ddev test. After the build fails, try echo $? and ensure that the exit code returned was 0.

@smaifullerton-wk smaifullerton-wk changed the title Fix exit code when test task fails Fix result when test task fails so that correct exit code is returned Jun 13, 2019
@aviary-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@@ -182,9 +182,9 @@ Future _run(List<String> args) async {

reporter.log('');
if (result.successful) {
reporter.success(result.message, shout: true);
reporter.success(result.message ?? '', shout: true);
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little concerned/unclear what empty string will accomplish if result.message is null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isNotEmpty threw here: https://github.com/Workiva/dart_dev/blob/master/lib/src/reporter.dart#L102

I will push a commit to fix it up farther down the stack though.

@tomconnell-wf
Copy link
Member

👏 , but CI failed.

@smaifullerton-wk smaifullerton-wk force-pushed the fix-exit-code-when-test-task-fails branch from 2a65d69 to f4040ee Compare June 13, 2019 20:52
@todbachman-wf
Copy link
Member

+10

Testing Performed

  • Pull into w_router
  • Set the config.test.deleteConflictingOutputs option to true
  • Run ddev test with a passing build
  • Confirm the --delete-conflicting-outputs flag is passed to the build command
  • Break something in the repo so the build will fail
  • Re-run ddev test
  • Confirm ddev returned the exit code 1
  • Fix the failing build
  • Re-run ddev test
  • Confirm ddev returned the exit code 0
  • Add expect(true, isFalse, reason: 'fake news'); to a unit test
  • Re-run ddev test
  • Confirm ddev returned the exit code 1

@corwinsheahan-wf
Copy link
Contributor

@Workiva/release-management-p

@rmconsole4-wk rmconsole4-wk merged commit a5d089d into master Jun 14, 2019
@rmconsole4-wk rmconsole4-wk deleted the fix-exit-code-when-test-task-fails branch June 14, 2019 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants