mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
xl: Always set root disk to true in test environment (#11094)
Tests environments (go test or manual testing) should always consider the passed disks are root disks and should not rely on disk.IsRootDisk() function. The reason is that this latter can return a false negative when called in a busy system. However, returning a false negative will only occur in a testing environment and not in a production, so we can accept this trade-off for now.
This commit is contained in:
@@ -115,6 +115,8 @@ func TestMain(m *testing.M) {
|
||||
|
||||
resetTestGlobals()
|
||||
|
||||
os.Setenv("MINIO_CI_CD", "ci")
|
||||
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
||||
@@ -240,9 +240,14 @@ func newXLStorage(ep Endpoint) (*xlStorage, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rootDisk, err := disk.IsRootDisk(path, "/")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var rootDisk bool
|
||||
if env.Get("MINIO_CI_CD", "") != "" {
|
||||
rootDisk = true
|
||||
} else {
|
||||
rootDisk, err = disk.IsRootDisk(path, "/")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
p := &xlStorage{
|
||||
|
||||
Reference in New Issue
Block a user