Skip to content

Commit 5552fd8

Browse files
committed
fix test
Signed-off-by: Daniil Antoshin <[email protected]>
1 parent 55713d1 commit 5552fd8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

images/virtualization-artifact/pkg/audit/events/vm/vm_control_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type vmControlTestArgs struct {
4444
shouldLostVM bool
4545
shouldLostVD bool
4646
shouldLostNode bool
47+
shoulntLog bool
4748
customObjectRef *audit.ObjectReference
4849
customObjectRefNil bool
4950
customContainerStatusMessage string
@@ -237,6 +238,11 @@ var _ = Describe("VMOP Events", func() {
237238
err := eventLog.Fill()
238239
Expect(err).To(BeNil())
239240

241+
if args.shoulntLog {
242+
Expect(eventLog.ShouldLog()).To(BeFalse())
243+
return
244+
}
245+
240246
Expect(eventLog.eventLog.Type).To(Equal("Control VM"))
241247
Expect(eventLog.eventLog.Level).To(Equal(args.expectedLevel))
242248
Expect(eventLog.eventLog.Name).To(Equal(args.expectedName))
@@ -329,17 +335,13 @@ var _ = Describe("VMOP Events", func() {
329335
expectedActionType: "delete",
330336
}),
331337
Entry("VM deleted by node event should filled without errors", vmControlTestArgs{
332-
customEventUser: "system:node",
333-
expectedLevel: "info",
334-
expectedName: "Virtual machine 'test-vm' has been stopped by 'system:node'",
335-
expectedActionType: "delete",
338+
customEventUser: "system:node",
339+
shoulntLog: true,
336340
}),
337341
Entry("VM deleted by controller with unknown termination message event should filled without errors", vmControlTestArgs{
338342
customContainerStatusMessage: "poped",
339343
customEventUser: "system:serviceaccount:d8-virtualization",
340-
expectedLevel: "warn",
341-
expectedName: "Virtual machine 'test-vm' has been stopped by 'system:serviceaccount:d8-virtualization'",
342-
expectedActionType: "delete",
344+
shoulntLog: true,
343345
}),
344346
Entry("VM deleted by user event with losted VM should filled without errors", vmControlTestArgs{
345347
expectedLevel: "critical",

0 commit comments

Comments
 (0)