@@ -24,11 +24,13 @@ import (
24
24
"testing"
25
25
"time"
26
26
27
+ "github.com/stretchr/testify/mock"
28
+ "github.com/stretchr/testify/require"
29
+
27
30
"github.com/open-telemetry/opentelemetry-log-collection/entry"
28
31
"github.com/open-telemetry/opentelemetry-log-collection/operator"
32
+ "github.com/open-telemetry/opentelemetry-log-collection/operator/helper"
29
33
"github.com/open-telemetry/opentelemetry-log-collection/testutil"
30
- "github.com/stretchr/testify/mock"
31
- "github.com/stretchr/testify/require"
32
34
)
33
35
34
36
type fakeJournaldCmd struct {}
@@ -113,3 +115,22 @@ func TestInputJournald(t *testing.T) {
113
115
require .FailNow (t , "Timed out waiting for entry to be read" )
114
116
}
115
117
}
118
+
119
+ func TestJournaldInputConfig (t * testing.T ) {
120
+ expect := NewJournaldInputConfig ("my_journald_input" )
121
+ expect .WriteTo = entry .NewRecordField ("to" )
122
+
123
+ input := map [string ]interface {}{
124
+ "id" : "my_journald_input" ,
125
+ "type" : "journald_input" ,
126
+ "start_at" : "end" ,
127
+ "write_to" : "$record.to" ,
128
+ "attributes" : map [string ]interface {}{},
129
+ "resource" : map [string ]interface {}{},
130
+ }
131
+
132
+ var actual JournaldInputConfig
133
+ err := helper .UnmarshalMapstructure (input , & actual )
134
+ require .NoError (t , err )
135
+ require .Equal (t , expect , & actual )
136
+ }
0 commit comments