Don't pass empty row to channel on error

This commit is contained in:
Rob Mulholand
2019-05-01 12:30:37 -05:00
parent 6a86de87b4
commit d77f3fe012
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ func (storageFetcher CsvTailStorageFetcher) FetchStorageDiffs(out chan<- utils.S
row, parseErr := utils.FromStrings(strings.Split(line.Text, ","))
if parseErr != nil {
errs <- parseErr
} else {
out <- row
}
out <- row
}
}
@@ -58,6 +58,12 @@ var _ = Describe("Csv Tail Storage Fetcher", func() {
mockTailer.Lines <- line
Expect(<-errorsChannel).To(HaveOccurred())
select {
case <-rowsChannel:
Fail("value passed to rows channel on error")
default:
Succeed()
}
close(done)
})
})