generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 50
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
HCPIE-1244: Improve Identity-Specific Testing #810
Merged
itsjaspermilan
merged 8 commits into
main
from
hcpie-1244-identity-tests-are-easier-to-run
Apr 16, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cbb3682
update docs to highlight running a specific test package
itsjaspermilan 60baf06
Add new action for identity tests
itsjaspermilan 71b9281
changelog
itsjaspermilan eba5163
add env vars to runner
itsjaspermilan 6098040
cleanup formatting
itsjaspermilan 3c67731
add golang-ci back
itsjaspermilan 685223c
remove comment line
itsjaspermilan 8cacf17
Merge branch 'main' into hcpie-1244-identity-tests-are-easier-to-run
itsjaspermilan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
Add GitHub Action to run identity-specific tests | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Run Identity Tests on Identity Code Changes | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'internal/provider/iam/**' | ||
|
||
jobs: | ||
identity_tests: | ||
name: Run identity specific tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
cache: true | ||
go-version-file: 'go.mod' | ||
cache-dependency-path: go.sum | ||
id: go | ||
|
||
- name: Run 'go mod tidy' and check for differences | ||
run: | | ||
make depscheck | ||
|
||
- name: Get dependencies | ||
run: | | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
go mod download | ||
|
||
- name: Build | ||
run: | | ||
go build -v . | ||
|
||
- name: Run identity tests | ||
env: | ||
HCP_API_HOST: ${{ secrets.HCP_API_HOST }} | ||
HCP_AUTH_URL: ${{ secrets.HCP_AUTH_URL }} | ||
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }} | ||
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }} | ||
HCP_ORGANIZATION_ID: ${{ secrets.HCP_ORGANIZATION_ID }} | ||
HCP_PROJECT_ID: ${{ secrets.HCP_PROJECT_ID }} | ||
run: | | ||
make testacc-ci TEST=./internal/provider/iam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is awesome! Can this be extended to all the domains? As in run secrets test when those are changed? I had created ticket for this https://hashicorp.atlassian.net/browse/HCPF-1722
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.
@manish-hashicorp
Yes! It can be extended manually for sure if each team wants to add their own step to this workflow. If we wanted a more autonomous solution, we might have to spend a bit more time on it.
Roughly speaking, we could do the following:
./internal
make testacc-ci TEST=DIRECTORY_NAME
This will be out of scope for this specific ticket since it will require some more testing, but with that being said, I'm happy to update the ticket you posted with my findings. That way, whoever picks it up will have a head start on how to complete the work.
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.
Thanks. Please do add information in that ticket.