-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactory_test.go
44 lines (37 loc) · 1.07 KB
/
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
package infa_auth
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/extension/extensiontest"
)
func TestCreateDefaultConfig(t *testing.T) {
// prepare and test
expected := &Config{
TimeOut: 7,
ClientSideSsl: true,
ValidationURL: "http://localhost:8080/",
Headerkey: "IDS-AGENT-SESSION-ID",
ClientJksPath: "/mnt/crt/client_cert.jks",
ClientJksPassword: "change_it_1",
CAJksPath: "/mnt/crt/trust_store.jks",
CAJksPassword: "change_it_2",
InsecureSkipVerify: false,
}
// test
cfg := createDefaultConfig()
// verify
assert.Equal(t, expected, cfg)
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
}
func TestCreateExtension(t *testing.T) {
cfg := createDefaultConfig().(*Config)
ext, err := createExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg)
assert.NoError(t, err)
assert.NotNil(t, ext)
}
func TestNewFactory(t *testing.T) {
f := NewFactory()
assert.NotNil(t, f)
}