mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
tests: Fix the sopradic test failure in TestListObjectPartsDiskNotFound (#4107)
getBucketInfo() should keep track errors ignored, such that in a situation where all errors were ignored we need to reduce the errors using readQuorum to get a consistent error value. This is the problem we see with DiskNotFound test disks are randomly removed. Fixes #4095
This commit is contained in:
parent
e4bd882f11
commit
6683247080
@ -1457,7 +1457,7 @@ func testListObjectPartsDiskNotFound(obj ObjectLayer, instanceType string, disks
|
|||||||
// Failed as expected, but does it fail for the expected reason.
|
// Failed as expected, but does it fail for the expected reason.
|
||||||
if actualErr != nil && !testCase.shouldPass {
|
if actualErr != nil && !testCase.shouldPass {
|
||||||
if !strings.Contains(actualErr.Error(), testCase.expectedErr.Error()) {
|
if !strings.Contains(actualErr.Error(), testCase.expectedErr.Error()) {
|
||||||
t.Errorf("Test %d: %s: Expected to fail with error \"%s\", but instead failed with error \"%s\" instead", i+1, instanceType, testCase.expectedErr.Error(), actualErr.Error())
|
t.Errorf("Test %d: %s: Expected to fail with error \"%s\", but instead failed with error \"%s\" instead", i+1, instanceType, testCase.expectedErr, actualErr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Passes as expected, but asserting the results.
|
// Passes as expected, but asserting the results.
|
||||||
|
@ -113,27 +113,34 @@ func undoMakeBucket(storageDisks []StorageAPI, bucket string) {
|
|||||||
|
|
||||||
// getBucketInfo - returns the BucketInfo from one of the load balanced disks.
|
// getBucketInfo - returns the BucketInfo from one of the load balanced disks.
|
||||||
func (xl xlObjects) getBucketInfo(bucketName string) (bucketInfo BucketInfo, err error) {
|
func (xl xlObjects) getBucketInfo(bucketName string) (bucketInfo BucketInfo, err error) {
|
||||||
|
var bucketErrs []error
|
||||||
for _, disk := range xl.getLoadBalancedDisks() {
|
for _, disk := range xl.getLoadBalancedDisks() {
|
||||||
if disk == nil {
|
if disk == nil {
|
||||||
|
bucketErrs = append(bucketErrs, errDiskNotFound)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var volInfo VolInfo
|
volInfo, serr := disk.StatVol(bucketName)
|
||||||
volInfo, err = disk.StatVol(bucketName)
|
if serr == nil {
|
||||||
if err == nil {
|
|
||||||
bucketInfo = BucketInfo{
|
bucketInfo = BucketInfo{
|
||||||
Name: volInfo.Name,
|
Name: volInfo.Name,
|
||||||
Created: volInfo.Created,
|
Created: volInfo.Created,
|
||||||
}
|
}
|
||||||
return bucketInfo, nil
|
return bucketInfo, nil
|
||||||
}
|
}
|
||||||
err = traceError(err)
|
err = traceError(serr)
|
||||||
// For any reason disk went offline continue and pick the next one.
|
// For any reason disk went offline continue and pick the next one.
|
||||||
if isErrIgnored(err, bucketMetadataOpIgnoredErrs...) {
|
if isErrIgnored(err, bucketMetadataOpIgnoredErrs...) {
|
||||||
|
bucketErrs = append(bucketErrs, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
break
|
// Any error which cannot be ignored, we return quickly.
|
||||||
|
return BucketInfo{}, err
|
||||||
}
|
}
|
||||||
return BucketInfo{}, err
|
// If all our errors were ignored, then we try to
|
||||||
|
// reduce to one error based on read quorum.
|
||||||
|
// `nil` is deliberately passed for ignoredErrs
|
||||||
|
// because these errors were already ignored.
|
||||||
|
return BucketInfo{}, reduceReadQuorumErrs(bucketErrs, nil, xl.readQuorum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBucketInfo - returns BucketInfo for a bucket.
|
// GetBucketInfo - returns BucketInfo for a bucket.
|
||||||
@ -180,6 +187,7 @@ func (xl xlObjects) listBuckets() (bucketsInfo []BucketInfo, err error) {
|
|||||||
}
|
}
|
||||||
return bucketsInfo, nil
|
return bucketsInfo, nil
|
||||||
}
|
}
|
||||||
|
err = traceError(err)
|
||||||
// Ignore any disks not found.
|
// Ignore any disks not found.
|
||||||
if isErrIgnored(err, bucketMetadataOpIgnoredErrs...) {
|
if isErrIgnored(err, bucketMetadataOpIgnoredErrs...) {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user