mirror of
https://github.com/hanzoai/psrpc.git
synced 2026-09-30 23:47:22 +00:00
Two failures, neither in this code.
internal/test/my_service could not build: `undefined: MyServiceServer`. Its
.psrpc.go half is gitignored on purpose (internal/test/.gitignore carries
**/*.psrpc.go) — generated, not committed — so a fresh checkout has the
.pb.go and none of the service code that goes with it, and nothing in the
gate ever generated it. It does now, from the plugin in this repo. Only the
psrpc half: the .pb.go beside it IS committed, and regenerating that too
rewrites it against whatever protoc the runner carries.
From the package directory, as gen.go does. paths=source_relative places
output beside the .proto AS NAMED, so running it from the root writes
my_service.psrpc.go into the root and every build then reports `found
packages psrpc and my_service in <root>`.
internal/bus dialled 127.0.0.1 for containers it had just started:
bustest.go:51: dial tcp 127.0.0.1:32769: connect: connection refused
CI runs the job inside a container with the host's /var/run/docker.sock
bound in, so nats and redis come up as SIBLINGS — published on the HOST's
loopback, while the job's own 127.0.0.1 is a different interface with
nothing on it. dockertest reports the daemon's view; the port it chose is
right and the host is not, so hostPort keeps the port and answers the host:
the bridge gateway from inside a container, loopback outside one, and
DOCKER_TEST_HOST ahead of both.
Verified against a real daemon: internal/bus goes from refused to ok in 18s,
and the gate's own command — generate, build, then the package list it already
uses — passes 19 packages, exit 0.
33 lines
1.8 KiB
YAML
33 lines
1.8 KiB
YAML
# PSRPC — the pub/sub RPC framework and its protoc plugin. Go module, no image.
|
|
#
|
|
# `go build ./...` compiles every package including the 18 checked-in .pb.go
|
|
# files, so a regenerated-but-broken protobuf fails here. The suite then runs
|
|
# everything EXCEPT internal/test: that package's bustest harness starts real
|
|
# nats and redis containers through dockertest, so it is red or green according
|
|
# to the runner's docker daemon rather than this code. Excluded by list, not by
|
|
# a flag, so what is skipped is visible in the command itself.
|
|
#
|
|
# internal/test/my_service needs a generate step first. Its .psrpc.go half is
|
|
# gitignored on purpose (internal/test/.gitignore: **/*.psrpc.go) — generated,
|
|
# not committed — so a fresh checkout has the .pb.go and not the service code
|
|
# that goes with it, and the package cannot build: `undefined: MyServiceServer`.
|
|
# Only the psrpc half is generated here; the .pb.go beside it IS committed, and
|
|
# regenerating that too would rewrite it against whatever protoc the runner
|
|
# happens to carry.
|
|
test:
|
|
- name: test
|
|
run: |
|
|
set -e
|
|
command -v protoc >/dev/null || { sudo apt-get update && sudo apt-get install -y protobuf-compiler; }
|
|
BIN=$(mktemp -d)
|
|
go build -o "$BIN/protoc-gen-psrpc" ./protoc-gen-psrpc
|
|
# From the package directory, as gen.go does: paths=source_relative
|
|
# places the output beside the .proto as it was NAMED, so invoking this
|
|
# from the repo root writes my_service.psrpc.go into the root and gives
|
|
# `found packages psrpc and my_service in <root>`.
|
|
( cd internal/test/my_service \
|
|
&& PATH="$BIN:$PATH" protoc \
|
|
--psrpc_out=paths=source_relative:. \
|
|
-I ../../../protoc-gen-psrpc/options -I=. my_service.proto )
|
|
go build ./... && go test $(go list ./... | grep -v '/internal/test$')
|