From 2f092ae4a183052af37066d9ff701bd74b523d88 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Mon, 27 Apr 2020 20:52:01 -0400 Subject: [PATCH] add multiline redactor test --- pkg/collect/collector_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pkg/collect/collector_test.go b/pkg/collect/collector_test.go index 41660a3f..9142336a 100644 --- a/pkg/collect/collector_test.go +++ b/pkg/collect/collector_test.go @@ -202,6 +202,41 @@ another line here`, want: map[string]string{ "data/datacollectorname": `abc 123 another line here +`, + }, + }, + { + name: "custom multiline redactor", + Collect: &troubleshootv1beta1.Collect{ + Data: &troubleshootv1beta1.Data{ + CollectorMeta: troubleshootv1beta1.CollectorMeta{ + CollectorName: "datacollectorname", + Exclude: multitype.BoolOrString{}, + }, + Name: "data", + Data: `xyz123 +abc +xyz123 +xyz123 +abc`, + }, + }, + Redactors: []*troubleshootv1beta1.Redact{ + { + MultiLine: []troubleshootv1beta1.MultiLine{ + { + Selector: "abc", + Redactor: "xyz(123)", + }, + }, + }, + }, + want: map[string]string{ + "data/datacollectorname": `xyz123 +abc +123 +xyz123 +abc `, }, },