BCDA-9702: Add auth token benchmark test#1326
Conversation
bcda/auth/api_test.go
Outdated
| creds, err := provider.ResetSecret(aco.ClientID) | ||
| if err != nil { | ||
| b.Logf("failed to reset secrets: %+v", err) | ||
| b.FailNow() |
There was a problem hiding this comment.
nit: LogF() + FailNow() calls could be replaced with "Fatalf()"
| hooks: | ||
| - id: golangci-lint | ||
| language_version: 1.25.7 | ||
| language_version: 1.26.0 |
|
|
||
| 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 |
There was a problem hiding this comment.
Is it worth adding a Makefile command for this with some sensible defaults?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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: |
There was a problem hiding this comment.
Tiny nit: typo int he DB
🎫 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.