mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-23 22:26:27 +00:00
Add existing monitors into the problem daemon registration hook.
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
"k8s.io/node-problem-detector/pkg/problemdaemon"
|
||||
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers"
|
||||
watchertypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
|
||||
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
|
||||
@@ -32,6 +33,16 @@ import (
|
||||
"k8s.io/node-problem-detector/pkg/util/tomb"
|
||||
)
|
||||
|
||||
const SystemLogMonitorName = "system-log-monitor"
|
||||
|
||||
func init() {
|
||||
problemdaemon.Register(
|
||||
SystemLogMonitorName,
|
||||
types.ProblemDaemonHandler{
|
||||
CreateProblemDaemonOrDie: NewLogMonitorOrDie,
|
||||
CmdOptionDescription: "Set to config file paths."})
|
||||
}
|
||||
|
||||
type logMonitor struct {
|
||||
watcher watchertypes.LogWatcher
|
||||
buffer LogBuffer
|
||||
|
||||
@@ -21,6 +21,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"k8s.io/node-problem-detector/pkg/problemdaemon"
|
||||
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
|
||||
"k8s.io/node-problem-detector/pkg/types"
|
||||
"k8s.io/node-problem-detector/pkg/util"
|
||||
@@ -32,6 +35,12 @@ const (
|
||||
testConditionB = "TestConditionB"
|
||||
)
|
||||
|
||||
func TestRegistration(t *testing.T) {
|
||||
assert.NotPanics(t,
|
||||
func() { problemdaemon.GetProblemDaemonHandlerOrDie("system-log-monitor") },
|
||||
"System log monitor failed to register itself as a problem daemon.")
|
||||
}
|
||||
|
||||
func TestGenerateStatus(t *testing.T) {
|
||||
initConditions := []types.Condition{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user