Skip to content

Move requireGrpcCode test helper into shared servertest package - #5047

Open
dejanzele wants to merge 1 commit into
armadaproject:masterfrom
dejanzele:share-grpc-status-test-helper
Open

Move requireGrpcCode test helper into shared servertest package#5047
dejanzele wants to merge 1 commit into
armadaproject:masterfrom
dejanzele:share-grpc-status-test-helper

Conversation

@dejanzele

@dejanzele dejanzele commented Jul 24, 2026

Copy link
Copy Markdown
Member

The executor, node, queue, and retry policy server tests each defined their own private requireGrpcCode helper for asserting that an error is a gRPC status with a given code. This moves the helper into the shared servertest package as RequireGrpcCode and switches all four to it.

The private copies used assert.Equal for the code comparison and the shared helper uses require.Equal, so a mismatched code now stops the test instead of letting it carry on.

The retry policy copy came in with #5049, which noted it could switch to the shared helper once both were in. That is done here, so no private copies remain.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Consolidates duplicated gRPC status assertion helpers into the shared servertest package.

  • Adds exported servertest.RequireGrpcCode.
  • Updates executor, node, queue, and retry-policy server tests to use the shared helper.
  • Makes an unexpected gRPC code abort the current test via require.Equal.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

Important Files Changed

Filename Overview
internal/server/servertest/grpc.go Adds the shared gRPC status-code assertion helper with fatal assertions for invalid status errors and mismatched codes.
internal/server/executor/executor_server_test.go Replaces the local helper with the shared servertest implementation.
internal/server/node/node_test.go Replaces the local helper with the shared servertest implementation.
internal/server/queue/queue_service_test.go Replaces the local helper with the shared servertest implementation.
internal/server/retrypolicy/service_test.go Replaces the local helper with the shared servertest implementation.

Reviews (6): Last reviewed commit: "Move requireGrpcCode test helper into sh..." | Re-trigger Greptile

@dejanzele

Copy link
Copy Markdown
Member Author

@greptileai

@dejanzele
dejanzele force-pushed the share-grpc-status-test-helper branch 3 times, most recently from 9d67642 to cae4b3e Compare July 30, 2026 15:37
dejanzele added a commit that referenced this pull request Jul 30, 2026
Implements the `RetryPolicyService` whose proto was defined in #4998:
create, get, list, update, and delete for retry policies, backed by a
Postgres repository. Adds `create_retry_policy`, `update_retry_policy`,
and `delete_retry_policy` permissions and maps them in the local
development server configs. Creating a policy that already exists
replaces it, the same as `create queue`, so a pipeline that creates
policies can be re-run. Updating one that does not exist still returns
`NotFound`.

Queue attachments are stored relationally rather than inside the
serialized queue definition. Migration 035 adds the `retry_policy` table
together with a `queue_retry_policy` join table, where each row records
the position its policy held in the submitted list so that a queue reads
its policies back in the order they were given. The queue repository
rewrites those rows on every queue write and composes `RetryPolicies`
from them on every read, so the serialized definition never carries the
names.

A foreign key on `policy_name` is what prevents a queue referencing a
policy that does not exist. A queue write also looks the names up first,
so the error can say which ones are missing, returned as
`InvalidArgument`. In the narrow case where a policy is deleted between
that lookup and the write, the foreign key rejects the write with a less
specific message. Deleting a policy removes its attachment rows and then
the policy itself, returning the queues it detached for the service to
log. The migration names that constraint explicitly because the
repository matches on it.

Both tables are queried through sqlc, generated into
`internal/server/queryapi/database`, matching the pattern the scheduler
already uses. The queue table's own statements are unchanged.

Independent of #5047 and #5048, any merge order works. Two notes on the
seams: the `RetryPolicies` field on the client queue type also appears
in #5048 as an identical hunk, since both PRs need it to compile on
their own, and it merges cleanly from either direction. The retry policy
service tests define their own gRPC status helper, which can switch to
the shared one from #5047 once both are in.

Replaces #5000, which carried all of this plus the client and armadactl
work in one PR.

Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
@dejanzele
dejanzele force-pushed the share-grpc-status-test-helper branch from cae4b3e to 160066f Compare July 30, 2026 16:28
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