Skip to content

Commit

Permalink
[chore] Fix component test template (#12350)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes `"go.opentelemetry.io/collector/component"` to be always
present to create component type:
```
var typ = component.MustNewType("{{ .Type }}")
```

cc @mx-psi 
<!-- Issue number if applicable -->
#### Link to tracking issue
Relevant to #12305 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
n/a

<!--Describe the documentation added.-->
#### Documentation
n/a

<!--Please delete paragraphs that you did not use before submitting.-->
  • Loading branch information
sincejune authored Feb 11, 2025
1 parent 3d51712 commit f658d9f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cmd/mdatagen/internal/templates/component_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
{{- end }}

"github.com/stretchr/testify/require"
{{- if and (not (and .Tests.SkipLifecycle .Tests.SkipShutdown)) (not isExtension) }}
"go.opentelemetry.io/collector/component"
{{- end }}
"go.opentelemetry.io/collector/component/componenttest"
{{- if not (and .Tests.SkipLifecycle .Tests.SkipShutdown) }}
"go.opentelemetry.io/collector/confmap/confmaptest"
Expand Down Expand Up @@ -133,7 +131,7 @@ func TestComponentLifecycle(t *testing.T) {
switch tt.name {
case "logs":
e, ok := c.(exporter.Logs)
require.True(t, ok)
require.True(t, ok)
logs := generateLifecycleTestLogs()
if !e.Capabilities().MutatesData {
logs.MarkReadOnly()
Expand Down

0 comments on commit f658d9f

Please sign in to comment.