diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go index f8a3f2c6643..23395af0a9d 100644 --- a/cmd/builder/internal/builder/main_test.go +++ b/cmd/builder/internal/builder/main_test.go @@ -105,37 +105,6 @@ func TestVersioning(t *testing.T) { }, expectedErr: nil, }, - { - description: "invalid collector version", - cfgBuilder: func() Config { - cfg := NewDefaultConfig() - cfg.Distribution.OtelColVersion = "invalid" - return cfg - }, - expectedErr: ErrVersionMismatch, - }, - { - description: "invalid collector version without strict mode, only generate", - cfgBuilder: func() Config { - cfg := NewDefaultConfig() - cfg.Distribution.OtelColVersion = "invalid" - cfg.SkipGetModules = true - cfg.SkipCompilation = true - cfg.SkipStrictVersioning = true - return cfg - }, - expectedErr: nil, - }, - { - description: "invalid collector version without strict mode", - cfgBuilder: func() Config { - cfg := NewDefaultConfig() - cfg.Distribution.OtelColVersion = "invalid" - cfg.SkipStrictVersioning = true - return cfg - }, - expectedErr: errGoGetFailed, - }, { description: "old component version", cfgBuilder: func() Config { @@ -143,13 +112,12 @@ func TestVersioning(t *testing.T) { cfg.Distribution.Go = "go" cfg.Exporters = []Module{ { - Import: "go.opentelemetry.io/collector/receiver/otlpreceiver", - GoMod: "go.opentelemetry.io/collector v0.96.0", + GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.96.0", }, } return cfg }, - expectedErr: ErrVersionMismatch, + expectedErr: nil, }, { description: "old component version without strict mode", @@ -159,33 +127,20 @@ func TestVersioning(t *testing.T) { cfg.SkipStrictVersioning = true cfg.Exporters = []Module{ { - Import: "go.opentelemetry.io/collector/receiver/otlpreceiver", - GoMod: "go.opentelemetry.io/collector v0.96.0", - }, - } - return cfg - }, - expectedErr: errCompileFailed, - }, - { - description: "invalid component version", - cfgBuilder: func() Config { - cfg := NewDefaultConfig() - cfg.Distribution.Go = "go" - cfg.Exporters = []Module{ - { - Import: "go.opentelemetry.io/collector/receiver/otlpreceiver", - GoMod: "go.opentelemetry.io/collector invalid", + GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.96.0", }, } return cfg }, - expectedErr: errGoGetFailed, + expectedErr: nil, }, } for _, tc := range tests { t.Run(tc.description, func(t *testing.T) { cfg := tc.cfgBuilder() + require.NoError(t, cfg.SetRequireOtelColModule()) + require.NoError(t, cfg.Validate()) + require.NoError(t, cfg.ParseModules()) err := GenerateAndCompile(cfg) require.ErrorIs(t, err, tc.expectedErr) })