More tests for web handlers (#2755)

* Return negative values of Total and Free in StorageInfo() when we fail to get disk info

* Return consistent messages in web handlers when the server is not initialized
This commit is contained in:
Anis Elleuch
2016-09-23 00:35:12 +01:00
committed by Harshavardhana
parent 79e0c52fc2
commit fc783f8407
3 changed files with 309 additions and 13 deletions

View File

@@ -224,6 +224,12 @@ func (xl xlObjects) StorageInfo() StorageInfo {
// Sort so that the first element is the smallest.
sort.Sort(byDiskTotal(disksInfo))
if len(disksInfo) == 0 {
return StorageInfo{
Total: -1,
Free: -1,
}
}
// Return calculated storage info, choose the lowest Total and
// Free as the total aggregated values. Total capacity is always
// the multiple of smallest disk among the disk list.