-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdisk_update_test.go
36 lines (29 loc) · 979 Bytes
/
disk_update_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ovirtclient_test
import (
"testing"
ovirtclient "github.com/ovirt/go-ovirt-client/v3"
)
func TestExtendDisk(t *testing.T) {
helper := getHelper(t)
disk := assertCanCreateDisk(t, helper)
newDiskSize := disk.ProvisionedSize() + 4096
t.Logf("Increasing disk %s size to %d bytes...", disk.ID(), newDiskSize)
updatedDisk, err := disk.Update(ovirtclient.UpdateDiskParams().MustWithProvisionedSize(newDiskSize))
if err != nil {
t.Fatalf("Failed to extend disk %s (%v)", disk.ID(), err)
}
t.Logf("Waiting for disk to become OK...")
updatedDisk, err = updatedDisk.WaitForOK()
if err != nil {
t.Fatalf("Failed to wait for disk %s to return to OK status. (%v)", disk.ID(), err)
}
t.Logf("Checking new disk size...")
if updatedDisk.ProvisionedSize() < newDiskSize {
t.Fatalf(
"The updated disk had a size smaller than expected (%d bytes instead of %d bytes).",
updatedDisk.ProvisionedSize(),
newDiskSize,
)
}
t.Logf("New disk size is OK.")
}