Skip to content

Commit

Permalink
Merge pull request kubevirt#13794 from dasionov/clean_duplicate_vmi_i…
Browse files Browse the repository at this point in the history
…nitialization

tests/infra/prometheus: use option slice for cleaner VMI initialization
  • Loading branch information
kubevirt-bot authored Jan 29, 2025
2 parents 8293a65 + b08abc5 commit 668570a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/infrastructure/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,16 @@ var _ = DescribeSerialInfra("[rfe_id:3187][crit:medium][vendor:[email protected]
// but if the default disk is not vda, the test will break
// TODO: introspect the VMI and get the device name of this
// block device?
vmi := libvmifact.NewAlpine(libvmi.WithEmptyDisk("testdisk", v1.VirtIO, resource.MustParse("1G")))
options := []libvmi.Option{
libvmi.WithEmptyDisk("testdisk", v1.VirtIO, resource.MustParse("1G")),
}

if preferredNodeName != "" {
vmi = libvmifact.NewAlpine(libvmi.WithEmptyDisk("testdisk", v1.VirtIO, resource.MustParse("1G")),
libvmi.WithNodeSelectorFor(preferredNodeName))
options = append(options, libvmi.WithNodeSelectorFor(preferredNodeName))
}

vmi := libvmifact.NewAlpine(options...)

const vmiStartTimeout = 30

vmi = libvmops.RunVMIAndExpectLaunch(vmi, vmiStartTimeout)
Expand Down

0 comments on commit 668570a

Please sign in to comment.