| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package migration |
| 5 |
|
| 6 |
import ( |
| 7 |
"path/filepath" |
| 8 |
"testing" |
| 9 |
|
| 10 |
"github.com/stretchr/testify/require" |
| 11 |
|
| 12 |
"go.opentelemetry.io/collector/confmap/confmaptest" |
| 13 |
) |
| 14 |
|
| 15 |
func TestUnmarshalLogsConfigV030(t *testing.T) { |
| 16 |
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.3.0_logs.yaml")) |
| 17 |
require.NoError(t, err) |
| 18 |
|
| 19 |
cfg := LogsConfigV030{} |
| 20 |
require.NoError(t, cm.Unmarshal(&cfg)) |
| 21 |
require.Len(t, cfg.Processors, 3) |
| 22 |
|
| 23 |
require.Equal(t, "https://127.0.0.1:4317", *cfg.Processors[0].Batch.Exporter.OTLP.Endpoint) |
| 24 |
|
| 25 |
require.Equal(t, "http://127.0.0.1:4317", *cfg.Processors[2].Simple.Exporter.OTLP.Endpoint) |
| 26 |
} |
| 27 |
|
| 28 |
func TestUnmarshalTracesConfigV030(t *testing.T) { |
| 29 |
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.3.0_traces.yaml")) |
| 30 |
require.NoError(t, err) |
| 31 |
|
| 32 |
cfg := TracesConfigV030{} |
| 33 |
require.NoError(t, cm.Unmarshal(&cfg)) |
| 34 |
require.Len(t, cfg.Processors, 3) |
| 35 |
|
| 36 |
require.Equal(t, "https://127.0.0.1:4317", *cfg.Processors[0].Batch.Exporter.OTLP.Endpoint) |
| 37 |
|
| 38 |
require.Equal(t, "http://127.0.0.1:4317", *cfg.Processors[2].Simple.Exporter.OTLP.Endpoint) |
| 39 |
} |
| 40 |
|
| 41 |
func TestUnmarshalMetricsConfigV030(t *testing.T) { |
| 42 |
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "v0.3.0_metrics.yaml")) |
| 43 |
require.NoError(t, err) |
| 44 |
|
| 45 |
cfg := MetricsConfigV030{} |
| 46 |
require.NoError(t, cm.Unmarshal(&cfg)) |
| 47 |
require.Len(t, cfg.Readers, 2) |
| 48 |
|
| 49 |
|
| 50 |
require.Equal(t, "https://127.0.0.1:4317", *cfg.Readers[0].Periodic.Exporter.OTLP.Endpoint) |
| 51 |
} |