Skip to content

Commit

Permalink
Ignore warning about fake runtime class not being found
Browse files Browse the repository at this point in the history
Add a RunVMIAndExpectSchedulingWithWarningPolicy() function
which can get a custom warning policy. This way the test can
ignore warning related to runtime class not being found. This
is completely fine since this runtime class is fake.

Without this, we might encounter the following warning:
RuntimeClass "custom-runtime-class" not found

Signed-off-by: Itamar Holder <[email protected]>
  • Loading branch information
iholder101 committed Oct 19, 2022
1 parent 261c4e7 commit 62b67ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,13 @@ func RunVMIAndExpectLaunchIgnoreWarnings(vmi *v1.VirtualMachineInstance, timeout
}

func RunVMIAndExpectScheduling(vmi *v1.VirtualMachineInstance, timeout int) *v1.VirtualMachineInstance {
wp := watcher.WarningsPolicy{FailOnWarnings: true}
return RunVMIAndExpectSchedulingWithWarningPolicy(vmi, timeout, wp)
}

func RunVMIAndExpectSchedulingWithWarningPolicy(vmi *v1.VirtualMachineInstance, timeout int, wp watcher.WarningsPolicy) *v1.VirtualMachineInstance {
obj := RunVMI(vmi, timeout)
By("Waiting until the VirtualMachineInstance will be scheduled")
wp := watcher.WarningsPolicy{FailOnWarnings: true}
return waitForVMIScheduling(obj, timeout, wp)
}

Expand Down
5 changes: 3 additions & 2 deletions tests/vmi_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1692,8 +1692,9 @@ var _ = Describe("[sig-compute]Configurations", func() {

By("Creating a new VMI")
var vmi = tests.NewRandomVMI()
vmi = tests.RunVMIAndExpectScheduling(vmi, 30)
Expect(err).NotTo(HaveOccurred())
// Runtime class related warnings are expected since we created a fake runtime class that isn't supported
wp := watcher.WarningsPolicy{FailOnWarnings: true, WarningsIgnoreList: []string{"RuntimeClass"}}
vmi = tests.RunVMIAndExpectSchedulingWithWarningPolicy(vmi, 30, wp)

By("Checking for presence of runtimeClassName")
pod := tests.GetPodByVirtualMachineInstance(vmi)
Expand Down

0 comments on commit 62b67ea

Please sign in to comment.