test(vm): port VM placement scenarios to new framework#2268
Merged
Conversation
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
hardcoretime
requested changes
Apr 23, 2026
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
50cbdca to
525c788
Compare
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
21c2494 to
5ba5412
Compare
hardcoretime
approved these changes
Apr 24, 2026
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
Port the remaining
VirtualMachineAffinityAndTolerationlegacy scenarios to the new e2e framework undertest/e2e/vm.The PR now covers all placement-related checks from the former legacy suite:
status.nodeNamespec.nodeSelectorbehaviorspec.affinity.nodeAffinitybehaviorThe new tests use the modern framework helpers and object builders, add cluster prerequisite checks for required node topology, and keep migration verification based on fresh
MigrationStatedata and resultingstatus.nodeName.The PR also includes a follow-up fix for the migrated placement scenarios: the selected target node is now preserved across
By(...)steps, so the final assertions validate the actual migration destination instead of an empty outer-scope value.The obsolete legacy file was removed after the remaining scenarios were ported.
Why do we need it, and what problem does it solve?
The old legacy affinity/toleration suite had already been partially migrated, but two placement scenarios still existed only in
test/e2e/legacy/affinity_toleration.go.Keeping the coverage split between legacy and the new framework made the suite harder to maintain and left outdated test infrastructure in place. This PR completes the migration, consolidates the scenarios in the new framework, and removes the leftover legacy implementation.
During validation, a scoping bug was also found in the new placement checks:
targetNodewas shadowed inside a step, which caused the outer variable to remain empty and made the final assertion fail despite successful migration. The fix makes the assertions stable and aligned with the actual migrated node.What is the expected result?
test/e2e/vm/affinity_toleration.go.status.nodeNamein the new framework.spec.nodeSelectorto the current node does not trigger migration.spec.nodeSelectorto another ready worker node triggers migration and updatesstatus.nodeName.spec.affinity.nodeAffinityto the current node does not trigger migration.spec.affinity.nodeAffinityto another ready worker node triggers migration and updatesstatus.nodeName.Additionally, a compile-level validation was executed:
cd test/e2e && go test ./... -run '^$'Checklist
Changelog entries