pkg/units: Standardized supported sizes
May make sense that both `FromHumanSize()` and `RAMInBytes()` support the same units. Added 'PB' to the RAMInBytes regex. Also updated tests. Note: int64 is overflowed on quantities >= EB Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
This commit is contained in:
parent
299020949f
commit
f26b6b00d3
2 changed files with 7 additions and 1 deletions
|
@ -64,7 +64,11 @@ func TestRAMInBytes(t *testing.T) {
|
|||
assertRAMInBytes(t, "32MB", false, 32*1024*1024)
|
||||
assertRAMInBytes(t, "32Gb", false, 32*1024*1024*1024)
|
||||
assertRAMInBytes(t, "32G", false, 32*1024*1024*1024)
|
||||
assertRAMInBytes(t, "32GB", false, 32*1024*1024*1024)
|
||||
assertRAMInBytes(t, "32Tb", false, 32*1024*1024*1024*1024)
|
||||
assertRAMInBytes(t, "8Pb", false, 8*1024*1024*1024*1024*1024)
|
||||
assertRAMInBytes(t, "8PB", false, 8*1024*1024*1024*1024*1024)
|
||||
assertRAMInBytes(t, "8P", false, 8*1024*1024*1024*1024*1024)
|
||||
|
||||
assertRAMInBytes(t, "", true, -1)
|
||||
assertRAMInBytes(t, "hello", true, -1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue