Skip to content

Commit df2bc3d

Browse files
authored
Merge pull request #290 from xueweiz/test
Remove TestGoroutineLeak unit tests.
2 parents 831f7fb + c6c4e80 commit df2bc3d

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

pkg/systemlogmonitor/log_monitor_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,10 @@ limitations under the License.
1717
package systemlogmonitor
1818

1919
import (
20-
"fmt"
2120
"reflect"
22-
"runtime"
2321
"testing"
2422
"time"
2523

26-
"github.com/stretchr/testify/assert"
27-
28-
watchertest "k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/testing"
2924
logtypes "k8s.io/node-problem-detector/pkg/systemlogmonitor/types"
3025
"k8s.io/node-problem-detector/pkg/types"
3126
"k8s.io/node-problem-detector/pkg/util"
@@ -143,13 +138,3 @@ func TestGenerateStatus(t *testing.T) {
143138
}
144139
}
145140
}
146-
147-
func TestGoroutineLeak(t *testing.T) {
148-
orignal := runtime.NumGoroutine()
149-
f := watchertest.NewFakeLogWatcher(10)
150-
f.InjectError(fmt.Errorf("unexpected error"))
151-
l := &logMonitor{watcher: f}
152-
_, err := l.Start()
153-
assert.Error(t, err)
154-
assert.Equal(t, orignal, runtime.NumGoroutine())
155-
}

pkg/systemlogmonitor/logwatchers/filelog/log_watcher_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package filelog
1919
import (
2020
"io/ioutil"
2121
"os"
22-
"runtime"
2322
"testing"
2423
"time"
2524

@@ -180,16 +179,3 @@ Jan 2 03:04:05 kernel: [2.000000] 3
180179
}
181180
}
182181
}
183-
184-
func TestGoroutineLeak(t *testing.T) {
185-
orignal := runtime.NumGoroutine()
186-
w := NewSyslogWatcherOrDie(types.WatcherConfig{
187-
Plugin: "filelog",
188-
PluginConfig: getTestPluginConfig(),
189-
LogPath: "/not/exist/path",
190-
Lookback: "10m",
191-
})
192-
_, err := w.Watch()
193-
assert.Error(t, err)
194-
assert.Equal(t, orignal, runtime.NumGoroutine())
195-
}

0 commit comments

Comments
 (0)