Adding check of returned error in test

Adding a check for the returned error to make sure a non-nil value
is not returned.

Signed-off-by: Matt Farina <matt@mattfarina.com>
pull/8086/head
Matt Farina 5 years ago
parent 716c635d4e
commit 921e6abf27
No known key found for this signature in database
GPG Key ID: 9436E80BFBA46909

@ -43,16 +43,22 @@ func TestLoadArchiveFiles(t *testing.T) {
generate: func(w *tar.Writer) { generate: func(w *tar.Writer) {
// simulate the presence of a `pax_global_header` file like you would get when // simulate the presence of a `pax_global_header` file like you would get when
// processing a GitHub release archive. // processing a GitHub release archive.
_ = w.WriteHeader(&tar.Header{ err := w.WriteHeader(&tar.Header{
Typeflag: tar.TypeXGlobalHeader, Typeflag: tar.TypeXGlobalHeader,
Name: "pax_global_header", Name: "pax_global_header",
}) })
if err != nil {
t.Fatal(err)
}
// we need to have at least one file, otherwise we'll get the "no files in chart archive" error // we need to have at least one file, otherwise we'll get the "no files in chart archive" error
_ = w.WriteHeader(&tar.Header{ err = w.WriteHeader(&tar.Header{
Typeflag: tar.TypeReg, Typeflag: tar.TypeReg,
Name: "dir/empty", Name: "dir/empty",
}) })
if err != nil {
t.Fatal(err)
}
}, },
check: func(t *testing.T, files []*BufferedFile, err error) { check: func(t *testing.T, files []*BufferedFile, err error) {
if err != nil { if err != nil {

Loading…
Cancel
Save