restructuring tests to accommodate optimalPartSize of 0
This commit is contained in:
parent
93134a5696
commit
5b116e7087
|
@ -113,11 +113,12 @@ func TestCalcOptimalPartSize(t *testing.T) {
|
||||||
for index, size := range testcases {
|
for index, size := range testcases {
|
||||||
err = ""
|
err = ""
|
||||||
optimalPartSize, calcError := store.CalcOptimalPartSize(size)
|
optimalPartSize, calcError := store.CalcOptimalPartSize(size)
|
||||||
equalparts = size / optimalPartSize
|
|
||||||
lastpartsize = size % optimalPartSize
|
|
||||||
if size > MaxObjectSize && calcError == nil {
|
if size > MaxObjectSize && calcError == nil {
|
||||||
err += fmt.Sprintf("Testcase #%v size %v: size exceeds MaxObjectSize=%v but no error returned\n", index, size, MaxObjectSize)
|
err += fmt.Sprintf("Testcase #%v size %v: size exceeds MaxObjectSize=%v but no error returned\n", index, size, MaxObjectSize)
|
||||||
}
|
}
|
||||||
|
if calcError == nil {
|
||||||
|
equalparts = size / optimalPartSize
|
||||||
|
lastpartsize = size % optimalPartSize
|
||||||
if optimalPartSize < MinPartSize {
|
if optimalPartSize < MinPartSize {
|
||||||
err += fmt.Sprintf("Testcase #%v size %v, %v parts of size %v, lastpart %v: optimalPartSize < MinPartSize %v\n", index, size, equalparts, optimalPartSize, lastpartsize, MinPartSize)
|
err += fmt.Sprintf("Testcase #%v size %v, %v parts of size %v, lastpart %v: optimalPartSize < MinPartSize %v\n", index, size, equalparts, optimalPartSize, lastpartsize, MinPartSize)
|
||||||
}
|
}
|
||||||
|
@ -136,6 +137,7 @@ func TestCalcOptimalPartSize(t *testing.T) {
|
||||||
if lastpartsize > optimalPartSize {
|
if lastpartsize > optimalPartSize {
|
||||||
err += fmt.Sprintf("Testcase #%v size %v, %v parts of size %v, lastpart %v: lastpart > optimalPartSize %v\n", index, size, equalparts, optimalPartSize, lastpartsize, optimalPartSize)
|
err += fmt.Sprintf("Testcase #%v size %v, %v parts of size %v, lastpart %v: lastpart > optimalPartSize %v\n", index, size, equalparts, optimalPartSize, lastpartsize, optimalPartSize)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// fmt.Printf("Testcase #%v size %v, %v parts of size %v, lastpart %v\n", index, size, equalparts, optimalPartSize, lastpartsize)
|
// fmt.Printf("Testcase #%v size %v, %v parts of size %v, lastpart %v\n", index, size, equalparts, optimalPartSize, lastpartsize)
|
||||||
if len(err) > 0 {
|
if len(err) > 0 {
|
||||||
t.Errorf(err)
|
t.Errorf(err)
|
||||||
|
|
Loading…
Reference in New Issue