Skip to content

Commit

Permalink
Add docs for testutils package
Browse files Browse the repository at this point in the history
GFM-115
  • Loading branch information
ascandella committed Nov 23, 2016
1 parent 32a1040 commit 4e1c8e9
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core/testutils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Test utilities

The functionality in this package is exposed both for internal testing as well
as service testability.

## InMemoryLogger

If you'd like to verify that log messages are logged properly, use the
`WithInMemoryLogger()` helper which will provider you with a `zap.Logger` you
can pass into a service and capture recorded messages.

## EnvOverride

If you'd like to override environment variables, use the `EnvOverride()` helper
and defer the reset to ensure the old value us returned at the end of the test.
41 changes: 41 additions & 0 deletions core/testutils/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

// Package testutils is the Test utilities.
//
// The functionality in this package is exposed both for internal testing as well
// as service testability.
//
//
// InMemoryLogger
//
// If you'd like to verify that log messages are logged properly, use the
// WithInMemoryLogger() helper which will provider you with a zap.Logger you
// can pass into a service and capture recorded messages.
//
//
// EnvOverride
//
// If you'd like to override environment variables, use the EnvOverride() helper
// and defer the reset to ensure the old value us returned at the end of the test.
//
//
//
package testutils
8 changes: 8 additions & 0 deletions service/testutils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Service test utilities

## WithService

`WithService` provides a noop service for you to test service lifecycle
functions if you'd like to perform end-to-end testing of your service. This
generally isn't necessary from a service-owner perspective, but is used
internally.
32 changes: 32 additions & 0 deletions service/testutils/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

// Package testutils is the Service test utilities.
//
// WithService
//
// WithService provides a noop service for you to test service lifecycle
// functions if you'd like to perform end-to-end testing of your service. This
// generally isn't necessary from a service-owner perspective, but is used
// internally.
//
//
//
package testutils

0 comments on commit 4e1c8e9

Please sign in to comment.