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

tests hygiene: a lot fewer naked trys #552

Merged
merged 1 commit into from
Aug 6, 2018

Conversation

weissi
Copy link
Member

@weissi weissi commented Aug 6, 2018

Motivation:

Naked trys in tests are a problem because if they're hit you'll get a
bad error message and likely no file/line information. That has made
many flaky tests harder to debug than necessary.

Modifications:

  • fix a lot of naked trys
  • symlink TestUtils from NIOTests into NIOHTTP1Tests
  • make a bunch of wait()s synchronous that were asynchronous by
    accident

Result:

  • better code
  • easier to debug test failures
  • setting better example

@weissi weissi requested a review from Lukasa August 6, 2018 11:28
@weissi weissi force-pushed the jw-better-debugging branch from 65fe495 to e3d543d Compare August 6, 2018 11:34
Motivation:

Naked `try`s in tests are a problem because if they're hit you'll get a
bad error message and likely no file/line information. That has made
many flaky tests harder to debug than necessary.

Modifications:

- fix a lot of naked `try`s
- symlink `TestUtils` from `NIOTests` into `NIOHTTP1Tests`
- make a bunch of `wait()`s synchronous that were asynchronous by
  accident

Result:

- better code
- easier to debug test failures
- setting better example
@weissi weissi force-pushed the jw-better-debugging branch from e3d543d to 854eea7 Compare August 6, 2018 12:01
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

One minor structural note, I'm otherwise happy with this.

@@ -0,0 +1 @@
../NIOTests/TestUtils.swift
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than create this symlink, should we just move this into a target and depend on it from the two test targets?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Lukasa SwiftPM doesn't unfortunately support that AFAIK. We can't make it a test target as we can't depend on that and we can't make it a normal target as it depends on XCTest. Therefore this is the only way I'm aware of...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh, ok then.

@Lukasa Lukasa merged commit 9c58336 into apple:master Aug 6, 2018
@weissi weissi deleted the jw-better-debugging branch August 6, 2018 15:24
@weissi weissi added this to the 1.10.0 milestone Aug 14, 2018
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Aug 16, 2018
@weissi weissi modified the milestones: 1.10.0, 1.9.3 Aug 28, 2018
weissi added a commit that referenced this pull request Aug 29, 2018
Motivation:

Naked `try`s in tests are a problem because if they're hit you'll get a
bad error message and likely no file/line information. That has made
many flaky tests harder to debug than necessary.

Modifications:

- fix a lot of naked `try`s
- symlink `TestUtils` from `NIOTests` into `NIOHTTP1Tests`
- make a bunch of `wait()`s synchronous that were asynchronous by
  accident

Result:

- better code
- easier to debug test failures
- setting better example
Motivation:

Explain here the context, and why you're making that change.
What is the problem you're trying to solve.

Modifications:

Describe the modifications you've done.

Result:

After your change, what will change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants