-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
factory_test.go
46 lines (40 loc) · 909 Bytes
/
factory_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
package redisstorageextension
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/extension/extensiontest"
)
func TestFactory(t *testing.T) {
f := NewFactory()
tests := []struct {
name string
config *Config
}{
{
name: "Default",
config: func() *Config {
return &Config{
Endpoint: "localhost:6379",
}
}(),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
e, err := f.Create(
context.Background(),
extensiontest.NewNopSettings(),
test.config,
)
require.NoError(t, err)
require.NotNil(t, e)
ctx := context.Background()
require.NoError(t, e.Start(ctx, componenttest.NewNopHost()))
require.NoError(t, e.Shutdown(ctx))
})
}
}