mirror of
https://github.com/pgsty/minio.git
synced 2026-07-25 06:56:18 +03:00
tests: Implemented more tests for fs-v1*.go (#2686)
This commit is contained in:
committed by
Harshavardhana
parent
7d37dea449
commit
b89a1cd482
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user