Discover Packages
github.com/Hoggles/TraceAI
pkg
testutils
package
Version:
v1.15.1
Opens a new window with list of versions in this module.
Published: Nov 7, 2019
License: Apache-2.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: ? modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
View Source
var LogMatcher = func(occurrences int , subStr string , logs []string ) (bool , string ) {
errMsg := fmt .Sprintf ("subStr '%s' does not occur %d time(s) in %v", subStr, occurrences, logs)
if len (logs) < occurrences {
return false , errMsg
}
var count int
for _, log := range logs {
if strings .Contains (log, subStr) {
count++
}
}
if count >= occurrences {
return true , ""
}
return false , errMsg
}
LogMatcher is a helper func that returns true if the subStr appears more than 'occurrences' times in the logs.
Buffer wraps zaptest.Buffer and provides convenience method JSONLine(n)
NewLogger creates a new zap.Logger backed by a zaptest.Buffer, which is also returned.
JSONLine reads n-th line from the buffer and converts it to JSON.
Lines overwrites zaptest.Buffer.Lines() to make it thread safe
String overwrites zaptest.Buffer.String() to make it thread safe
Stripped overwrites zaptest.Buffer.Stripped() to make it thread safe
Write overwrites zaptest.Buffer.bytes.Buffer.Write() to make it thread safe
Source Files
¶
Click to show internal directories.
Click to hide internal directories.