Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm spec will use the preference requirements in vm creation test #287

Merged
merged 1 commit into from
Nov 26, 2024
Merged
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
15 changes: 15 additions & 0 deletions tests/functests/instancetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@ var _ = Describe("Common instance types func tests", func() {
})

It("[test_id:10737] can be created when enough resources are provided", func() {
for _, preference := range getClusterPreferences(virtClient) {
instanceTypeName := "it-for-" + preference.Name
createInstancetype(int(preference.Spec.Requirements.CPU.Guest), instanceTypeName, preference.Spec.Requirements.Memory.Guest.String())
RoniKishner marked this conversation as resolved.
Show resolved Hide resolved
instanceTypeMatcher := v1.InstancetypeMatcher{
Name: instanceTypeName,
Kind: "VirtualMachineInstancetype",
}

vm = randomVM(&instanceTypeMatcher, &v1.PreferenceMatcher{Name: preference.Name}, v1.RunStrategyHalted)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm, metav1.CreateOptions{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use DryRunAll in CreateOptions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be better as a follow up given the current tests don't use that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RoniKishner Can you create an issue/PR for it?

Expect(err).ToNot(HaveOccurred())
}
})

It("[test_id:TODO] verifies all preferences have at least one compatible instance type", func() {
preferenceInstancetypeMap := map[string]string{
"centos.stream9.dpdk": "u1.2xlarge",
"rhel.8.dpdk": "u1.2xlarge",
Expand Down