mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
- Go module: github.com/SigNoz/signoz-otel-collector → github.com/hanzoai/otel-collector - All signoz-prefixed packages → o11y-prefixed - Docker: signoz/* → ghcr.io/hanzoai/otel-collector - ClickHouse exporter → Hanzo Datastore - Env vars: SIGNOZ_* → HANZO_* - Directory renames for all processor/receiver/exporter packages
53 lines
1.7 KiB
Go
53 lines
1.7 KiB
Go
// Code generated by mdatagen. DO NOT EDIT.
|
|
|
|
package healthcheckextension
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/component/componenttest"
|
|
"go.opentelemetry.io/collector/confmap/confmaptest"
|
|
"go.opentelemetry.io/collector/extension/extensiontest"
|
|
)
|
|
|
|
var typ = component.MustNewType("o11y_health_check")
|
|
|
|
func TestComponentFactoryType(t *testing.T) {
|
|
require.Equal(t, typ, NewFactory().Type())
|
|
}
|
|
|
|
func TestComponentConfigStruct(t *testing.T) {
|
|
require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
|
|
}
|
|
|
|
func TestComponentLifecycle(t *testing.T) {
|
|
factory := NewFactory()
|
|
|
|
cm, err := confmaptest.LoadConf("metadata.yaml")
|
|
require.NoError(t, err)
|
|
cfg := factory.CreateDefaultConfig()
|
|
sub, err := cm.Sub("tests::config")
|
|
require.NoError(t, err)
|
|
require.NoError(t, sub.Unmarshal(&cfg))
|
|
t.Run("shutdown", func(t *testing.T) {
|
|
e, err := factory.Create(context.Background(), extensiontest.NewNopSettings(typ), cfg)
|
|
require.NoError(t, err)
|
|
err = e.Shutdown(context.Background())
|
|
require.NoError(t, err)
|
|
})
|
|
t.Run("lifecycle", func(t *testing.T) {
|
|
firstExt, err := factory.Create(context.Background(), extensiontest.NewNopSettings(typ), cfg)
|
|
require.NoError(t, err)
|
|
require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost()))
|
|
require.NoError(t, firstExt.Shutdown(context.Background()))
|
|
|
|
secondExt, err := factory.Create(context.Background(), extensiontest.NewNopSettings(typ), cfg)
|
|
require.NoError(t, err)
|
|
require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost()))
|
|
require.NoError(t, secondExt.Shutdown(context.Background()))
|
|
})
|
|
}
|