github.com/kubewharf/katalyst-core@v0.5.3/pkg/agent/resourcemanager/reporter/reporter_stub.go (about) 1 /* 2 Copyright 2022 The Katalyst Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package reporter 18 19 import ( 20 "context" 21 22 "github.com/kubewharf/katalyst-api/pkg/protocol/reporterplugin/v1alpha1" 23 ) 24 25 type Stub struct { 26 fields []*v1alpha1.ReportField 27 } 28 29 func NewReporterStub() *Stub { 30 return &Stub{} 31 } 32 33 func (s *Stub) Update(ctx context.Context, fields []*v1alpha1.ReportField) error { 34 s.fields = fields 35 return nil 36 } 37 38 func (s *Stub) Run(ctx context.Context) {} 39 40 // GetReportedFields get current fields just for test 41 func (s *Stub) GetReportedFields() []*v1alpha1.ReportField { 42 return s.fields 43 }