mirror of
https://github.com/minio/minio.git
synced 2025-04-09 14:10:10 -04:00
terminate disk-usage routine in tests (#5998)
tests were written in the manner by editing internal variables of fsObjects to mimic certain behavior from APIs, but this is racy when an active go-routine is reading from the same variable. Make sure to terminate the go-routine if possible for these tests.
This commit is contained in:
parent
74328c3061
commit
c247e603d2
@ -191,6 +191,8 @@ func TestFSGetBucketInfo(t *testing.T) {
|
|||||||
t.Fatal("BucketNotFound error not returned")
|
t.Fatal("BucketNotFound error not returned")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalServiceDoneCh <- struct{}{}
|
||||||
|
|
||||||
// Check for buckets and should get disk not found.
|
// Check for buckets and should get disk not found.
|
||||||
fs.fsPath = filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
|
fs.fsPath = filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
|
||||||
|
|
||||||
@ -301,6 +303,8 @@ func TestFSDeleteObject(t *testing.T) {
|
|||||||
t.Fatal("Unexpected error: ", err)
|
t.Fatal("Unexpected error: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalServiceDoneCh <- struct{}{}
|
||||||
|
|
||||||
// Delete object should err disk not found.
|
// Delete object should err disk not found.
|
||||||
fs.fsPath = filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
|
fs.fsPath = filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
|
||||||
if err := fs.DeleteObject(context.Background(), bucketName, objectName); err != nil {
|
if err := fs.DeleteObject(context.Background(), bucketName, objectName); err != nil {
|
||||||
@ -342,6 +346,8 @@ func TestFSDeleteBucket(t *testing.T) {
|
|||||||
|
|
||||||
obj.MakeBucketWithLocation(context.Background(), bucketName, "")
|
obj.MakeBucketWithLocation(context.Background(), bucketName, "")
|
||||||
|
|
||||||
|
globalServiceDoneCh <- struct{}{}
|
||||||
|
|
||||||
// Delete bucket should get error disk not found.
|
// Delete bucket should get error disk not found.
|
||||||
fs.fsPath = filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
|
fs.fsPath = filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
|
||||||
if err = fs.DeleteBucket(context.Background(), bucketName); err != nil {
|
if err = fs.DeleteBucket(context.Background(), bucketName); err != nil {
|
||||||
@ -365,6 +371,8 @@ func TestFSListBuckets(t *testing.T) {
|
|||||||
t.Fatal("Unexpected error: ", err)
|
t.Fatal("Unexpected error: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalServiceDoneCh <- struct{}{}
|
||||||
|
|
||||||
// Create a bucket with invalid name
|
// Create a bucket with invalid name
|
||||||
if err := os.MkdirAll(pathJoin(fs.fsPath, "vo^"), 0777); err != nil {
|
if err := os.MkdirAll(pathJoin(fs.fsPath, "vo^"), 0777); err != nil {
|
||||||
t.Fatal("Unexpected error: ", err)
|
t.Fatal("Unexpected error: ", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user