Skip to content

Conversation

@squaremo
Copy link
Contributor

@squaremo squaremo commented Nov 10, 2025

Broadly, these are the same as users, but ServiceAccounts can only belong to one org and cannot have permissions for another, so that's checked explicitly.

Creating service accounts needs an issuer, and this is a faff to set up; so I have recreated what the handler does, by using conversion.NewObjectMetadata(...). This means the accounts get a fresh UID every time, so the IDs get wrapped in a hold-all fixture. (Usually this is a good idea anyway, because it means you can generate names and IDs, and check everything still works.)

This is cherry-picked from #317, but since that already made a lot of changes (notably: authz is done only on information in the userinfo), I rewrote a substantial part of this. I removed some tests that are for malformed tokens (e.g., including more than one org), which aren't a possibility here. Those will go back in once that branch is rebased.

Broadly, these are the same as users, but ServiceAccounts can only
have permissions in their parent org, so that's checked explicitly.

Creating service accounts needs an issuer, and this is a faff to set
up; so I have recreated what the handler does, by using
`conversion.NewObjectMetadata(...)`. This means the accounts get a
fresh UID every time, so the IDs get wrapped in a hold-all
fixture. (Usually this is a good idea anyway, because it means you can
generate names and IDs, and check everything still works.)
@squaremo squaremo force-pushed the test-for-service-accounts branch from 5f01b21 to 8c56e4a Compare November 10, 2025 14:47
@squaremo squaremo marked this pull request as ready for review November 10, 2025 14:50
Copy link
Contributor

@spjmurray spjmurray left a comment

Choose a reason for hiding this comment

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

In the words of Bruce... "Groovy"

@spjmurray spjmurray merged commit 44acbba into main Nov 10, 2025
5 checks passed
@spjmurray spjmurray deleted the test-for-service-accounts branch November 10, 2025 15:41
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