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

zaptest: testLogSpy doesn't have to be thread-safe #567

Merged
merged 3 commits into from
Apr 9, 2018

Commits on Apr 2, 2018

  1. zaptest: Expand TestingT interface

    This expands the TestingT interface to a much larger subset of
    `testing.TB`.
    
    The following were left out:
    
    - `Error` and `Log` were left out in favor of `Errorf` and `Logf`
    - `Fatal*` methods were left out in favor of `Errorf` followed by
      `FailNow`
    - `Skip*` methods were left out because our test logger shouldn't be
      skipping tests
    - `Helper` was left out because not all supported verisons of Go have
      that
    abhinav committed Apr 2, 2018
    Configuration menu
    Copy the full SHA
    cdd3f0b View commit details
    Browse the repository at this point in the history
  2. zaptest/NewLogger: fail test on internal errors

    Zap's errorOutput is used exclusively to log internal errors. If this
    ever gets used in a test, something catastrophic happened and we should
    fail the test.
    
    This changes the logger returned by zaptest.NewLogger to implement this
    behavior by passing a `WriteSyncer` to `zap.ErrorOutput` that marks the
    test as failed upon being used.
    
    To test this, we set up a test logger and replace its core with one that
    will always fail to write.
    abhinav committed Apr 2, 2018
    Configuration menu
    Copy the full SHA
    2b3338c View commit details
    Browse the repository at this point in the history
  3. zaptest: testLogSpy doesn't have to be thread-safe

    This simplifies the implementation of testLogSpy by removing all
    thread-safety from it. It's only used from these specific tests and
    never concurrently.
    abhinav committed Apr 2, 2018
    Configuration menu
    Copy the full SHA
    d7b6a16 View commit details
    Browse the repository at this point in the history