@@ -123,6 +123,7 @@ func (m *multiVariantSource) TypedName() fwkplugin.TypedName
123123func (m * multiVariantSource ) GVK () schema.GroupVersionKind { return m .gvk }
124124func (m * multiVariantSource ) Dispatch (_ context.Context , _ fwkdl.Endpoint ) error { return nil }
125125func (m * multiVariantSource ) AppendExtractor (_ fwkplugin.Plugin ) error { return nil }
126+ func (m * multiVariantSource ) Interval () time.Duration { return 0 }
126127func (m * multiVariantSource ) Notify (_ context.Context , event fwkdl.NotificationEvent ) (* fwkdl.NotificationEvent , error ) {
127128 // Body never runs in this test. Configure rejects the source for
128129 // implementing multiple variants before any Notify call. Echo the
@@ -148,14 +149,21 @@ func TestRuntimeConfigure_SourceImplementingMultipleVariants_Rejected(t *testing
148149 assert .Contains (t , err .Error (), "multiple variant" )
149150}
150151
152+ // intervalMockSource wraps MetricsDataSource with a configurable Interval.
153+ type intervalMockSource struct {
154+ mocks.MetricsDataSource
155+ interval time.Duration
156+ }
157+
158+ func (s * intervalMockSource ) Interval () time.Duration { return s .interval }
159+
151160func TestRuntimeConfigure_InvalidSourceInterval (t * testing.T ) {
152161 logger := newTestLogger (t )
153162 r := NewRuntime (50 * time .Millisecond )
154163
155164 cfg := & Config {
156165 Sources : []DataSourceConfig {{
157- Plugin : & mocks.MetricsDataSource {},
158- Interval : 75 * time .Millisecond ,
166+ Plugin : & intervalMockSource {interval : 75 * time .Millisecond },
159167 }},
160168 }
161169
@@ -170,8 +178,7 @@ func TestRuntimeConfigure_SourceIntervalStoredAsPeriodTicks(t *testing.T) {
170178
171179 cfg := & Config {
172180 Sources : []DataSourceConfig {{
173- Plugin : & mocks.MetricsDataSource {},
174- Interval : time .Second ,
181+ Plugin : & intervalMockSource {interval : time .Second },
175182 }},
176183 }
177184
0 commit comments