Skip to content

Remove database access from coderd_test #2584

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

Closed
kylecarbs opened this issue Jun 22, 2022 · 0 comments · Fixed by #2613
Closed

Remove database access from coderd_test #2584

kylecarbs opened this issue Jun 22, 2022 · 0 comments · Fixed by #2613
Assignees
Labels
api Area: HTTP API

Comments

@kylecarbs
Copy link
Member

This allows us to circumvent creating APIs for users to extract data to ensure our API is functional.

coder/coderd/users_test.go

Lines 149 to 154 in 437066c

// Generated tokens have a longer life
token, err := client.CreateAPIKey(ctx, admin.UserID.String())
require.NoError(t, err, "make new api key")
split = strings.Split(token.Key, "-")
apiKey, err := api.Database.GetAPIKeyByID(ctx, split[0])
require.NoError(t, err, "fetch api key")

We should add an API to fetch information about an API key, not test the value in the database. In v1 this led to an inconsistent API pattern, and we'll approach it similarly in v2 if we don't fix it early.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants