Files
telemetry/service/internal/testcomponents/example_processor_test.go
Matthieu MORELandGitHub 37f783308e [chore]: enable require-error rule from testifylint (#11199)
#### Description

Testifylint is a linter that provides best practices with the use of
testify.

This PR enables
[require-error](https://github.com/Antonboom/testifylint?tab=readme-ov-file#require-error)
rule from [testifylint](https://github.com/Antonboom/testifylint)

Signed-off-by: Matthieu MOREL <[email protected]>
2024-09-18 15:02:22 -07:00

27 lines
623 B
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package testcomponents
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
)
func TestExampleProcessor(t *testing.T) {
prc := &ExampleProcessor{}
host := componenttest.NewNopHost()
assert.False(t, prc.Started())
require.NoError(t, prc.Start(context.Background(), host))
assert.True(t, prc.Started())
assert.False(t, prc.Stopped())
require.NoError(t, prc.Shutdown(context.Background()))
assert.True(t, prc.Stopped())
}