Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate detector tests into unit/integration #3274

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

rgmz
Copy link
Contributor

@rgmz rgmz commented Sep 8, 2024

Description:

Unlike integration tests, the detector's unit tests should always run. This helps catch bugs early; there is no upside and tremendous downside to keeping them together.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@rgmz rgmz force-pushed the test/separate branch 2 times, most recently from 5921f6a to 9496ef7 Compare September 13, 2024 11:39
@zricethezav
Copy link
Collaborator

@rgmz I think this is a worthwhile change. Is there a reason only a subset of the detectors are included in this PR?

@rgmz
Copy link
Contributor Author

rgmz commented Sep 24, 2024

Those are the only ones that have unit tests AFAIK.

@rgmz
Copy link
Contributor Author

rgmz commented Sep 24, 2024

I'm confused by the lint error: https://github.com/trufflesecurity/trufflehog/actions/runs/10848445504/job/30590845421?pr=3274

That variable appears to have never been used. I guess it didn't get flagged due to the build flag? Should be fixed now.

@rgmz rgmz force-pushed the test/separate branch 2 times, most recently from f602d05 to d56d4ac Compare September 25, 2024 15:39
@rgmz rgmz mentioned this pull request Oct 1, 2024
2 tasks
@kashifkhan0771
Copy link
Contributor

Thanks @rgmz for this.
LGTM! It will be really cool once we have pattern test cases for all the existing detectors. I will also be working on this whenever I get a chance.

@zricethezav
Copy link
Collaborator

Looks good to me, we should update the contributing docs too. That can be in a followup PR

@zricethezav zricethezav merged commit 05015b3 into trufflesecurity:main Oct 10, 2024
13 checks passed
abmussani added a commit to abmussani/trufflehog that referenced this pull request Oct 14, 2024
* main: (127 commits)
  Update SaladCloud description (trufflesecurity#3399)
  fix tests (trufflesecurity#3400)
  [chore] Update custom detector default description (trufflesecurity#3398)
  add description to salad (trufflesecurity#3397)
  Add detector for SaladCloud API Keys (trufflesecurity#3273)
  fix(deps): update module github.com/xanzy/go-gitlab to v0.111.0 (trufflesecurity#3393)
  Add SliceContainsString common util (trufflesecurity#3395)
  fix: pr template link to golangci-lint (trufflesecurity#3392)
  fix(deps): update golang.org/x/exp digest to f66d83c (trufflesecurity#3389)
  Separate detector tests into unit/integration (trufflesecurity#3274)
  Manually upgrade github dep (trufflesecurity#3387)
  Updated Fastly Personal Token Detector (trufflesecurity#3386)
  fix(deps): update module google.golang.org/api to v0.200.0 (trufflesecurity#3391)
  [Fix] Snowflake privatelink Support (trufflesecurity#3286)
  Enhanced the easyinsight detector (trufflesecurity#3384)
  Log skipped files on debug level (trufflesecurity#3383)
  build: update retracted bluemonday ver (trufflesecurity#3369)
  Fix git binary handling and add a smoke test (trufflesecurity#3379)
  fix(deps): update module google.golang.org/protobuf to v1.35.1 (trufflesecurity#3382)
  Added Cisco Meraki API Key detector (trufflesecurity#3367)
  ...

# Conflicts:
#	pkg/engine/defaults.go
#	pkg/pb/detectorspb/detectors.pb.go
#	proto/detectors.proto
@rgmz rgmz deleted the test/separate branch December 8, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants