|
@@ -164,7 +164,8 @@ func TestDisk_Unmarshal(t *testing.T) {
|
|
|
|
|
|
|
|
disk1 := NewDisk("disk1", "cluster1", "disk1", *unmarshalWindow.start, *unmarshalWindow.end, unmarshalWindow)
|
|
disk1 := NewDisk("disk1", "cluster1", "disk1", *unmarshalWindow.start, *unmarshalWindow.end, unmarshalWindow)
|
|
|
disk1.ByteHours = 60.0 * gb * hours
|
|
disk1.ByteHours = 60.0 * gb * hours
|
|
|
- disk1.ByteHoursUsed = 40.0 * gb * hours
|
|
|
|
|
|
|
+ used := 40.0 * gb * hours
|
|
|
|
|
+ disk1.ByteHoursUsed = &used
|
|
|
max := 50.0 * gb * hours
|
|
max := 50.0 * gb * hours
|
|
|
disk1.ByteUsageMax = &max
|
|
disk1.ByteUsageMax = &max
|
|
|
disk1.Cost = 4.0
|
|
disk1.Cost = 4.0
|
|
@@ -214,7 +215,7 @@ func TestDisk_Unmarshal(t *testing.T) {
|
|
|
if disk1.ByteHours != disk2.ByteHours {
|
|
if disk1.ByteHours != disk2.ByteHours {
|
|
|
t.Fatalf("Disk Unmarshal: ByteHours mutated in unmarshal")
|
|
t.Fatalf("Disk Unmarshal: ByteHours mutated in unmarshal")
|
|
|
}
|
|
}
|
|
|
- if disk1.ByteHoursUsed != disk2.ByteHoursUsed {
|
|
|
|
|
|
|
+ if *disk1.ByteHoursUsed != *disk2.ByteHoursUsed {
|
|
|
t.Fatalf("Disk Unmarshal: ByteHoursUsed mutated in unmarshal")
|
|
t.Fatalf("Disk Unmarshal: ByteHoursUsed mutated in unmarshal")
|
|
|
}
|
|
}
|
|
|
if *disk1.ByteUsageMax != *disk2.ByteUsageMax {
|
|
if *disk1.ByteUsageMax != *disk2.ByteUsageMax {
|
|
@@ -232,7 +233,7 @@ func TestDisk_Unmarshal(t *testing.T) {
|
|
|
disk3 := NewDisk("disk3", "cluster1", "disk3", *unmarshalWindow.start, *unmarshalWindow.end, unmarshalWindow)
|
|
disk3 := NewDisk("disk3", "cluster1", "disk3", *unmarshalWindow.start, *unmarshalWindow.end, unmarshalWindow)
|
|
|
|
|
|
|
|
disk3.ByteHours = 60.0 * gb * hours
|
|
disk3.ByteHours = 60.0 * gb * hours
|
|
|
- disk3.ByteHoursUsed = 40.0 * gb * hours
|
|
|
|
|
|
|
+ disk3.ByteHoursUsed = nil
|
|
|
disk3.ByteUsageMax = nil
|
|
disk3.ByteUsageMax = nil
|
|
|
disk3.Cost = 4.0
|
|
disk3.Cost = 4.0
|
|
|
disk3.Local = 1.0
|
|
disk3.Local = 1.0
|
|
@@ -256,6 +257,10 @@ func TestDisk_Unmarshal(t *testing.T) {
|
|
|
t.Fatalf("Disk Unmarshal: unexpected error: %s", err)
|
|
t.Fatalf("Disk Unmarshal: unexpected error: %s", err)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Check that both disks have nil usage
|
|
|
|
|
+ if disk3.ByteHoursUsed != disk4.ByteHoursUsed {
|
|
|
|
|
+ t.Fatalf("Disk Unmarshal: ByteHoursUsed mutated in unmarshal")
|
|
|
|
|
+ }
|
|
|
// Check that both disks have nil max usage
|
|
// Check that both disks have nil max usage
|
|
|
if disk3.ByteUsageMax != disk4.ByteUsageMax {
|
|
if disk3.ByteUsageMax != disk4.ByteUsageMax {
|
|
|
t.Fatalf("Disk Unmarshal: ByteUsageMax mutated in unmarshal")
|
|
t.Fatalf("Disk Unmarshal: ByteUsageMax mutated in unmarshal")
|