mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-20 04:36:41 +00:00
Merge pull request #538 from abansal4032/configure-log-pattern
Fix for flaky unit test in health checker
This commit is contained in:
@@ -18,6 +18,7 @@ package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -54,13 +55,19 @@ type LogPatternFlag struct {
|
||||
}
|
||||
|
||||
// String implements the String function for flag.Value interface
|
||||
// Returns a space separated sorted by keys string of map values.
|
||||
func (lpf *LogPatternFlag) String() string {
|
||||
result := ""
|
||||
for k, v := range lpf.logPatternCountMap {
|
||||
var keys []string
|
||||
for k := range lpf.logPatternCountMap {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
for _, k := range keys {
|
||||
if result != "" {
|
||||
result += " "
|
||||
}
|
||||
result += fmt.Sprintf("%v:%v", k, v)
|
||||
result += fmt.Sprintf("%v:%v", k, lpf.logPatternCountMap[k])
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user