Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
| ... | ... |
@@ -37,7 +37,7 @@ func TestAtomicWriteToFile(t *testing.T) {
|
| 37 | 37 |
t.Fatalf("Error reading from file: %v", err)
|
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 |
- if bytes.Compare(actual, expected) != 0 {
|
|
| 40 |
+ if !bytes.Equal(actual, expected) {
|
|
| 41 | 41 |
t.Fatalf("Data mismatch, expected %q, got %q", expected, actual)
|
| 42 | 42 |
} |
| 43 | 43 |
|
| ... | ... |
@@ -85,7 +85,7 @@ func TestAtomicWriteSetCommit(t *testing.T) {
|
| 85 | 85 |
t.Fatalf("Error reading from file: %v", err)
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 |
- if bytes.Compare(actual, expected) != 0 {
|
|
| 88 |
+ if !bytes.Equal(actual, expected) {
|
|
| 89 | 89 |
t.Fatalf("Data mismatch, expected %q, got %q", expected, actual)
|
| 90 | 90 |
} |
| 91 | 91 |
|
| ... | ... |
@@ -193,7 +193,7 @@ func TestMultiReadSeekerCurAfterSet(t *testing.T) {
|
| 193 | 193 |
func TestMultiReadSeekerSmallReads(t *testing.T) {
|
| 194 | 194 |
readers := []io.ReadSeeker{}
|
| 195 | 195 |
for i := 0; i < 10; i++ {
|
| 196 |
- integer := make([]byte, 4, 4) |
|
| 196 |
+ integer := make([]byte, 4) |
|
| 197 | 197 |
binary.BigEndian.PutUint32(integer, uint32(i)) |
| 198 | 198 |
readers = append(readers, bytes.NewReader(integer)) |
| 199 | 199 |
} |
| ... | ... |
@@ -23,7 +23,7 @@ func lookupGID(name string) (int, error) {
|
| 23 | 23 |
if err != nil {
|
| 24 | 24 |
return -1, errors.Wrapf(err, "error parsing groups for %s", name) |
| 25 | 25 |
} |
| 26 |
- if groups != nil && len(groups) > 0 {
|
|
| 26 |
+ if len(groups) > 0 {
|
|
| 27 | 27 |
return groups[0].Gid, nil |
| 28 | 28 |
} |
| 29 | 29 |
gid, err := strconv.Atoi(name) |
| ... | ... |
@@ -46,10 +46,7 @@ func Mount(device, target, mType, options string) error {
|
| 46 | 46 |
// flags.go for supported option flags. |
| 47 | 47 |
func ForceMount(device, target, mType, options string) error {
|
| 48 | 48 |
flag, data := parseOptions(options) |
| 49 |
- if err := mount(device, target, mType, uintptr(flag), data); err != nil {
|
|
| 50 |
- return err |
|
| 51 |
- } |
|
| 52 |
- return nil |
|
| 49 |
+ return mount(device, target, mType, uintptr(flag), data) |
|
| 53 | 50 |
} |
| 54 | 51 |
|
| 55 | 52 |
// Unmount will unmount the target filesystem, so long as it is mounted. |
| ... | ... |
@@ -66,7 +66,7 @@ func TestFileSpecPlugin(t *testing.T) {
|
| 66 | 66 |
t.Fatalf("Expected plugin addr `%s`, got %s\n", c.addr, p.Addr)
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
- if p.TLSConfig.InsecureSkipVerify != true {
|
|
| 69 |
+ if !p.TLSConfig.InsecureSkipVerify {
|
|
| 70 | 70 |
t.Fatalf("Expected TLS verification to be skipped")
|
| 71 | 71 |
} |
| 72 | 72 |
} |
| ... | ... |
@@ -53,7 +53,7 @@ func TestLocalSocket(t *testing.T) {
|
| 53 | 53 |
if p.Addr != addr {
|
| 54 | 54 |
t.Fatalf("Expected plugin addr `%s`, got %s\n", addr, p.Addr)
|
| 55 | 55 |
} |
| 56 |
- if p.TLSConfig.InsecureSkipVerify != true {
|
|
| 56 |
+ if !p.TLSConfig.InsecureSkipVerify {
|
|
| 57 | 57 |
t.Fatalf("Expected TLS verification to be skipped")
|
| 58 | 58 |
} |
| 59 | 59 |
l.Close() |
| ... | ... |
@@ -14,7 +14,7 @@ func TestOutputOnPrematureClose(t *testing.T) {
|
| 14 | 14 |
|
| 15 | 15 |
pr := NewProgressReader(reader, ChanOutput(progressChan), int64(len(content)), "Test", "Read") |
| 16 | 16 |
|
| 17 |
- part := make([]byte, 4, 4) |
|
| 17 |
+ part := make([]byte, 4) |
|
| 18 | 18 |
_, err := io.ReadFull(pr, part) |
| 19 | 19 |
if err != nil {
|
| 20 | 20 |
pr.Close() |