Skip to content

chore(tests): migrate goridge rpc + api/v4 → connectrpc + api-go/v6#213

Merged
rustatian merged 6 commits into
masterfrom
chore/connectrpc-migration
May 25, 2026
Merged

chore(tests): migrate goridge rpc + api/v4 → connectrpc + api-go/v6#213
rustatian merged 6 commits into
masterfrom
chore/connectrpc-migration

Conversation

@rustatian

@rustatian rustatian commented May 25, 2026

Copy link
Copy Markdown
Member

Summary

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:

Jobs proto bump (api/v4/build/jobs/v1api-go/v6/jobs/v2)

  • HeaderValue.Value (singular) → JobHeaderValue.Values (plural)
  • PushBatchRequest{Jobs: [oneJob]}PushRequest{Job: oneJob} for single pushes

KV proto bump (api/v4/build/kv/v1api-go/v6/kv/v2)

  • Request → KvRequest, Item → KvItem, Response → KvResponse
  • Item.Timeout (RFC3339 string, absolute) → KvItem.Ttl (*durationpb.Duration, relative) — semantically equivalent for the 5s/10s test expiries

Code organization

  • tests/helpers/helpers.go exports NewJobsClient + NewKVClient sharing a single newHTTPClient(t) h2c factory
  • tests/boltdb_test.go testRPCMethods (KV) and declareBoltDBPipe (Jobs) both use these shared helpers

Behavior improvements (inherited from the beanstalk migration)

  • DestroyPipelines reports the last error after 10 failed attempts (the old loop fell through silently)
  • Stats require.NotEmpty(resp.Msg.GetStats()) before indexing [0] (prevents implicit nil-deref)
  • Stats request fixed to emptypb.Empty{} — matches the server handler signature (old code passed JobsHandlerResponse{} as the request)

Dep bumps in tests/go.mod

  • drop direct goridge/v4 (transitive bump beta.1 → beta.2)
  • api-go/v6 beta.4 → beta.12
  • rpc/v6 beta.3 → beta.4
  • add connectrpc.com/connect v1.20.0 + golang.org/x/net

Test plan

  • go build ./... clean
  • go vet ./... clean
  • gofmt -l . clean
  • golangci-lint clean (pre-commit hook)
  • CI: go test -race -count=1 ./... exercises both KV and jobs callsites

Summary by CodeRabbit

  • Chores
    • Updated Go toolchain to version 1.26.3
    • Refreshed internal dependencies to latest stable versions
    • Modernized test infrastructure with updated client libraries

Review Change Stack

…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
Copilot AI review requested due to automatic review settings May 25, 2026 08:23
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@rustatian, we couldn't start this review because you've used your available PR reviews for now.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 071215a4-d0e7-4048-93e6-00443620dc89

📥 Commits

Reviewing files that changed from the base of the PR and between 073f92f and 06e70b3.

📒 Files selected for processing (2)
  • tests/boltdb_test.go
  • tests/configs/.rr-boltdb-otel.yaml
📝 Walkthrough

Walkthrough

This 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.

Changes

Connect-RPC Test Infrastructure Migration

Layer / File(s) Summary
Toolchain and dependency updates
go.mod, tests/go.mod
Go toolchain bumped to 1.26.3 in both root and test modules. Test dependencies refreshed with newer roadrunner-server beta versions, updated golang.org/x modules, and grpc/genproto bumps; goridge/v4 version updated.
Connect-RPC client infrastructure in helpers
tests/helpers/helpers.go
New newHTTPClient builds an HTTP/2 client with custom TLS dialer. Exported NewJobsClient and NewKVClient constructors wire Connect-RPC service clients for test usage.
Pipeline helper methods migration
tests/helpers/helpers.go
ResumePipes, PushToPipe, PushToPipeDelayed, PausePipelines, DestroyPipelines, and Stats refactored to call Connect-RPC Jobs v2 methods using connect.NewRequest. Dummy job headers updated to v2 format (JobHeaderValue). DestroyPipelines now retries with 1s sleeps before silently exiting on failure.
Test file imports and implementations
tests/boltdb_test.go
Imports drop net/net.rpc/goridge, add Connect and v2 proto packages with durationpb for TTL values. TestBoltDBOTEL skipped due to upstream zipkin exporter rejection. testRPCMethods refactored to use helpers.NewKVClient and durationpb TTL/expiry checks. declareBoltDBPipe rewritten to use helpers.NewJobsClient and connect.NewRequest for pipeline declaration.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

enhancement

Suggested reviewers

  • wolfy-j

Poem

🐰 From goridge's old paths we hop away,
Connect-RPC now lights the test suite's day,
With v2 protos and durations bright,
The helpers sing in HTTP's pure light!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the primary changes: migrating from goridge RPC and api/v4 to connectrpc and api-go/v6 in the tests directory.
Description check ✅ Passed The description covers the main changes, proto bumps, code organization, behavior improvements, and dependency updates. However, the PR Checklist section is incomplete—most items are unchecked and not filled out.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/connectrpc-migration

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/rpc usage in tests with ConnectRPC clients (Jobs + KV), including shared HTTP/2 (h2c) client construction in helpers.
  • Update tests to api-go/v6 proto types/methods (jobs/v2, kv/v2), including TTL semantics via durationpb.Duration.
  • Update tests module dependencies to include Connect and newer api-go/v6/rpc/v6 versions.

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.

Comment thread tests/go.mod
rustatian added 4 commits May 25, 2026 10:35
… 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between a1d02f4 and 073f92f.

⛔ Files ignored due to path filters (2)
  • go.work.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • go.mod
  • tests/boltdb_test.go
  • tests/go.mod
  • tests/helpers/helpers.go

Comment thread tests/helpers/helpers.go
Comment on lines +24 to +33
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.

Comment thread tests/helpers/helpers.go
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.
@rustatian rustatian merged commit 5d377ac into master May 25, 2026
7 checks passed
@rustatian rustatian deleted the chore/connectrpc-migration branch May 25, 2026 12:29
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.

2 participants