Skip to content

Conversation

@oikarinen
Copy link
Contributor

Add test coverage for all three bypass_modes (always, pull_request, exempt) for both repository and organization rulesets.

Repository Ruleset Tests (resource_github_repository_ruleset_test.go):

  • Add test for all three bypass_modes with Team actors
  • Add test for updating bypass_mode (always → exempt)
  • Add test for different actor types with different bypass_modes (Team/always, RepositoryRole/pull_request, OrganizationAdmin/exempt)

Organization Ruleset Tests (resource_github_organization_ruleset_test.go):

  • Fix existing "Creates and updates organization using bypasses" test:
    • Move bypass_actors from incorrect location (inside rules) to correct location (at ruleset level)
    • Add missing bypass_mode assertions
    • Fix incorrect actor_type assertions (was checking for "0", "5" instead of actual actor type strings)
    • Correct OrganizationAdmin actor_id from 0 to 1
  • Add test for all three bypass_modes
  • Add test for updating bypass_mode

All tests now verify:

  • actor_id (both dynamic Team IDs and static role IDs)
  • actor_type (Team, RepositoryRole, OrganizationAdmin, DeployKey)
  • bypass_mode (always, pull_request, exempt)

This addresses the review comment from PR #2764 requesting test coverage for bypass_modes, including the newly added "exempt" mode.

Fixes: #2764 (review)

Fixes #2755


Before the change?

  • no coverage for any of the bypass_modes for rulesets

After the change?

  • tests!

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

Add test coverage for all three bypass_modes (always, pull_request,
exempt) for both repository and organization rulesets.

Repository Ruleset Tests (resource_github_repository_ruleset_test.go):
- Add test for all three bypass_modes with Team actors
- Add test for updating bypass_mode (always → exempt)
- Add test for different actor types with different bypass_modes
  (Team/always, RepositoryRole/pull_request, OrganizationAdmin/exempt)

Organization Ruleset Tests (resource_github_organization_ruleset_test.go):
- Fix existing "Creates and updates organization using bypasses" test:
  * Move bypass_actors from incorrect location (inside rules) to correct
    location (at ruleset level)
  * Add missing bypass_mode assertions
  * Fix incorrect actor_type assertions (was checking for "0", "5" instead
    of actual actor type strings)
  * Correct OrganizationAdmin actor_id from 0 to 1
- Add test for all three bypass_modes
- Add test for updating bypass_mode

All tests now verify:
- actor_id (both dynamic Team IDs and static role IDs)
- actor_type (Team, RepositoryRole, OrganizationAdmin, DeployKey)
- bypass_mode (always, pull_request, exempt)

This addresses the review comment from PR integrations#2764 requesting test coverage
for bypass_modes, including the newly added "exempt" mode.

Fixes: integrations#2764 (review)
@nickfloyd nickfloyd moved this to In Review in Terraform Provider Oct 22, 2025
@nickfloyd nickfloyd merged commit 8bd287c into integrations:main Oct 22, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Active Oct 22, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in Terraform Provider Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[FEAT]: github_repository_ruleset - support bypass_mode "exempt"

2 participants