Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions test/e2e/internal/util/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ func IsKnownKubeVirtClientSocketClosedFailureReason(reason string) bool {

// TODO: remove temporary migration skip logic when issue "client socket is closed" is fixed:
func SkipIfKnownKubeVirtClientSocketClosedMigrationFailure(vm *v1alpha2.VirtualMachine) {
SkipIfKnownKubeVirtClientSocketClosedMigrationFailureWithContext(context.Background(), vm)
}

// TODO: remove temporary migration skip logic when issue "client socket is closed" is fixed:
func SkipIfKnownKubeVirtClientSocketClosedMigrationFailureWithContext(ctx context.Context, vm *v1alpha2.VirtualMachine) {
GinkgoHelper()

if vm == nil {
return
}

intvirtvmi, err := getInternalVirtualMachineInstance(vm)
intvirtvmi, err := getInternalVirtualMachineInstance(ctx, vm)
Expect(err).NotTo(HaveOccurred())
if intvirtvmi == nil || intvirtvmi.Status.MigrationState == nil {
return
Expand All @@ -77,13 +82,18 @@ func IsKnownVolumesUpdateFailureReason(reason string) bool {

// TODO: remove temporary migration skip logic when known issue "VolumesUpdateError" is fixed:
func SkipIfKnownVolumesUpdateMigrationFailure(vm *v1alpha2.VirtualMachine) {
SkipIfKnownVolumesUpdateMigrationFailureWithContext(context.Background(), vm)
}

// TODO: remove temporary migration skip logic when known issue "VolumesUpdateError" is fixed:
func SkipIfKnownVolumesUpdateMigrationFailureWithContext(ctx context.Context, vm *v1alpha2.VirtualMachine) {
GinkgoHelper()

if vm == nil {
return
}

intvirtvmi, err := getInternalVirtualMachineInstance(vm)
intvirtvmi, err := getInternalVirtualMachineInstance(ctx, vm)
Expect(err).NotTo(HaveOccurred())
if intvirtvmi == nil {
return
Expand All @@ -100,10 +110,16 @@ func SkipIfKnownVolumesUpdateMigrationFailure(vm *v1alpha2.VirtualMachine) {
// TODO: remove temporary migration skip logic when both known issues are fixed:
// kubevirt "client socket is closed" and VolumesUpdateError.
func SkipIfKnownMigrationFailure(vm *v1alpha2.VirtualMachine) {
SkipIfKnownMigrationFailureWithContext(context.Background(), vm)
}

// TODO: remove temporary migration skip logic when both known issues are fixed:
// kubevirt "client socket is closed" and VolumesUpdateError.
func SkipIfKnownMigrationFailureWithContext(ctx context.Context, vm *v1alpha2.VirtualMachine) {
GinkgoHelper()

SkipIfKnownKubeVirtClientSocketClosedMigrationFailure(vm)
SkipIfKnownVolumesUpdateMigrationFailure(vm)
SkipIfKnownKubeVirtClientSocketClosedMigrationFailureWithContext(ctx, vm)
SkipIfKnownVolumesUpdateMigrationFailureWithContext(ctx, vm)
}

// TODO: remove temporary migration skip logic when VD Migration Controller revert issue is fixed:
Expand All @@ -125,11 +141,11 @@ func SkipIfVDMigrationReverted(namespace string) {
}
}

func getInternalVirtualMachineInstance(vm *v1alpha2.VirtualMachine) (*virtv1.VirtualMachineInstance, error) {
func getInternalVirtualMachineInstance(ctx context.Context, vm *v1alpha2.VirtualMachine) (*virtv1.VirtualMachineInstance, error) {
GinkgoHelper()

obj := &rewrite.VirtualMachineInstance{}
err := framework.GetClients().RewriteClient().Get(context.Background(), vm.Name, obj, rewrite.InNamespace(vm.Namespace))
err := framework.GetClients().RewriteClient().Get(ctx, vm.Name, obj, rewrite.InNamespace(vm.Namespace))
if err != nil {
if k8serrors.IsNotFound(err) {
return nil, nil
Expand Down
Loading
Loading