Skip to content

Commit

Permalink
tests,vm: Use const and type inferring
Browse files Browse the repository at this point in the history
This changes variable declarations to use consts and type inferring
where possible.

Signed-off-by: Felix Matouschek <[email protected]>
  • Loading branch information
0xFelix committed Apr 20, 2023
1 parent 78e836e commit 560b62e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var _ = Describe("[rfe_id:1177][crit:medium][vendor:[email protected]][level:com

Context("[Serial]A mutated VirtualMachine given", Serial, func() {

var testingMachineType string = "pc-q35-2.7"
const testingMachineType = "pc-q35-2.7"

BeforeEach(func() {
kv := util.GetCurrentKv(virtClient)
Expand All @@ -150,7 +150,7 @@ var _ = Describe("[rfe_id:1177][crit:medium][vendor:[email protected]][level:com

It("[test_id:3311]should keep the supplied MachineType when created", func() {
By("Creating VirtualMachine")
explicitMachineType := "pc-q35-3.0"
const explicitMachineType = "pc-q35-3.0"
template := libvmi.NewCirros()
template.Spec.Domain.Machine = &v1.Machine{Type: explicitMachineType}
vm := createVM(virtClient, template)
Expand Down Expand Up @@ -206,11 +206,11 @@ var _ = Describe("[rfe_id:1177][crit:medium][vendor:[email protected]][level:com
}

DescribeTable("cpu/memory in requests/limits should allow", func(cpu, request string) {
const oldCpu = "222"
const oldMemory = "2222222"

vm := tests.NewRandomVirtualMachine(libvmi.NewCirros(), false)
vm.Namespace = testsuite.GetTestNamespace(vm)
oldCpu := "222"
oldMemory := "2222222"

vm.APIVersion = "kubevirt.io/" + v1.ApiStorageVersion
vm.Spec.Template.Spec.Domain.Resources.Limits = make(k8sv1.ResourceList)
vm.Spec.Template.Spec.Domain.Resources.Requests[corev1.ResourceCPU] = resource.MustParse(oldCpu)
Expand Down

0 comments on commit 560b62e

Please sign in to comment.