-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
factory_windows_test.go
46 lines (37 loc) · 1.08 KB
/
factory_windows_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
//go:build windows
package activedirectorydsreceiver
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/receiver/receivertest"
)
func TestCreateMetrics(t *testing.T) {
t.Run("Nil config gives error", func(t *testing.T) {
recv, err := createMetricsReceiver(
context.Background(),
receivertest.NewNopSettings(),
nil,
&consumertest.MetricsSink{},
)
require.Nil(t, recv)
require.Error(t, err)
require.ErrorIs(t, err, errConfigNotActiveDirectory)
})
t.Run("Metrics receiver is created with default config", func(t *testing.T) {
recv, err := createMetricsReceiver(
context.Background(),
receivertest.NewNopSettings(),
createDefaultConfig(),
&consumertest.MetricsSink{},
)
require.NoError(t, err)
require.NotNil(t, recv)
// The receiver must be able to shutdown cleanly without a Start call.
err = recv.Shutdown(context.Background())
require.NoError(t, err)
})
}