Skip to content

Commit e2af279

Browse files
authored
[Fix] detector's integration tests starting with alphabet 'm' (#3807)
* ignore extraData and analysisInfo in mailchimp integration test. * Ignore ExtraData in Mailchimp and Mailgun integration test. * Exclude RawV2 values from integration test of mux detector. * Exclude RawV2 values from integration test of mux detector.
1 parent 2b43d34 commit e2af279

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

pkg/detectors/mailchimp/mailchimp_integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func TestMailchimp_FromChunk(t *testing.T) {
9494
}
9595
got[i].Raw = nil
9696
got[i].AnalysisInfo = nil
97+
got[i].ExtraData = nil
9798
}
9899
if diff := pretty.Compare(got, tt.want); diff != "" {
99100
t.Errorf("Mailchimp.FromData() %s diff: (-got +want)\n%s", tt.name, diff)

pkg/detectors/mailgun/mailgun_integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func TestMailgun_FromChunk(t *testing.T) {
130130
}
131131
got[i].Raw = nil
132132
got[i].AnalysisInfo = nil
133+
got[i].ExtraData = nil
133134
}
134135
if diff := pretty.Compare(got, tt.want); diff != "" {
135136
t.Errorf("Mailgun.FromData() %s diff: (-got +want)\n%s", tt.name, diff)

pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken_integration_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestMattermostPersonalToken_FromChunk(t *testing.T) {
6060
s: Scanner{},
6161
args: args{
6262
ctx: context.Background(),
63-
data: []byte(fmt.Sprintf("You can find a mattermost secret %s within mattermost server %s but not valid", inactiveSecret, "test323561.cloud.mattermost.com")), // the secret would satisfy the regex but not pass validation
63+
data: []byte(fmt.Sprintf("You can find a mattermost secret %s within mattermost server %s but not valid", inactiveSecret, server)), // the secret would satisfy the regex but not pass validation
6464
verify: true,
6565
},
6666
want: []detectors.Result{
@@ -96,6 +96,11 @@ func TestMattermostPersonalToken_FromChunk(t *testing.T) {
9696
t.Fatalf("no raw secret present: \n %+v", got[i])
9797
}
9898
got[i].Raw = nil
99+
100+
if len(got[i].RawV2) == 0 {
101+
t.Fatalf("no RawV2 secret present: \n %+v", got[i])
102+
}
103+
got[i].RawV2 = nil
99104
}
100105
if diff := pretty.Compare(got, tt.want); diff != "" {
101106
t.Errorf("MattermostPersonalToken.FromData() %s diff: (-got +want)\n%s", tt.name, diff)

pkg/detectors/mux/mux_integration_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ func TestMux_FromChunk(t *testing.T) {
9797
t.Fatalf("no raw secret present: \n %+v", got[i])
9898
}
9999
got[i].Raw = nil
100+
101+
if len(got[i].RawV2) == 0 {
102+
t.Fatalf("no rawv2 secret present: \n %+v", got[i])
103+
}
104+
got[i].RawV2 = nil
100105
}
101106
if diff := pretty.Compare(got, tt.want); diff != "" {
102107
t.Errorf("Mux.FromData() %s diff: (-got +want)\n%s", tt.name, diff)

0 commit comments

Comments
 (0)