@ -420,6 +420,8 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
parts1 , errs1 := readAllFileInfo ( ctx , erasureDisks , bucket , object1 , "" )
parts1SC := globalStorageClass
// Object for test case 2 - No StorageClass defined, MetaData in PutObject requesting RRS Class
object2 := "object2"
metadata2 := make ( map [ string ] string )
@ -430,6 +432,7 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
}
parts2 , errs2 := readAllFileInfo ( ctx , erasureDisks , bucket , object2 , "" )
parts2SC := globalStorageClass
// Object for test case 3 - No StorageClass defined, MetaData in PutObject requesting Standard Storage Class
object3 := "object3"
@ -441,6 +444,7 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
}
parts3 , errs3 := readAllFileInfo ( ctx , erasureDisks , bucket , object3 , "" )
parts3SC := globalStorageClass
// Object for test case 4 - Standard StorageClass defined as Parity 6, MetaData in PutObject requesting Standard Storage Class
object4 := "object4"
@ -458,6 +462,11 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
}
parts4 , errs4 := readAllFileInfo ( ctx , erasureDisks , bucket , object4 , "" )
parts4SC := storageclass . Config {
Standard : storageclass . StorageClass {
Parity : 6 ,
} ,
}
// Object for test case 5 - RRS StorageClass defined as Parity 2, MetaData in PutObject requesting RRS Class
// Reset global storage class flags
@ -476,6 +485,11 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
}
parts5 , errs5 := readAllFileInfo ( ctx , erasureDisks , bucket , object5 , "" )
parts5SC := storageclass . Config {
RRS : storageclass . StorageClass {
Parity : 2 ,
} ,
}
// Object for test case 6 - RRS StorageClass defined as Parity 2, MetaData in PutObject requesting Standard Storage Class
object6 := "object6"
@ -493,6 +507,11 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
}
parts6 , errs6 := readAllFileInfo ( ctx , erasureDisks , bucket , object6 , "" )
parts6SC := storageclass . Config {
RRS : storageclass . StorageClass {
Parity : 2 ,
} ,
}
// Object for test case 7 - Standard StorageClass defined as Parity 5, MetaData in PutObject requesting RRS Class
// Reset global storage class flags
@ -511,25 +530,32 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
}
parts7 , errs7 := readAllFileInfo ( ctx , erasureDisks , bucket , object7 , "" )
parts7SC := storageclass . Config {
Standard : storageclass . StorageClass {
Parity : 5 ,
} ,
}
tests := [ ] struct {
parts [ ] FileInfo
errs [ ] error
expectedReadQuorum int
expectedWriteQuorum int
storageClassCfg storageclass . Config
expectedError error
} {
{ parts1 , errs1 , 8 , 9 , nil } ,
{ parts2 , errs2 , 14 , 15 , nil } ,
{ parts3 , errs3 , 8 , 9 , nil } ,
{ parts4 , errs4 , 10 , 11 , nil } ,
{ parts5 , errs5 , 14 , 15 , nil } ,
{ parts6 , errs6 , 8 , 9 , nil } ,
{ parts7 , errs7 , 14 , 15 , nil } ,
{ parts1 , errs1 , 8 , 9 , parts1SC , nil } ,
{ parts2 , errs2 , 14 , 14 , parts2SC , nil } ,
{ parts3 , errs3 , 8 , 9 , parts3SC , nil } ,
{ parts4 , errs4 , 10 , 10 , parts4SC , nil } ,
{ parts5 , errs5 , 14 , 14 , parts 5SC , nil } ,
{ parts6 , errs6 , 8 , 9 , parts6SC , nil } ,
{ parts7 , errs7 , 14 , 14 , parts7SC , nil } ,
}
for _ , tt := range tests {
tt := tt
t . ( * testing . T ) . Run ( "" , func ( t * testing . T ) {
globalStorageClass = tt . storageClassCfg
actualReadQuorum , actualWriteQuorum , err := objectQuorumFromMeta ( ctx , * xl , tt . parts , tt . errs )
if tt . expectedError != nil && err == nil {
t . Errorf ( "Expected %s, got %s" , tt . expectedError , err )