Add error checks in a few test files and fix misspelled words (#919)

* Remove inefficient assignment of variable cxt in pkg/storage/fs

* Remove inefficient assignment of variable cxt in pkg/storage/minio

* Remove inefficient assignment of variable cxt in pkg/storage/mongo

* Fix commonly misspelled English words successfully and accessible

* Remove inefficient assignment of variable cxt in pkg/download

* Remove inefficient assignment of variable cxt in pkg/module

* Add missing error checks in a few unit-test files

* Revert removal of inefficient assignment of variable cxt

The variable, although is not being used, it maintains the readability
in the functions where it’s being assigned. The removal of `cxt` in
these files may introduce errors when a new function taking these
values is called. Two other contributors agree that it’s easy to miss
this detail when passing the variable to other functions and the traces
are not being recorded.

* Modify unit-test error reporting for the config package

* Modify config test to exit when ioutil.TempFile or os.Chmod fail
This commit is contained in:
Yorman
2018-11-21 11:16:05 -08:00
committed by marpio
parent 35231b7365
commit b92a642f1a
4 changed files with 10 additions and 10 deletions
+6 -8
View File
@@ -305,23 +305,21 @@ func Test_checkFilePerms(t *testing.T) {
f1, err := ioutil.TempFile(os.TempDir(), "prefix-")
if err != nil {
t.FailNow()
t.Fatalf("Cannot create 1st temp file: %s", err)
}
defer os.Remove(f1.Name())
err = os.Chmod(f1.Name(), 0700)
if err != nil {
t.Fatalf("%s\n", err)
if err = os.Chmod(f1.Name(), 0700); err != nil {
t.Fatalf("Cannot chmod 1st temp file: %s", err)
}
f2, err := ioutil.TempFile(os.TempDir(), "prefix-")
if err != nil {
t.FailNow()
t.Fatalf("Cannot create 2nd temp file: %s", err)
}
defer os.Remove(f2.Name())
err = os.Chmod(f2.Name(), 0640)
if err != nil {
t.Fatalf("%s\n", err)
if err = os.Chmod(f2.Name(), 0640); err != nil {
t.Fatalf("Cannot chmod 2nd temp file: %s", err)
}
type args struct {