Files
zeekay df7d6cb470 feat: rebrand signoz-otel-collector → Hanzo OTEL Collector
- 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
2026-03-12 00:21:24 -07:00

67 lines
1.6 KiB
Go

package o11ytailsampler
import (
"path/filepath"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"
"github.com/hanzoai/otel-collector/processor/o11ytailsampler/internal/metadata"
)
func TestLoadConfig(t *testing.T) {
t.Parallel()
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "tail_sampling_config.yaml"))
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, sub.Unmarshal(cfg))
assert.Equal(t,
cfg,
&Config{
// ProcessorSettings: config.NewProcessorSettings(component.NewID(typeStr)),
DecisionWait: 10 * time.Second,
NumTraces: 100,
ExpectedNewTracesPerSec: 10,
PolicyCfgs: []PolicyGroupCfg{
{
BasePolicy: BasePolicy{
Name: "test-policy-1",
Type: PolicyGroup,
Priority: 1,
ProbabilisticCfg: ProbabilisticCfg{
SamplingPercentage: 100,
},
PolicyFilterCfg: PolicyFilterCfg{
StringAttributeCfgs: []StringAttributeCfg{
{Key: "source", Values: []string{"security"}},
},
},
},
SubPolicies: []BasePolicy{
{
Name: "condition-1",
Type: PolicyGroup,
Priority: 1,
PolicyFilterCfg: PolicyFilterCfg{
StringAttributeCfgs: []StringAttributeCfg{
{Key: "source", Values: []string{"security"}},
},
},
},
},
},
},
})
}