Skip to content

BCDA-9702: Add auth token benchmark test#1326

Merged
carlpartridge merged 3 commits intomainfrom
carl-9702-benchmark-token-endpoints
Mar 11, 2026
Merged

BCDA-9702: Add auth token benchmark test#1326
carlpartridge merged 3 commits intomainfrom
carl-9702-benchmark-token-endpoints

Conversation

@carlpartridge
Copy link
Collaborator

🎫 Ticket

https://jira.cms.gov/browse/BCDA-9702

🛠 Changes

Added benchmark tests for token creation via SSAS.

ℹ️ Context

SSAS has been having performance issues thought to be related to token creation and auth.

🧪 Validation

Local linting and testing.

@carlpartridge carlpartridge marked this pull request as ready for review March 9, 2026 18:03
@carlpartridge carlpartridge requested a review from a team as a code owner March 9, 2026 18:03
bhagatparwinder
bhagatparwinder previously approved these changes Mar 9, 2026
@carlpartridge carlpartridge requested a review from a team March 9, 2026 21:16
creds, err := provider.ResetSecret(aco.ClientID)
if err != nil {
b.Logf("failed to reset secrets: %+v", err)
b.FailNow()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: LogF() + FailNow() calls could be replaced with "Fatalf()"

hooks:
- id: golangci-lint
language_version: 1.25.7
language_version: 1.26.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!


Benchmark tests live in *_test.go files. They do not run as part of the normal testing suite. In order to run them you can do the following:
```
docker compose -f docker-compose.test.yml run tests go test -v ./... -bench=. -benchtime=10x -run=^$ -benchmem
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth adding a Makefile command for this with some sensible defaults?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the test expects a test ACO to already be set up in the database, it might make sense to include a load-fixtures command in there too, and/or reference that requirement in the readme.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I started with a Makefile command but almost every time I ran it I wanted different values for the various options so abandoned it and put it in the README instead. I will add that note, although generally speaking Im not sure if you can run the test suite without loading fixtures at some point prior?

michaeljvaldes
michaeljvaldes previously approved these changes Mar 10, 2026
README.md Outdated

#### Benchmark Testing

Benchmark tests live in *_test.go files. They do not run as part of the normal testing suite. To note the existing benchmark test assumes that you have existing data int he DB (ie have run `make load-fixtures`). In order to run them you can do the following:
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny nit: typo int he DB

@carlpartridge carlpartridge merged commit 9fa3193 into main Mar 11, 2026
7 checks passed
@carlpartridge carlpartridge deleted the carl-9702-benchmark-token-endpoints branch March 11, 2026 16:59
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.

3 participants