Skip to content

Commit 2f092ae

Browse files
committed
add multiline redactor test
1 parent 56150c3 commit 2f092ae

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

pkg/collect/collector_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,41 @@ another line here`,
202202
want: map[string]string{
203203
"data/datacollectorname": `abc 123
204204
another line here
205+
`,
206+
},
207+
},
208+
{
209+
name: "custom multiline redactor",
210+
Collect: &troubleshootv1beta1.Collect{
211+
Data: &troubleshootv1beta1.Data{
212+
CollectorMeta: troubleshootv1beta1.CollectorMeta{
213+
CollectorName: "datacollectorname",
214+
Exclude: multitype.BoolOrString{},
215+
},
216+
Name: "data",
217+
Data: `xyz123
218+
abc
219+
xyz123
220+
xyz123
221+
abc`,
222+
},
223+
},
224+
Redactors: []*troubleshootv1beta1.Redact{
225+
{
226+
MultiLine: []troubleshootv1beta1.MultiLine{
227+
{
228+
Selector: "abc",
229+
Redactor: "xyz(123)",
230+
},
231+
},
232+
},
233+
},
234+
want: map[string]string{
235+
"data/datacollectorname": `xyz123
236+
abc
237+
123
238+
xyz123
239+
abc
205240
`,
206241
},
207242
},

0 commit comments

Comments
 (0)