Skip to content

test: dial the configured grpc endpoint and seed FGA before public checks - #26

Merged
lakhansamani merged 1 commit into
mainfrom
fix/test-grpc-endpoint-env
Aug 3, 2026
Merged

test: dial the configured grpc endpoint and seed FGA before public checks#26
lakhansamani merged 1 commit into
mainfrom
fix/test-grpc-endpoint-env

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

Two defects that let integration tests pass without testing anything.

grpc subtests dialed the wrong server

Neither protocolClient nor adminClient passed a grpc endpoint, and the suite never read AUTHORIZER_TEST_GRPC. The SDK therefore derived the endpoint from AUTHORIZER_TEST_URL's host plus the default grpc port — so a suite pointed at a container on a non-default port still sent every grpc call to whatever happened to be listening on 9091.

Locally that was an unrelated dev server, which showed up as:

[grpc] Login failed: rpc error: code = Unauthenticated desc = invalid credentials
--- PASS: TestLoginAcrossProtocols/graphql
--- PASS: TestLoginAcrossProtocols/rest
--- FAIL: TestLoginAcrossProtocols/grpc

The signup had gone to one server and the login to another. Worse than the failure is the inverse: when the two servers happen to be compatible, the grpc assertions pass while testing the wrong process entirely.

Public FGA tests never ran

TestCheckPermissions and TestListPermissions depended on declaration order. TestAdminFgaResetLast wipes the FGA store, and it is declared earlier, so the public tests found no authorization model, hit the authorization check failed branch of skipIfFgaUnavailable, and skipped. They only ever passed when run in isolation.

They now seed the model they check against. A server with no FGA engine at all still skips — that is the case the guard is genuinely for.

Verification

Full suite against quay.io/authorizer/authorizer:2.4.0-rc.13: all tests pass, and TestCheckPermissions/TestListPermissions now report PASS rather than SKIP in a full run.

…ecks

Two defects that let integration tests pass without testing anything.

The grpc subtests never read AUTHORIZER_TEST_GRPC -- neither protocolClient
nor adminClient passed a grpc endpoint, so the SDK derived it from
AUTHORIZER_TEST_URL's host plus the DEFAULT grpc port. A suite pointed at a
container on a non-default port still sent every grpc call to whatever was
listening on 9091, silently testing a different server. Locally that meant
an unrelated dev server, which surfaced as "invalid credentials" on grpc
login while graphql and rest passed.

TestCheckPermissions and TestListPermissions depended on test ordering:
TestAdminFgaResetLast wipes the FGA store, and Go runs tests in declaration
order, so by the time the public FGA tests ran there was no authorization
model. They took the "authorization check failed" branch of
skipIfFgaUnavailable and skipped -- so in a full-suite run those two never
executed at all, and only passed when run in isolation. They now seed the
model they check against. A server with no FGA engine still skips, which is
the case that guard is actually for.
@lakhansamani
lakhansamani merged commit 5fdcc9b into main Aug 3, 2026
1 check passed
@lakhansamani
lakhansamani deleted the fix/test-grpc-endpoint-env branch August 3, 2026 21:19
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.

1 participant