Skip to content

Commit 802f0b8

Browse files
committed
fix utils test
1 parent 334d947 commit 802f0b8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

internal/pkg/services/iaas/utils/utils_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ type IaaSClientMocked struct {
3333
GetImageResp *iaas.Image
3434
GetAffinityGroupsFails bool
3535
GetAffinityGroupResp *iaas.AffinityGroup
36+
GetBackupFails bool
37+
GetBackupResp *iaas.Backup
38+
GetSnapshotFails bool
39+
GetSnapshotResp *iaas.Snapshot
3640
}
3741

3842
func (m *IaaSClientMocked) GetAffinityGroupExecute(_ context.Context, _, _ string) (*iaas.AffinityGroup, error) {
@@ -112,6 +116,19 @@ func (m *IaaSClientMocked) GetImageExecute(_ context.Context, _, _ string) (*iaa
112116
return m.GetImageResp, nil
113117
}
114118

119+
func (m *IaaSClientMocked) GetBackupExecute(_ context.Context, _, _ string) (*iaas.Backup, error) {
120+
if m.GetBackupFails {
121+
return nil, fmt.Errorf("could not get backup")
122+
}
123+
return m.GetBackupResp, nil
124+
}
125+
126+
func (m *IaaSClientMocked) GetSnapshotExecute(_ context.Context, _, _ string) (*iaas.Snapshot, error) {
127+
if m.GetSnapshotFails {
128+
return nil, fmt.Errorf("could not get snapshot")
129+
}
130+
return m.GetSnapshotResp, nil
131+
}
115132
func TestGetSecurityGroupRuleName(t *testing.T) {
116133
type args struct {
117134
getInstanceFails bool

0 commit comments

Comments
 (0)