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.
master
Anis Elleuch 4 years ago committed by GitHub
parent 31bf6f0c25
commit f164085227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/go.yml
  2. 2
      cmd/test-utils_test.go
  3. 7
      cmd/xl-storage.go

@ -26,7 +26,6 @@ jobs:
env:
CGO_ENABLED: 0
GO111MODULE: on
MINIO_CI_CD: 1
run: |
go build --ldflags="-s -w" -o %GOPATH%\bin\minio.exe
go test -v --timeout 50m ./...
@ -35,7 +34,6 @@ jobs:
env:
CGO_ENABLED: 0
GO111MODULE: on
MINIO_CI_CD: 1
run: |
sudo sysctl net.ipv6.conf.all.disable_ipv6=0
sudo sysctl net.ipv6.conf.default.disable_ipv6=0

@ -115,6 +115,8 @@ func TestMain(m *testing.M) {
resetTestGlobals()
os.Setenv("MINIO_CI_CD", "ci")
os.Exit(m.Run())
}

@ -240,10 +240,15 @@ func newXLStorage(ep Endpoint) (*xlStorage, error) {
return nil, err
}
rootDisk, err := disk.IsRootDisk(path, "/")
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{
diskPath: path,

Loading…
Cancel
Save