Skip to content
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

[DPC-4427] Fetch bearer token for load testing #2356

Merged
merged 21 commits into from
Dec 17, 2024
Merged

Conversation

chris-ronning-ny
Copy link
Contributor

@chris-ronning-ny chris-ronning-ny commented Dec 16, 2024

🎫 Ticket

https://jira.cms.gov/browse/DPC-4427

🛠 Changes

  • Adds environment variables necessary to generate a JWT for authentication with DPC API.
  • Fetches a bearer token for DPC API.
  • Adds documentation.

ℹ️ Context

In order to enable load testing the DPC API, we need an organization in the test environment that can authenticate. This PR validates that this new organization is functional; it relies on the organization's client token, public key ID, and RSA private key, which are stored in secrets, and accessed by the GitHub Actions workflow in question.

🧪 Validation

@chris-ronning-ny chris-ronning-ny changed the title [DPC-4427] WIP fetch bearer token for load testing [DPC-4427] Fetch bearer token for load testing Dec 17, 2024
@chris-ronning-ny chris-ronning-ny requested a review from a team December 17, 2024 16:03
@chris-ronning-ny chris-ronning-ny marked this pull request as ready for review December 17, 2024 16:04
dpc-load-testing/README.md Outdated Show resolved Hide resolved
Makefile Outdated
@@ -112,7 +112,7 @@ start-portals: start-db start-web start-admin start-portal

start-load-tests: ## Run DPC performance tests locally in a Docker image provided by Grafana/K6
start-load-tests:
@docker run --rm -i grafana/k6 run - <./dpc-load-testing/script.js
@docker run --rm -v $(shell pwd)/dpc-load-testing:/src --env-file $(shell pwd)/dpc-load-testing/.env -i grafana/k6 run /src/script.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Could store in ansible then
maybe change to
-e CLIENT_TOKEN=$LOAD_TEST_TOKEN ...

Copy link
Contributor Author

@chris-ronning-ny chris-ronning-ny Dec 17, 2024

Choose a reason for hiding this comment

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

The Makefile has no way to understand what $LOAD_TEST_TOKEN should be coming from. This whole thing isn't defined in a docker-compose.yml, but rather, it's run in grafana's own docker image.

As a result, I had to point --env-file at the decrypted env.local.

@chris-ronning-ny
Copy link
Contributor Author

@jdettmannnava updated to use ansible.

Copy link
Contributor

@jdettmannnava jdettmannnava left a comment

Choose a reason for hiding this comment

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

LGTM.

Eventually we will probably want to be able to choose the environment to run against (for example, run against local api vs dev vs test), but that seems to be outside the scope of this ticket.

@chris-ronning-ny chris-ronning-ny merged commit 728447c into main Dec 17, 2024
8 checks passed
@chris-ronning-ny chris-ronning-ny deleted the cr/dpc-4427 branch December 17, 2024 21:26
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