mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-13 20:58:11 +00:00
* Use basecontroller in sdk-go instead for better logging Signed-off-by: Jian Qiu <jqiu@redhat.com> * Rename to fakeSyncContext Signed-off-by: Jian Qiu <jqiu@redhat.com> --------- Signed-off-by: Jian Qiu <jqiu@redhat.com>
29 lines
778 B
Go
29 lines
778 B
Go
package testing
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"k8s.io/client-go/util/workqueue"
|
|
|
|
sdkevents "open-cluster-management.io/sdk-go/pkg/basecontroller/events"
|
|
)
|
|
|
|
type FakeSyncContext struct {
|
|
spokeName string
|
|
recorder sdkevents.Recorder
|
|
queue workqueue.TypedRateLimitingInterface[string]
|
|
}
|
|
|
|
func (f FakeSyncContext) Queue() workqueue.TypedRateLimitingInterface[string] { return f.queue }
|
|
func (f FakeSyncContext) Recorder() sdkevents.Recorder {
|
|
return f.recorder
|
|
}
|
|
|
|
func NewFakeSyncContext(t *testing.T, clusterName string) *FakeSyncContext {
|
|
return &FakeSyncContext{
|
|
spokeName: clusterName,
|
|
recorder: sdkevents.NewContextualLoggingEventRecorder(t.Name()),
|
|
queue: workqueue.NewTypedRateLimitingQueue[string](workqueue.DefaultTypedControllerRateLimiter[string]()),
|
|
}
|
|
}
|