Skip to content

Commit

Permalink
virt-api, Arm64: add test cases for ValidateVirtualMachineInstanceArm…
Browse files Browse the repository at this point in the history
…64Setting

Signed-off-by: howard zhang <[email protected]>
  • Loading branch information
zhlhahaha committed Jan 12, 2023
1 parent 5d259f3 commit 0b00e83
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3684,6 +3684,34 @@ var _ = Describe("Validating VMICreate Admitter", func() {
Expect(causes[0].Field).To(Equal("fake.domain.cpu.model"))
Expect(causes[0].Message).To(Equal("Arm64 not support CPU host-model"))
})

It("should reject setting watchdog device", func() {
vmi := api.NewMinimalVMI("testvmi")
vmi.Spec.Domain.Devices.Watchdog = &v1.Watchdog{
Name: "mywatchdog",
WatchdogDevice: v1.WatchdogDevice{
I6300ESB: &v1.I6300ESBWatchdog{
Action: v1.WatchdogActionPoweroff,
},
},
}
causes := webhooks.ValidateVirtualMachineInstanceArm64Setting(k8sfield.NewPath("fake"), &vmi.Spec)
Expect(causes).To(HaveLen(1))
Expect(causes[0].Field).To(Equal("fake.domain.devices.watchdog"))
Expect(causes[0].Message).To(Equal("Arm64 not support Watchdog device"))
})

It("should reject setting sound device", func() {
vmi := api.NewMinimalVMI("testvmi")
vmi.Spec.Domain.Devices.Sound = &v1.SoundDevice{
Name: "test-audio-device",
Model: "ich9",
}
causes := webhooks.ValidateVirtualMachineInstanceArm64Setting(k8sfield.NewPath("fake"), &vmi.Spec)
Expect(causes).To(HaveLen(1))
Expect(causes[0].Field).To(Equal("fake.domain.devices.sound"))
Expect(causes[0].Message).To(Equal("Arm64 not support sound device"))
})
})

Context("with realtime", func() {
Expand Down

0 comments on commit 0b00e83

Please sign in to comment.