Fix flakey test in file_tests (#1783)
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
This commit is contained in:
parent
af30ba0e3b
commit
b203b3f444
1 changed files with 2 additions and 16 deletions
|
@ -213,7 +213,7 @@ filename: test_files/test_delete.log`,
|
||||||
})
|
})
|
||||||
|
|
||||||
tomb := tomb.Tomb{}
|
tomb := tomb.Tomb{}
|
||||||
out := make(chan types.Event)
|
out := make(chan types.Event, 100)
|
||||||
f := fileacquisition.FileSource{}
|
f := fileacquisition.FileSource{}
|
||||||
|
|
||||||
if tc.setup != nil {
|
if tc.setup != nil {
|
||||||
|
@ -229,22 +229,8 @@ filename: test_files/test_delete.log`,
|
||||||
if tc.afterConfigure != nil {
|
if tc.afterConfigure != nil {
|
||||||
tc.afterConfigure()
|
tc.afterConfigure()
|
||||||
}
|
}
|
||||||
|
|
||||||
actualLines := 0
|
|
||||||
if tc.expectedLines != 0 {
|
|
||||||
go func() {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-out:
|
|
||||||
actualLines++
|
|
||||||
case <-time.After(2 * time.Second):
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
err = f.OneShotAcquisition(out, &tomb)
|
err = f.OneShotAcquisition(out, &tomb)
|
||||||
|
actualLines := len(out)
|
||||||
cstest.RequireErrorContains(t, err, tc.expectedErr)
|
cstest.RequireErrorContains(t, err, tc.expectedErr)
|
||||||
|
|
||||||
if tc.expectedLines != 0 {
|
if tc.expectedLines != 0 {
|
||||||
|
|
Loading…
Reference in a new issue