switch to go-kit/log (#1575)
Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
parent
a80b7d0bc5
commit
2477c5c67d
158 changed files with 3434 additions and 4636 deletions
|
|
@ -14,6 +14,7 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"github.com/go-kit/kit/log"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
|
|
@ -90,7 +91,7 @@ func TestSystemdIgnoreFilter(t *testing.T) {
|
|||
fixtures := getUnitListFixtures()
|
||||
whitelistPattern := regexp.MustCompile("^foo$")
|
||||
blacklistPattern := regexp.MustCompile("^bar$")
|
||||
filtered := filterUnits(fixtures[0], whitelistPattern, blacklistPattern)
|
||||
filtered := filterUnits(fixtures[0], whitelistPattern, blacklistPattern, log.NewNopLogger())
|
||||
for _, unit := range filtered {
|
||||
if blacklistPattern.MatchString(unit.Name) || !whitelistPattern.MatchString(unit.Name) {
|
||||
t.Error(unit.Name, "should not be in the filtered list")
|
||||
|
|
@ -98,13 +99,14 @@ func TestSystemdIgnoreFilter(t *testing.T) {
|
|||
}
|
||||
}
|
||||
func TestSystemdIgnoreFilterDefaultKeepsAll(t *testing.T) {
|
||||
c, err := NewSystemdCollector()
|
||||
logger := log.NewNopLogger()
|
||||
c, err := NewSystemdCollector(logger)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fixtures := getUnitListFixtures()
|
||||
collector := c.(*systemdCollector)
|
||||
filtered := filterUnits(fixtures[0], collector.unitWhitelistPattern, collector.unitBlacklistPattern)
|
||||
filtered := filterUnits(fixtures[0], collector.unitWhitelistPattern, collector.unitBlacklistPattern, logger)
|
||||
// Adjust fixtures by 3 "not-found" units.
|
||||
if len(filtered) != len(fixtures[0])-3 {
|
||||
t.Error("Default filters removed units")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue