mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-05-06 01:07:07 +00:00
Remove TestGoroutineLeak unit tests.
We are seeing some flakes on these tests because some goroutine fluctuation: https://github.com/kubernetes/node-problem-detector/pull/275#issuecomment-499306727 Removing the tests, as it's robust to test leakage in a soak/stress test, rather than unit test.
This commit is contained in:
@@ -17,15 +17,10 @@ limitations under the License.
|
||||
package systemlogmonitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"testing"
|
||||
"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"
|
||||
"k8s.io/node-problem-detector/pkg/types"
|
||||
"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 (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
"testing"
|
||||
"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