Skip to content

Allow to get only protected on non protected branch with github_repository_branches - #1296

Merged
kfcampbell merged 4 commits into
integrations:mainfrom
bpaquet:protec
Sep 23, 2022
Merged

kfcampbell merged 4 commits into
integrations:mainfrom
bpaquet:protec

Conversation

@bpaquet

@bpaquet bpaquet commented Sep 20, 2022

Copy link
Copy Markdown
Contributor

Remove leftover dead code and doc after #1117
Reintroduce the feature from #1162 with integration tests

…itory_branches

Remove leftover code and doc after integrations#1117
Reintroduce the feature from integrations#1162 with integration tests
@bpaquet

bpaquet commented Sep 20, 2022

Copy link
Copy Markdown
Contributor Author

@kfcampbell The feature I added in #1162 was lost :(

@kfcampbell kfcampbell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for catching this and following up! I had a couple quick questions, and I'm hoping we can get this into a release soon.

})

t.Run("with an individual account", func(t *testing.T) {
testCase(t, individual)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test is failing for me for an individual account but passing for an organization account. Is it succeeding for you when running locally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Locally it only run with an organization account. And is ok

$ TF_ACC=1 go test -v   ./... -run ^TestAccGithubRepositoryBranchesDataSource
?   	github.com/integrations/terraform-provider-github/v5	[no test files]
=== RUN   TestAccGithubRepositoryBranchesDataSource
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_anonymous_account
    data_source_github_repository_branches_test.go:46: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_individual_account
    provider_utils.go:56: GITHUB_TOKEN and GITHUB_OWNER environment variables should be set
    provider_utils.go:66: Skipping TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_individual_account which requires individual mode
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_organization_account
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_anonymous_account
    data_source_github_repository_branches_test.go:125: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_individual_account
    provider_utils.go:56: GITHUB_TOKEN and GITHUB_OWNER environment variables should be set
    provider_utils.go:66: Skipping TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_individual_account which requires individual mode
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_organization_account
--- PASS: TestAccGithubRepositoryBranchesDataSource (28.78s)
    --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository (7.96s)
        --- SKIP: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_individual_account (0.00s)
        --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_organization_account (7.96s)
    --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering (20.82s)
        --- SKIP: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_anonymous_account (0.00s)
        --- SKIP: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_individual_account (0.00s)
        --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_organization_account (20.82s)
PASS
ok  	github.com/integrations/terraform-provider-github/v5/github	29.454s

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Individal test is ok too:

$ TF_ACC=1 go test -v   ./... -run ^TestAccGithubRepositoryBranchesDataSource
?   	github.com/integrations/terraform-provider-github/v5	[no test files]
=== RUN   TestAccGithubRepositoryBranchesDataSource
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_anonymous_account
    data_source_github_repository_branches_test.go:46: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_individual_account
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_organization_account
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_anonymous_account
    data_source_github_repository_branches_test.go:125: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_individual_account
=== RUN   TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_organization_account
--- PASS: TestAccGithubRepositoryBranchesDataSource (55.48s)
    --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository (15.47s)
        --- SKIP: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_individual_account (7.76s)
        --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository/with_an_organization_account (7.71s)
    --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering (40.01s)
        --- SKIP: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_individual_account (19.50s)
        --- PASS: TestAccGithubRepositoryBranchesDataSource/manages_branches_of_a_new_repository_with_filtering/with_an_organization_account (20.51s)
PASS
ok  	github.com/integrations/terraform-provider-github/v5/github	56.002s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Weird...I'm getting errors when I run both (organization and individual) at the same time, but both tests are passing individually.

@kfcampbell kfcampbell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for following up!

@kfcampbell
kfcampbell merged commit 6773d80 into integrations:main Sep 23, 2022
kazaker pushed a commit to auto1-oss/terraform-provider-github that referenced this pull request Dec 28, 2022
…itory_branches (integrations#1296)

* Allow to get only protected on non protected branch with github_repository_branches

Remove leftover code and doc after integrations#1117
Reintroduce the feature from integrations#1162 with integration tests

* Add ConflicsWith

* Implement pagination

Co-authored-by: Keegan Campbell <[email protected]>
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
…itory_branches (integrations#1296)

* Allow to get only protected on non protected branch with github_repository_branches

Remove leftover code and doc after integrations#1117
Reintroduce the feature from integrations#1162 with integration tests

* Add ConflicsWith

* Implement pagination

Co-authored-by: Keegan Campbell <[email protected]>
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.

2 participants