[
https://issues.apache.org/jira/browse/YUNIKORN-2971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Peter Bacsko updated YUNIKORN-2971:
-----------------------------------
Description:
Certain test cases in the shim verify the type of the event recorder:
{noformat}
recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder)
if !ok {
t.Fatal("the EventRecorder is expected to be of type
FakeRecorder")
}
{noformat}
However, this just happens to pass by accident because a previous test modified
it from MockedRecorder to FakeRecorder. Running such a tests on its own fails.
Another potential issue is that tests don't restore the recorder in a deferred
section. Most of the time the restored type is a FakeRecorder which is not
correct.
was:
Certain test cases in the shim verify the type of the event recorder:
{noformat}
recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder)
if !ok {
t.Fatal("the EventRecorder is expected to be of type
FakeRecorder")
}
{noformat}
However, this just happens to pass by accident because a previous test modified
it from MockedRecorder to FakeRecorder. Running such a tests on its own fails.
Also make sure that all tests restore the recorder properly in a deferred code
section.
> Use FakeRecorder and MockedRecorder properly in the tests
> ---------------------------------------------------------
>
> Key: YUNIKORN-2971
> URL: https://issues.apache.org/jira/browse/YUNIKORN-2971
> Project: Apache YuniKorn
> Issue Type: Bug
> Components: shim - kubernetes, test - unit
> Reporter: Peter Bacsko
> Assignee: Peter Bacsko
> Priority: Major
>
> Certain test cases in the shim verify the type of the event recorder:
> {noformat}
> recorder, ok := events.GetRecorder().(*k8sEvents.FakeRecorder)
> if !ok {
> t.Fatal("the EventRecorder is expected to be of type
> FakeRecorder")
> }
> {noformat}
> However, this just happens to pass by accident because a previous test
> modified it from MockedRecorder to FakeRecorder. Running such a tests on its
> own fails.
> Another potential issue is that tests don't restore the recorder in a
> deferred section. Most of the time the restored type is a FakeRecorder which
> is not correct.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]