| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package componenttest // import "go.opentelemetry.io/collector/component/componenttest" |
| 5 |
|
| 6 |
import ( |
| 7 |
"go.opentelemetry.io/collector/component" |
| 8 |
) |
| 9 |
|
| 10 |
var _ component.Host = (*nopHost)(nil) |
| 11 |
|
| 12 |
// nopHost mocks a [component.Host] for testing purposes. |
| 13 |
type nopHost struct{} |
| 14 |
|
| 15 |
// NewNopHost returns a [component.Host] that returns empty values |
| 16 |
// from method calls. This host is intended to be used in tests |
| 17 |
// where a bare-minimum host is desired. |
| 18 |
func NewNopHost() component.Host { |
| 19 |
return &nopHost{} |
| 20 |
} |
| 21 |
|
| 22 |
// GetExtensions returns an empty extensions map. |
| 23 |
func (nh *nopHost) GetExtensions() map[component.ID]component.Component { |
| 24 |
return map[component.ID]component.Component{} |
| 25 |
} |