Skip to content

Commit

Permalink
[Fix] detector's integration tests starting with alphabet 'm' (#3807)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
abmussani authored Dec 20, 2024
1 parent 2b43d34 commit e2af279
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/detectors/mailchimp/mailchimp_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func TestMailchimp_FromChunk(t *testing.T) {
}
got[i].Raw = nil
got[i].AnalysisInfo = nil
got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Mailchimp.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
Expand Down
1 change: 1 addition & 0 deletions pkg/detectors/mailgun/mailgun_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func TestMailgun_FromChunk(t *testing.T) {
}
got[i].Raw = nil
got[i].AnalysisInfo = nil
got[i].ExtraData = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Mailgun.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestMattermostPersonalToken_FromChunk(t *testing.T) {
s: Scanner{},
args: args{
ctx: context.Background(),
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
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
verify: true,
},
want: []detectors.Result{
Expand Down Expand Up @@ -96,6 +96,11 @@ func TestMattermostPersonalToken_FromChunk(t *testing.T) {
t.Fatalf("no raw secret present: \n %+v", got[i])
}
got[i].Raw = nil

if len(got[i].RawV2) == 0 {
t.Fatalf("no RawV2 secret present: \n %+v", got[i])
}
got[i].RawV2 = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("MattermostPersonalToken.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
Expand Down
5 changes: 5 additions & 0 deletions pkg/detectors/mux/mux_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ func TestMux_FromChunk(t *testing.T) {
t.Fatalf("no raw secret present: \n %+v", got[i])
}
got[i].Raw = nil

if len(got[i].RawV2) == 0 {
t.Fatalf("no rawv2 secret present: \n %+v", got[i])
}
got[i].RawV2 = nil
}
if diff := pretty.Compare(got, tt.want); diff != "" {
t.Errorf("Mux.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
Expand Down

0 comments on commit e2af279

Please sign in to comment.