-
Notifications
You must be signed in to change notification settings - Fork 763
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
Add Overwrite Support For github_repository_file
#459
Conversation
hardCodedRepoName := "test-repo" | ||
return testAccCheckGithubRepositoryFileExistsWithRepo(n, path, branch, hardCodedRepoName, content, commit) | ||
} | ||
|
||
func testAccCheckGithubRepositoryFileExistsWithRepo(n, path, branch, repo string, content *github.RepositoryContent, commit *github.RepositoryCommit) resource.TestCheckFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went down the path of removing references to "test-repo" and leveraging a per-test generated repository instead. Those changes turned out to break tests so I've opted to leave the existing code paths alone and expose testAccCheckGithubRepositoryFileExistsWithRepo
instead. This allows for creating a repository from a template and overwriting its files during the test suite.
github_repository_file
github_repository_file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we expect the behavior of the overwrite
to extend to updates as well? i'm thinking in the event we create a new file (assuming it doesn't already exist in a repo), if we go to update the config and overwrite
is omitted or even explicitly set to false, the file will still get updated in place
|
||
func testAccGithubRepositoryFileOverwriteDisabledConfig(randString string) string { | ||
|
||
owner := os.Getenv("GITHUB_ORGANIZATION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the global testOrganization
could also be used here
Thanks for raising discussion on the update case. I had not given it too much thought. After thinking about this a bit, I recommend we rebrand To further safeguard, we can add the |
q |
Is there any news on when this might be reviewed/merged? |
I like this idea, suits the intended behavior 👍 my only hesitation would be adding the |
546c27c
to
a0a3dcf
Compare
a0a3dcf
to
c9f6353
Compare
the new test format addresses this explicitly instead
> Branch master not found in repository or repository is not readable
Tests are looking good. The GHES ones are failing as the infrastructure is down at the moment. |
Fixes https://github.com/terraform-providers/terraform-provider-github/issues/438
/cc @techdragon @shoekstra @cornfeedhobo