| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package hosttest |
| 5 |
|
| 6 |
import ( |
| 7 |
"testing" |
| 8 |
|
| 9 |
"github.com/stretchr/testify/assert" |
| 10 |
|
| 11 |
"go.opentelemetry.io/collector/component" |
| 12 |
"go.opentelemetry.io/collector/component/componenttest" |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
type nopExtension struct { |
| 17 |
component.StartFunc |
| 18 |
component.ShutdownFunc |
| 19 |
} |
| 20 |
|
| 21 |
func TestMockHost(t *testing.T) { |
| 22 |
componenttest.NewNopHost() |
| 23 |
ext := map[component.ID]component.Component{ |
| 24 |
component.MustNewID("test"): &nopExtension{}, |
| 25 |
} |
| 26 |
host := NewHost(ext) |
| 27 |
assert.Equal(t, ext, host.GetExtensions()) |
| 28 |
} |