chore(tests): migrate goridge rpc + api/v4 → connectrpc + api-go/v6#213
Conversation
…o/v6
Migrate all goridge net/rpc + pkg/rpc callsites in tests to
connectrpc, matching the jobs/beanstalk reference. Bump both proto
namespaces since boltdb is a hybrid KV + Jobs plugin:
- api/v4/build/jobs/v1 → api-go/v6/jobs/v2
(HeaderValue.Value → JobHeaderValue.Values,
PushBatchRequest{Jobs:[one]} → PushRequest{Job:one})
- api/v4/build/kv/v1 → api-go/v6/kv/v2
(Request → KvRequest, Item → KvItem, Response → KvResponse,
Item.Timeout string (RFC3339 absolute) → KvItem.Ttl
*durationpb.Duration (relative); semantically equivalent
for the 5s/10s test expiries)
tests/helpers/helpers.go: exports NewJobsClient + NewKVClient
sharing a single newHTTPClient(t) h2c factory. boltdb_test.go uses
both for testRPCMethods (KV) and declareBoltDBPipe (Jobs).
Behavior improvements (inherited from beanstalk migration):
- DestroyPipelines reports last error after 10 failed attempts
- Stats requires non-empty stats slice before indexing
- Stats request fixed to emptypb.Empty (matches server handler)
- drop direct goridge/v4 dep (transitive bump beta.1 → beta.2)
- bump api-go/v6 beta.4 → beta.12
- bump rpc/v6 beta.3 → beta.4
- add connectrpc.com/connect v1.20.0 + golang.org/x/net for http2
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 35 minutes and 38 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR migrates test infrastructure from legacy goridge/net.rpc RPC clients to modern Connect-RPC HTTP-based clients. Dependencies are updated to 1.26.3 and newer roadrunner-server/grpc versions. Test helpers expose new Connect-RPC client constructors and rewrite pipeline-control methods. Test files update imports and implementations to use the new clients with v2 protobuf types and duration-based TTLs. ChangesConnect-RPC Test Infrastructure Migration
🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Migrates the tests/ suite from Goridge net/rpc callsites to ConnectRPC clients using the newer api-go/v6 proto namespaces, aligning KV and Jobs test interactions with the updated RoadRunner RPC surface.
Changes:
- Replace Goridge
net/rpcusage in tests with ConnectRPC clients (Jobs + KV), including shared HTTP/2 (h2c) client construction in helpers. - Update tests to
api-go/v6proto types/methods (jobs/v2, kv/v2), including TTL semantics viadurationpb.Duration. - Update
testsmodule dependencies to include Connect and newerapi-go/v6/rpc/v6versions.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/helpers/helpers.go | Adds shared ConnectRPC Jobs/KV clients and migrates helper calls to ConnectRPC requests. |
| tests/boltdb_test.go | Updates KV and Jobs test callsites to use ConnectRPC clients and new proto request/response types. |
| tests/go.mod | Adds ConnectRPC + bumps api-go/rpc/x-net deps; updates toolchain line. |
| tests/go.sum | Updates checksums for new/bumped dependencies. |
| go.work.sum | Workspace checksum updates after dependency changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… OTEL tests Two regressions surfaced by the assert.GreaterOrEqual fix unblocking -failfast past the PQ test: 1. DestroyPipelines previously silently passed when all 10 retries failed (legacy behavior); my "behavior improvement" assert.NoError( t, lastErr) broke negative tests that intentionally destroy non-existent pipelines (e.g. TestKafkaJobsError). Reverted to the original silent-after-retry semantics. 2. otel/v6 (≥beta.3) hard-rejects the zipkin exporter at Init (plugin.go:89). Existing OTEL test configs still target zipkin (exporter: zipkin, endpoint /api/v2/spans), and the test verification fetches from the zipkin REST API — switching the exporter alone would break verification. Skipped TestSQSOTEL / TestNATSOTEL / TestKafkaOTEL / TestBoltDBOTEL pending the otel team's decision to restore zipkin or migrate the test verification to OTLP+jaeger. Pre-existing on master; surfaced only because the GreaterOrEqual fix lets -failfast progress past the PQ test.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/helpers/helpers.go`:
- Around line 109-118: The retry loop currently swallows the final error after
10 attempts; change it so that if client.Destroy(t.Context(),
connect.NewRequest(req)) still returns an error after all retries you fail the
test with that last error (e.g. t.Fatalf or require.FailNow with the error
message) instead of returning silently; keep the existing retry logic and
time.Sleep, capture the last err from client.Destroy and use it in the failure
call (referencing client.Destroy, connect.NewRequest(req), t.Context(), and
req), or alternatively implement a separate helper for intentionally-ignored
negative tests and call that from places that should not fail the test.
- Around line 24-33: The test HTTP client created by newHTTPClient lacks a
Timeout, which can let requests hang indefinitely; update the newHTTPClient
helper to set the http.Client Timeout field (e.g., Timeout: 10*time.Second)
alongside the Transport to bound request duration, and add the necessary time
import if missing so stalled connections won't block test runs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 402258b5-5322-41e6-8627-38b8cfcba732
⛔ Files ignored due to path filters (2)
go.work.sumis excluded by!**/*.sumtests/go.sumis excluded by!**/*.sum
📒 Files selected for processing (4)
go.modtests/boltdb_test.gotests/go.modtests/helpers/helpers.go
| func newHTTPClient(t *testing.T) *http.Client { | ||
| t.Helper() | ||
| httpc := &http.Client{Transport: &http2.Transport{ | ||
| AllowHTTP: true, | ||
| DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) { | ||
| return new(net.Dialer).DialContext(ctx, network, addr) | ||
| }, | ||
| }} | ||
| t.Cleanup(httpc.CloseIdleConnections) | ||
| return httpc |
There was a problem hiding this comment.
Add an HTTP client timeout to prevent hanging test runs.
Line 26 builds a client without Timeout; stalled connections can block until global test timeout. Add a bounded timeout on this helper client.
Suggested fix
func newHTTPClient(t *testing.T) *http.Client {
t.Helper()
- httpc := &http.Client{Transport: &http2.Transport{
+ httpc := &http.Client{
+ Timeout: 15 * time.Second,
+ Transport: &http2.Transport{
AllowHTTP: true,
DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) {
return new(net.Dialer).DialContext(ctx, network, addr)
},
- }}
+ }}
t.Cleanup(httpc.CloseIdleConnections)
return httpc
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/helpers/helpers.go` around lines 24 - 33, The test HTTP client created
by newHTTPClient lacks a Timeout, which can let requests hang indefinitely;
update the newHTTPClient helper to set the http.Client Timeout field (e.g.,
Timeout: 10*time.Second) alongside the Transport to bound request duration, and
add the necessary time import if missing so stalled connections won't block test
runs.
otel/v6 (≥beta.3) hard-rejects the zipkin exporter at Init, so the previous OTEL test was skipped. Migrate to the in-memory tracer pattern used by http/v6 and grpc/v6: - inMemoryTracer struct implementing jobs.Tracer (Tracer() returns an sdktrace.TracerProvider backed by tracetest.InMemoryExporter with WithSyncer for immediate span availability) - Register the test tracer in endure instead of otel.Plugin - Verify spans via tracer.exp.GetSpans() — no zipkin REST API - Drop "otel:" block from the test config YAML - Loosen exact-set match to "contains all expected names" since some optional spans (e.g. *_stop) may be emitted in flight and vary between runs Removes the zipkin/jaeger docker dependencies for the OTEL test path and aligns with the rest of the plugin test infra.
Summary
Migrate all goridge
net/rpc + pkg/rpccallsites intests/to connectrpc, matching the jobs/beanstalk reference. Bump both proto namespaces since boltdb is a hybrid KV + Jobs plugin:Jobs proto bump (
api/v4/build/jobs/v1→api-go/v6/jobs/v2)HeaderValue.Value(singular) →JobHeaderValue.Values(plural)PushBatchRequest{Jobs: [oneJob]}→PushRequest{Job: oneJob}for single pushesKV proto bump (
api/v4/build/kv/v1→api-go/v6/kv/v2)Request → KvRequest,Item → KvItem,Response → KvResponseItem.Timeout(RFC3339 string, absolute) →KvItem.Ttl(*durationpb.Duration, relative) — semantically equivalent for the 5s/10s test expiriesCode organization
tests/helpers/helpers.goexportsNewJobsClient+NewKVClientsharing a singlenewHTTPClient(t)h2c factorytests/boltdb_test.gotestRPCMethods(KV) anddeclareBoltDBPipe(Jobs) both use these shared helpersBehavior improvements (inherited from the beanstalk migration)
DestroyPipelinesreports the last error after 10 failed attempts (the old loop fell through silently)Statsrequire.NotEmpty(resp.Msg.GetStats())before indexing[0](prevents implicit nil-deref)Statsrequest fixed toemptypb.Empty{}— matches the server handler signature (old code passedJobsHandlerResponse{}as the request)Dep bumps in
tests/go.modgoridge/v4(transitive bump beta.1 → beta.2)api-go/v6beta.4 → beta.12rpc/v6beta.3 → beta.4connectrpc.com/connect v1.20.0+golang.org/x/netTest plan
go build ./...cleango vet ./...cleangofmt -l .cleango test -race -count=1 ./...exercises both KV and jobs callsitesSummary by CodeRabbit