mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-28 01:47:20 +00:00
Merge pull request #290 from xueweiz/test
Remove TestGoroutineLeak unit tests.
This commit is contained in:
@@ -17,15 +17,10 @@ limitations under the License.
|
|||||||
package systemlogmonitor
|
package systemlogmonitor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
|
|
||||||
watchertest "k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/testing"
|
|
||||||
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
|
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
|
||||||
"k8s.io/node-problem-detector/pkg/types"
|
"k8s.io/node-problem-detector/pkg/types"
|
||||||
"k8s.io/node-problem-detector/pkg/util"
|
"k8s.io/node-problem-detector/pkg/util"
|
||||||
@@ -143,13 +138,3 @@ func TestGenerateStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGoroutineLeak(t *testing.T) {
|
|
||||||
orignal := runtime.NumGoroutine()
|
|
||||||
f := watchertest.NewFakeLogWatcher(10)
|
|
||||||
f.InjectError(fmt.Errorf("unexpected error"))
|
|
||||||
l := &logMonitor{watcher: f}
|
|
||||||
_, err := l.Start()
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, orignal, runtime.NumGoroutine())
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package filelog
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -180,16 +179,3 @@ Jan 2 03:04:05 kernel: [2.000000] 3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGoroutineLeak(t *testing.T) {
|
|
||||||
orignal := runtime.NumGoroutine()
|
|
||||||
w := NewSyslogWatcherOrDie(types.WatcherConfig{
|
|
||||||
Plugin: "filelog",
|
|
||||||
PluginConfig: getTestPluginConfig(),
|
|
||||||
LogPath: "/not/exist/path",
|
|
||||||
Lookback: "10m",
|
|
||||||
})
|
|
||||||
_, err := w.Watch()
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, orignal, runtime.NumGoroutine())
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user