mock_exporter_test.go 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package k8sclusterreceiver
  4. import (
  5. "context"
  6. "go.opentelemetry.io/collector/component"
  7. "go.opentelemetry.io/collector/consumer/consumertest"
  8. metadata "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata"
  9. )
  10. type MockExporter struct {
  11. }
  12. func (m MockExporter) Start(context.Context, component.Host) error {
  13. return nil
  14. }
  15. func (m MockExporter) Shutdown(context.Context) error {
  16. return nil
  17. }
  18. var _ component.Component = (*mockExporterWithK8sMetadata)(nil)
  19. type mockExporterWithK8sMetadata struct {
  20. *consumertest.MetricsSink
  21. }
  22. func (m mockExporterWithK8sMetadata) Start(context.Context, component.Host) error {
  23. return nil
  24. }
  25. func (m mockExporterWithK8sMetadata) Shutdown(context.Context) error {
  26. return nil
  27. }
  28. func (m mockExporterWithK8sMetadata) ConsumeMetadata([]*metadata.MetadataUpdate) error {
  29. consumeMetadataInvocation()
  30. return nil
  31. }