forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_flavor.go
33 lines (27 loc) · 1.2 KB
/
mock_flavor.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
package testutils
import (
k8sfield "k8s.io/apimachinery/pkg/util/validation/field"
v1 "kubevirt.io/api/core/v1"
flavorv1alpha1 "kubevirt.io/api/flavor/v1alpha1"
"kubevirt.io/kubevirt/pkg/flavor"
)
type MockFlavorMethods struct {
FindFlavorFunc func(vm *v1.VirtualMachine) (*flavorv1alpha1.VirtualMachineFlavorProfile, error)
ApplyToVmiFunc func(field *k8sfield.Path, profile *flavorv1alpha1.VirtualMachineFlavorProfile, vmiSpec *v1.VirtualMachineInstanceSpec) flavor.Conflicts
}
func (m *MockFlavorMethods) FindProfile(vm *v1.VirtualMachine) (*flavorv1alpha1.VirtualMachineFlavorProfile, error) {
return m.FindFlavorFunc(vm)
}
func (m *MockFlavorMethods) ApplyToVmi(field *k8sfield.Path, profile *flavorv1alpha1.VirtualMachineFlavorProfile, vmiSpec *v1.VirtualMachineInstanceSpec) flavor.Conflicts {
return m.ApplyToVmiFunc(field, profile, vmiSpec)
}
func NewMockFlavorMethods() *MockFlavorMethods {
return &MockFlavorMethods{
FindFlavorFunc: func(_ *v1.VirtualMachine) (*flavorv1alpha1.VirtualMachineFlavorProfile, error) {
return nil, nil
},
ApplyToVmiFunc: func(_ *k8sfield.Path, _ *flavorv1alpha1.VirtualMachineFlavorProfile, _ *v1.VirtualMachineInstanceSpec) flavor.Conflicts {
return nil
},
}
}