Don't pass empty row to channel on error

This commit is contained in:
Rob Mulholand 2019-04-26 10:36:42 -05:00
parent 6a86de87b4
commit d77f3fe012
2 changed files with 8 additions and 1 deletions

View File

@ -27,7 +27,8 @@ func (storageFetcher CsvTailStorageFetcher) FetchStorageDiffs(out chan<- utils.S
row, parseErr := utils.FromStrings(strings.Split(line.Text, ",")) row, parseErr := utils.FromStrings(strings.Split(line.Text, ","))
if parseErr != nil { if parseErr != nil {
errs <- parseErr errs <- parseErr
} else {
out <- row
} }
out <- row
} }
} }

View File

@ -58,6 +58,12 @@ var _ = Describe("Csv Tail Storage Fetcher", func() {
mockTailer.Lines <- line mockTailer.Lines <- line
Expect(<-errorsChannel).To(HaveOccurred()) Expect(<-errorsChannel).To(HaveOccurred())
select {
case <-rowsChannel:
Fail("value passed to rows channel on error")
default:
Succeed()
}
close(done) close(done)
}) })
}) })