fix(test): unbreak scale_handler_test build after events recorder migration#7808
Conversation
…ration kedacore#7755 added TestGetScaledObjectStateRecordsResourceScalerActiveMetric and TestGetScaledObjectStateSkipsResourceScalerActiveMetricWithModifiers using record.NewFakeRecorder. In the meantime kedacore#7781 migrated this file to the events recorder and dropped the k8s.io/client-go/tools/record import, so the merged result fails to compile with "undefined: record", breaking the unit-test build and Static Checks on main. Use events.NewFakeRecorder, matching the rest of the file and the events.EventRecorder type of the Recorder/recorder fields. Signed-off-by: Jan Wozniak <[email protected]>
|
Thank you for your contribution! 🙏 Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected. While you are waiting, make sure to:
Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient. Learn more about our contribution guide. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR fixes unit test compilation after the repository’s migration from k8s.io/client-go/tools/record to the newer k8s.io/client-go/tools/events recorder API by updating newly added tests to use the correct fake recorder type.
Changes:
- Replace
record.NewFakeRecorderwithevents.NewFakeRecorderin two scale handler tests to match the file’s existing imports and theevents.EventRecorder-typed fields.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ration (kedacore#7808) kedacore#7755 added TestGetScaledObjectStateRecordsResourceScalerActiveMetric and TestGetScaledObjectStateSkipsResourceScalerActiveMetricWithModifiers using record.NewFakeRecorder. In the meantime kedacore#7781 migrated this file to the events recorder and dropped the k8s.io/client-go/tools/record import, so the merged result fails to compile with "undefined: record", breaking the unit-test build and Static Checks on main. Use events.NewFakeRecorder, matching the rest of the file and the events.EventRecorder type of the Recorder/recorder fields. Signed-off-by: Jan Wozniak <[email protected]> Signed-off-by: Yurii Shcherbak <[email protected]>
#7755 added two tests
TestGetScaledObjectStateRecordsResourceScalerActiveMetricTestGetScaledObjectStateSkipsResourceScalerActiveMetricWithModifiersBoth using
record.NewFakeRecorder. In the meantime #7781 migrated this file to the events recorder and dropped thek8s.io/client-go/tools/recordimport, so the merged result fails to compile with"undefined: record", breaking the unit-test build and Static Checks on main.