Skip to content

test: Add secret scanning marshal tests#4252

Merged
gmlewis merged 1 commit into
google:masterfrom
KirtiRamchandani:test/secret-scanning-marshal
May 26, 2026
Merged

test: Add secret scanning marshal tests#4252
gmlewis merged 1 commit into
google:masterfrom
KirtiRamchandani:test/secret-scanning-marshal

Conversation

@KirtiRamchandani
Copy link
Copy Markdown
Contributor

Problem

  • Issue add tests for resource JSON marshalling #55 tracks missing JSON marshal test coverage for exported structs.
  • The secret scanning push protection and scan history structs had service tests, but lacked direct testJSONMarshal round-trip coverage.

Root cause

  • These models were added without matching marshal/unmarshal tests for their JSON field names, required zero values, timestamps, and embedded scan fields.

Solution

  • Add JSON marshal/unmarshal round-trip tests for PushProtectionBypassRequest, PushProtectionBypass, SecretsScan, CustomPatternBackfillScan, and SecretScanningScanHistory.
  • Cover required zero-value fields, nullable expiration timestamps, embedded scan fields, and all scan history buckets.

Tests run

  • gofmt -w github/secret_scanning_test.go
  • go test ./github -run 'Test(PushProtectionBypass(Request)?|SecretsScan|CustomPatternBackfillScan|SecretScanningScanHistory)_Marshal'
  • go test ./github
  • go test ./...
  • git diff --check

Updates #55

@gmlewis gmlewis changed the title Add secret scanning marshal tests chore: Add secret scanning marshal tests May 26, 2026
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label May 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (c207b27) to head (51971d9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4252   +/-   ##
=======================================
  Coverage   97.48%   97.48%           
=======================================
  Files         190      190           
  Lines       19178    19178           
=======================================
  Hits        18695    18695           
  Misses        268      268           
  Partials      215      215           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @KirtiRamchandani!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode

Copy link
Copy Markdown
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented May 26, 2026

Thank you, @Not-Dhananjay-Mishra!
Merging.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label May 26, 2026
@gmlewis gmlewis changed the title chore: Add secret scanning marshal tests test: Add secret scanning marshal tests May 26, 2026
@gmlewis gmlewis merged commit 7cafc9a into google:master May 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants