format imports

This commit is contained in:
Sergey Kanzhelev
2025-08-13 16:56:32 +00:00
parent 414d24893b
commit 75bf501888
38 changed files with 95 additions and 81 deletions
+2 -1
View File
@@ -41,7 +41,8 @@ func init() {
SystemLogMonitorName,
types.ProblemDaemonHandler{
CreateProblemDaemonOrDie: NewLogMonitorOrDie,
CmdOptionDescription: "Set to config file paths."})
CmdOptionDescription: "Set to config file paths.",
})
}
type logMonitor struct {
@@ -134,7 +134,7 @@ func (s *filelogWatcher) watchLoop() {
}
func (s *filelogWatcher) filterSkipList(line string) bool {
for _ , skipItem := range s.cfg.SkipList {
for _, skipItem := range s.cfg.SkipList {
if strings.Contains(line, skipItem) {
return true
}
@@ -19,8 +19,9 @@ package filelog
import (
"fmt"
"io"
"k8s.io/node-problem-detector/third_party/forked/cadvisor/tail"
"os"
"k8s.io/node-problem-detector/third_party/forked/cadvisor/tail"
)
// getLogReader returns log reader for filelog log. Note that getLogReader doesn't look back
@@ -21,12 +21,12 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
testclock "k8s.io/utils/clock/testing"
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
"k8s.io/node-problem-detector/pkg/util"
"github.com/stretchr/testify/assert"
testclock "k8s.io/utils/clock/testing"
)
// getTestPluginConfig returns a plugin config for test. Use configuration for
@@ -185,22 +185,21 @@ func TestFilterSkipList(t *testing.T) {
},
},
}
testcase := []struct{
log string
testcase := []struct {
log string
expect bool
}{
{
log: `Jan 2 03:04:03 kernel: [0.000000] 1`,
log: `Jan 2 03:04:03 kernel: [0.000000] 1`,
expect: false,
},
{
log: `Jan 2 03:04:04 audit: [1.000000] 2`,
log: `Jan 2 03:04:04 audit: [1.000000] 2`,
expect: true,
},
{
log: `Jan 2 03:04:05 kubelet: [2.000000] 3`,
log: `Jan 2 03:04:05 kubelet: [2.000000] 3`,
expect: true,
},
}
for i, test := range testcase {
@@ -20,9 +20,9 @@ import (
"regexp"
"time"
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
"k8s.io/klog/v2"
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
)
// translator translates log line into internal log type based on user defined
@@ -17,12 +17,12 @@ limitations under the License.
package kmsg
import (
testclock "k8s.io/utils/clock/testing"
"testing"
"time"
"github.com/euank/go-kmsg-parser/kmsgparser"
"github.com/stretchr/testify/assert"
"time"
testclock "k8s.io/utils/clock/testing"
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
@@ -17,9 +17,9 @@ limitations under the License.
package logwatchers
import (
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
"k8s.io/klog/v2"
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
)
// createFuncs is a table of createFuncs for all supported log watchers.