test: migrate VirtualMachineImageHotplug e2e test to new framework#2443
Open
eofff wants to merge 3 commits into
Open
test: migrate VirtualMachineImageHotplug e2e test to new framework#2443eofff wants to merge 3 commits into
eofff wants to merge 3 commits into
Conversation
8ae0ba1 to
6dd1ae7
Compare
hardcoretime
reviewed
Jun 4, 2026
hardcoretime
requested changes
Jun 4, 2026
6ea377b to
e7a4413
Compare
b1ec9c9 to
a2576d3
Compare
added 2 commits
June 15, 2026 14:24
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
a2576d3 to
a7d545a
Compare
a7d545a to
5c453d6
Compare
hardcoretime
requested changes
Jun 19, 2026
| Eventually(func(g Gomega) { | ||
| count, diskErr := util.GetDiskCount(f, vm.Name, vm.Namespace) | ||
| g.Expect(diskErr).NotTo(HaveOccurred()) | ||
| g.Expect(count).To(Equal(initialDiskCount)) |
Contributor
There was a problem hiding this comment.
Add a short description to the error message.
| } | ||
| } | ||
| g.Expect(attached).To( | ||
| BeNumerically(">=", expectedAttached+1), |
Contributor
There was a problem hiding this comment.
Maybe we should use strict equality?
| } | ||
|
|
||
| func tryMountReadOnly(f *framework.Framework, vm *v1alpha2.VirtualMachine, sourcePath, mountPoint string) (bool, error) { | ||
| cmd := fmt.Sprintf("if sudo mount -o ro %q %q >/dev/null 2>&1; then echo true; else echo false; fi", sourcePath, mountPoint) |
Contributor
There was a problem hiding this comment.
If this script returns an error, it will not be clear, and we will not see an error message.
| } | ||
|
|
||
| func firstPartitionPath(f *framework.Framework, vm *v1alpha2.VirtualMachine, sourcePath string) (string, error) { | ||
| cmd := fmt.Sprintf("lsblk -lnpo PATH %q 2>/dev/null; true", sourcePath) |
Contributor
There was a problem hiding this comment.
Do not parse strings. Return the result in JSON format and unmarshal it into a structure. Then, work with the structure's fields.
| } | ||
|
|
||
| func isBlockDeviceReadOnly(f *framework.Framework, vm *v1alpha2.VirtualMachine, blockDeviceByID string) (bool, error) { | ||
| if strings.HasPrefix(blockDeviceByID, cdRomByIDPrefix) { |
Contributor
There was a problem hiding this comment.
Why is the ReadOnly option not validated during mounting?
Comment on lines
+276
to
+280
| if isMounted, err := mountReadOnly(f, vm, devicePath, mountPoint); err != nil { | ||
| return false, err | ||
| } else if !isMounted { | ||
| return false, nil | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| if isMounted, err := mountReadOnly(f, vm, devicePath, mountPoint); err != nil { | |
| return false, err | |
| } else if !isMounted { | |
| return false, nil | |
| } | |
| isMounted, err := mountReadOnly(f, vm, devicePath, mountPoint) | |
| if err != nil { | |
| return false, err | |
| } | |
| if !isMounted { | |
| return false, nil | |
| } |
|
|
||
| func unmountPath(f *framework.Framework, vm *v1alpha2.VirtualMachine, path string) error { | ||
| cmd := fmt.Sprintf("sudo umount %q >/dev/null 2>&1; sudo rmdir %q >/dev/null 2>&1; true", path, path) | ||
| _, err := f.SSHCommand(vm.Name, vm.Namespace, cmd) |
Contributor
There was a problem hiding this comment.
Also, when an error occurs, STDOUT may contain useful information for debugging. Do not ignore it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrate
VirtualMachineImageHotpluge2e test to the new framework.Checklist
Changelog entries