tests: Implemented more tests for fs-v1*.go (#2686)

This commit is contained in:
Anis Elleuch
2016-09-16 21:06:49 +01:00
committed by Harshavardhana
parent 7d37dea449
commit b89a1cd482
10 changed files with 803 additions and 24 deletions
+8 -1
View File
@@ -16,7 +16,10 @@
package cmd
import "github.com/minio/minio/pkg/disk"
import (
"github.com/minio/minio/pkg/disk"
"sync"
)
// naughtyDisk wraps a POSIX disk and returns programmed errors
// specified by the developer. The purpose is to simulate errors
@@ -31,6 +34,8 @@ type naughtyDisk struct {
defaultErr error
// The current API call number
callNR int
// Data protection
mu sync.Mutex
}
func newNaughtyDisk(d *posix, errs map[int]error, defaultErr error) *naughtyDisk {
@@ -38,6 +43,8 @@ func newNaughtyDisk(d *posix, errs map[int]error, defaultErr error) *naughtyDisk
}
func (d *naughtyDisk) calcError() (err error) {
d.mu.Lock()
defer d.mu.Unlock()
d.callNR++
if err, ok := d.errors[d.callNR]; ok {
return err