From 56f61071b197ed9dd1207895b459b69aa866b5ec Mon Sep 17 00:00:00 2001 From: mnoah1 Date: Tue, 2 Jun 2026 20:09:26 +0000 Subject: [PATCH 1/3] refactor(stovepipe): nest gateway example and library under gateway/ Move example client/server from example/{client,server}/stovepipe to example/stovepipe/gateway/{client,server} with compose and Dockerfile aligned to main SubmitQueue examples. Relocate stovepipe RPC code under stovepipe/gateway (rename proto to gateway.proto, add yarpc output). Add stovepipe/entity and stovepipe/extension package anchors, core/extension stub, and Makefile targets for Stovepipe gateway Linux builds, queue-only schema init, and local compose using STOVEPIPE_LOCAL_PROJECT. Integration tests target the new gateway compose path; root gateway/orchestrator protopb unchanged from main. --- BUILD.bazel | 2 +- CLAUDE.md | 7 +- Makefile | 136 +++++---- core/extension/BUILD.bazel | 8 + core/extension/extension.go | 17 ++ example/README.md | 50 +++- example/server/stovepipe/Dockerfile | 12 - example/server/stovepipe/docker-compose.yml | 19 -- .../gateway/client}/BUILD.bazel | 10 +- .../gateway/client}/main.go | 8 +- .../gateway/server}/BUILD.bazel | 12 +- example/stovepipe/gateway/server/Dockerfile | 15 + .../gateway/server/docker-compose.yml | 68 +++++ .../gateway/server}/main.go | 30 +- stovepipe/README.md | 8 +- stovepipe/entity/BUILD.bazel | 8 + stovepipe/entity/entity.go | 16 ++ stovepipe/extension/BUILD.bazel | 8 + stovepipe/extension/extension.go | 16 ++ .../{ => gateway}/controller/BUILD.bazel | 6 +- stovepipe/{ => gateway}/controller/ping.go | 4 +- .../{ => gateway}/controller/ping_test.go | 4 +- stovepipe/{ => gateway}/proto/BUILD.bazel | 18 +- .../proto/gateway.proto} | 8 +- stovepipe/{ => gateway}/protopb/BUILD.bazel | 8 +- .../protopb/gateway.pb.go} | 77 +++-- stovepipe/gateway/protopb/gateway.pb.yarpc.go | 262 ++++++++++++++++++ .../protopb/gateway_grpc.pb.go} | 77 +++-- stovepipe/protopb/stovepipe.pb.yarpc.go | 261 ----------------- test/integration/stovepipe/BUILD.bazel | 4 +- test/integration/stovepipe/suite_test.go | 57 ++-- 31 files changed, 705 insertions(+), 531 deletions(-) create mode 100644 core/extension/BUILD.bazel create mode 100644 core/extension/extension.go delete mode 100644 example/server/stovepipe/Dockerfile delete mode 100644 example/server/stovepipe/docker-compose.yml rename example/{client/stovepipe => stovepipe/gateway/client}/BUILD.bazel (61%) rename example/{client/stovepipe => stovepipe/gateway/client}/main.go (88%) rename example/{server/stovepipe => stovepipe/gateway/server}/BUILD.bazel (65%) create mode 100644 example/stovepipe/gateway/server/Dockerfile create mode 100644 example/stovepipe/gateway/server/docker-compose.yml rename example/{server/stovepipe => stovepipe/gateway/server}/main.go (81%) create mode 100644 stovepipe/entity/BUILD.bazel create mode 100644 stovepipe/entity/entity.go create mode 100644 stovepipe/extension/BUILD.bazel create mode 100644 stovepipe/extension/extension.go rename stovepipe/{ => gateway}/controller/BUILD.bazel (79%) rename stovepipe/{ => gateway}/controller/ping.go (95%) rename stovepipe/{ => gateway}/controller/ping_test.go (95%) rename stovepipe/{ => gateway}/proto/BUILD.bazel (56%) rename stovepipe/{proto/stovepipe.proto => gateway/proto/gateway.proto} (86%) rename stovepipe/{ => gateway}/protopb/BUILD.bazel (82%) rename stovepipe/{protopb/stovepipe.pb.go => gateway/protopb/gateway.pb.go} (71%) create mode 100644 stovepipe/gateway/protopb/gateway.pb.yarpc.go rename stovepipe/{protopb/stovepipe_grpc.pb.go => gateway/protopb/gateway_grpc.pb.go} (52%) delete mode 100644 stovepipe/protopb/stovepipe.pb.yarpc.go diff --git a/BUILD.bazel b/BUILD.bazel index 9aa85258..750dcaad 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -5,7 +5,7 @@ load("@gazelle//:def.bzl", "gazelle") # Resolve protobuf import ambiguities - use the actual protopb packages, not the proto aliases # gazelle:resolve go github.com/uber/submitqueue/gateway/protopb //gateway/protopb # gazelle:resolve go github.com/uber/submitqueue/orchestrator/protopb //orchestrator/protopb -# gazelle:resolve go github.com/uber/submitqueue/stovepipe/protopb //stovepipe/protopb +# gazelle:resolve go github.com/uber/submitqueue/stovepipe/gateway/protopb //stovepipe/gateway/protopb # Export marker files for test data dependencies (used by FindRepoRoot in tests) exports_files( diff --git a/CLAUDE.md b/CLAUDE.md index 692d815b..c0f8de75 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -157,7 +157,10 @@ Generated proto files are committed. When modifying `.proto` files: ### Makefile -Targets are **alphabetically sorted**. Each target has `## Description` for auto-generated help and shell completion: +Targets are **alphabetically sorted**. Each target has `## Description` for auto-generated help and shell completion. + +**Docker Compose:** `COMPOSE` defaults to `docker compose` (Compose v2) so `up --wait` works in `local-*` targets. Install the [Compose plugin](https://docs.docker.com/compose/install/linux/) (e.g. `docker-compose-plugin` on Debian/Ubuntu). Override with `make COMPOSE=docker-compose ...` only if you use a legacy binary (it does not support `--wait` the same way). SubmitQueue stacks use compose project **`SUBMITQUEUE_LOCAL_PROJECT`** (default `submitqueue`); Stovepipe stacks use **`STOVEPIPE_LOCAL_PROJECT`** (default `stovepipe`). Override either with `make SUBMITQUEUE_LOCAL_PROJECT=myname ...` or `STOVEPIPE_LOCAL_PROJECT=...`. + ```makefile integration-test: build-all-linux ## Run all integration tests (auto-builds binaries) @$(BAZEL) test //test/integration/... --test_output=streamed @@ -176,7 +179,7 @@ make check-gazelle # Check BUILD.bazel files are up to date make tidy # Run go mod tidy + bazel mod tidy make gazelle # Update BUILD.bazel files make mocks # Generate mock files using mockgen -make integration-test # Run all integration tests (Docker-based) +make integration-test # Run all integration tests (Docker-based; includes Stovepipe gateway) make e2e-test # Run end-to-end tests make proto # Regenerate proto files make local-start # Start full stack with Docker Compose diff --git a/Makefile b/Makefile index 4fb97bb0..fb4006be 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,20 @@ BAZEL = ./tool/bazel # Docker Compose wrapper COMPOSE = docker-compose + +# SubmitQueue compose files COMPOSE_FILE = example/server/docker-compose.yml GATEWAY_COMPOSE_FILE = example/server/gateway/docker-compose.yml ORCHESTRATOR_COMPOSE_FILE = example/server/orchestrator/docker-compose.yml -STOVEPIPE_COMPOSE_FILE = example/server/stovepipe/docker-compose.yml -# Fixed project name for local manual testing (tests use unique random names) -LOCAL_PROJECT = submitqueue +# Stovepipe compose files +STOVEPIPE_GATEWAY_COMPOSE_FILE = example/stovepipe/gateway/server/docker-compose.yml + +# Compose project for SubmitQueue example stacks (`docker compose -p`); container prefix e.g. submitqueue-mysql-app-1. +SUBMITQUEUE_LOCAL_PROJECT ?= submitqueue + +# Compose project for Stovepipe example stacks (`docker compose -p`); container prefix e.g. stovepipe-mysql-app-1. +STOVEPIPE_LOCAL_PROJECT ?= stovepipe # yamlfmt version for YAML formatting (override with: make fmt YAMLFMT_VERSION=v0.16.0) YAMLFMT_VERSION ?= v0.16.0 @@ -31,7 +38,7 @@ define assert_clean fi endef -.PHONY: build build-all-linux build-gateway-linux build-orchestrator-linux build-stovepipe-linux check-gazelle check-mocks check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-consumer integration-test-extensions integration-test-gateway integration-test-orchestrator integration-test-stovepipe license-fix lint lint-fmt lint-license local-clean local-gateway-start local-gateway-stop local-init-schemas local-logs local-orchestrator-start local-orchestrator-stop local-ps local-restart local-start local-stop local-stovepipe-start local-stovepipe-stop mocks proto query-deps query-targets run-client-gateway run-client-orchestrator run-client-stovepipe run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help +.PHONY: build build-all-linux build-gateway-linux build-orchestrator-linux build-stovepipe-gateway-linux check-gazelle check-mocks check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-consumer integration-test-extensions integration-test-gateway integration-test-orchestrator license-fix lint lint-fmt lint-license local-clean local-gateway-start local-gateway-stop local-init-schemas local-init-stovepipe-queue-schema local-logs local-orchestrator-start local-orchestrator-stop local-ps local-restart local-start local-stop local-stovepipe-gateway-start local-stovepipe-gateway-stop mocks proto query-deps query-targets run-client-gateway run-client-orchestrator run-client-stovepipe-gateway run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help build: ## Build all services and examples @@ -40,7 +47,7 @@ build: ## Build all services and examples @echo "Build complete!" # Build Linux binaries required for Docker containers -build-all-linux: build-gateway-linux build-orchestrator-linux build-stovepipe-linux ## Build all Linux binaries for Docker +build-all-linux: build-gateway-linux build-orchestrator-linux build-stovepipe-gateway-linux ## Build all Linux binaries for Docker @echo "All Linux binaries ready for Docker" build-gateway-linux: ## Build Gateway Linux binary for Docker @@ -59,13 +66,13 @@ build-orchestrator-linux: ## Build Orchestrator Linux binary for Docker cp -f bazel-bin/example/server/orchestrator/orchestrator .docker-bin/orchestrator @echo "Orchestrator Linux binary ready at .docker-bin/orchestrator" -build-stovepipe-linux: ## Build Stovepipe Linux binary for Docker - @echo "Building Stovepipe Linux binary for Docker..." - @$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/server/stovepipe:stovepipe +build-stovepipe-gateway-linux: ## Build Stovepipe gateway Linux binary for Docker + @echo "Building Stovepipe gateway Linux binary for Docker..." + @$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/stovepipe/gateway/server:gateway @mkdir -p .docker-bin - @cp -f bazel-bin/example/server/stovepipe/stovepipe_/stovepipe .docker-bin/stovepipe 2>/dev/null || \ - cp -f bazel-bin/example/server/stovepipe/stovepipe .docker-bin/stovepipe - @echo "Stovepipe Linux binary ready at .docker-bin/stovepipe" + @cp -f bazel-bin/example/stovepipe/gateway/server/gateway_/gateway .docker-bin/stovepipe-gateway 2>/dev/null || \ + cp -f bazel-bin/example/stovepipe/gateway/server/gateway .docker-bin/stovepipe-gateway + @echo "Stovepipe gateway Linux binary ready at .docker-bin/stovepipe-gateway" check-gazelle: ## Check BUILD.bazel files are up to date @echo "Running Gazelle to check BUILD files..." @@ -91,7 +98,7 @@ clean-proto: ## Clean generated proto files @echo "Cleaning generated proto files..." @rm -rf gateway/protopb/*.pb.go @rm -rf orchestrator/protopb/*.pb.go - @rm -rf stovepipe/protopb/*.pb.go + @rm -rf stovepipe/gateway/protopb/*.pb.go @echo "Proto clean complete!" deps: tidy-go ## Download and tidy Go dependencies @@ -132,10 +139,6 @@ integration-test-orchestrator: build-orchestrator-linux ## Run Orchestrator inte @echo "Running Orchestrator integration tests..." @$(BAZEL) test //test/integration/orchestrator:orchestrator_test --test_output=streamed -integration-test-stovepipe: build-stovepipe-linux ## Run Stovepipe integration tests (auto-builds binary) - @echo "Running Stovepipe integration tests..." - @$(BAZEL) test //test/integration/stovepipe:stovepipe_test --test_output=streamed - license-fix: ## Add missing license headers to source files @$(BAZEL) run //tool/linter/licenseheader -- --fix @@ -151,100 +154,108 @@ lint-license: ## Check license headers on all source files local-clean: ## Stop and remove all local services, volumes, and images @echo "Cleaning all services and data..." - @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) down -v --rmi local + @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down -v --rmi local @echo "All services, volumes, and images removed." local-gateway-start: build-gateway-linux ## Start Gateway service locally (Gateway + 2 MySQL databases) @echo "Starting Gateway with docker-compose..." - @$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(LOCAL_PROJECT) up -d --build --wait + @$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) up -d --build --wait @echo "Applying database schemas..." @$(MAKE) -s local-init-schemas @echo "" @echo "βœ… Gateway is running!" @echo "" - @$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(LOCAL_PROJECT) ps + @$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) ps @echo "" - @echo "Gateway gRPC port: $$(docker port $(LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')" - @echo "MySQL App port: $$(docker port $(LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" - @echo "MySQL Queue port: $$(docker port $(LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "Gateway gRPC port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "MySQL App port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "MySQL Queue port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" local-gateway-stop: ## Stop Gateway service @echo "Stopping Gateway services..." - @$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(LOCAL_PROJECT) down + @$(COMPOSE) -f $(GATEWAY_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down @echo "Gateway services stopped." local-init-schemas: ## Manually apply all database schemas @echo "Applying storage schema to mysql-app..." @for file in extension/storage/mysql/schema/*.sql; do \ echo " - Applying $$(basename $$file)..."; \ - docker exec -i $(LOCAL_PROJECT)-mysql-app-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ + docker exec -i $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ done @echo "Applying counter schema to mysql-app..." @for file in extension/counter/mysql/schema/*.sql; do \ echo " - Applying $$(basename $$file)..."; \ - docker exec -i $(LOCAL_PROJECT)-mysql-app-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ + docker exec -i $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ done @echo "Applying queue schema to mysql-queue..." @for file in extension/queue/mysql/schema/*.sql; do \ echo " - Applying $$(basename $$file)..."; \ - docker exec -i $(LOCAL_PROJECT)-mysql-queue-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ + docker exec -i $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ done @echo "βœ… All schemas applied successfully" +local-init-stovepipe-queue-schema: ## Apply queue schema only (mysql-queue) for Stovepipe compose stacks + @echo "Applying queue schema to mysql-queue (Stovepipe; no app storage/counter schema yet)..." + @for file in extension/queue/mysql/schema/*.sql; do \ + echo " - Applying $$(basename $$file)..."; \ + docker exec -i $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 mysql -uroot -proot submitqueue < $$file 2>&1 | grep -v "Using a password" || true; \ + done + @echo "βœ… Stovepipe queue schema applied successfully" + local-logs: ## View logs from all running services - @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) logs -f + @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) logs -f local-orchestrator-start: build-orchestrator-linux ## Start Orchestrator service locally (Orchestrator + 2 MySQL databases) @echo "Starting Orchestrator with docker-compose..." - @$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(LOCAL_PROJECT) up -d --build --wait + @$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) up -d --build --wait @echo "Applying database schemas..." @$(MAKE) -s local-init-schemas @echo "" @echo "βœ… Orchestrator is running!" @echo "" - @$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(LOCAL_PROJECT) ps + @$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) ps @echo "" - @echo "Orchestrator gRPC port: $$(docker port $(LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')" - @echo "MySQL App port: $$(docker port $(LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" - @echo "MySQL Queue port: $$(docker port $(LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "Orchestrator gRPC port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "MySQL App port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "MySQL Queue port: $$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" local-orchestrator-stop: ## Stop Orchestrator service @echo "Stopping Orchestrator services..." - @$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(LOCAL_PROJECT) down + @$(COMPOSE) -f $(ORCHESTRATOR_COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down @echo "Orchestrator services stopped." local-ps: ## Show running containers and their ports @echo "Running containers and ports:" @echo "" - @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) ps + @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) ps @echo "" @echo "πŸ“‘ Service Endpoints:" - @echo " Gateway gRPC: localhost:$$(docker port $(LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'not running')" - @echo " Orchestrator gRPC: localhost:$$(docker port $(LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'not running')" + @echo " Gateway gRPC: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'not running')" + @echo " Orchestrator gRPC: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-orchestrator-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'not running')" @echo "" @echo "πŸ—„οΈ Database Endpoints:" - @echo " MySQL App: localhost:$$(docker port $(LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'not running')" - @echo " MySQL Queue: localhost:$$(docker port $(LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'not running')" + @echo " MySQL App: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'not running')" + @echo " MySQL Queue: localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'not running')" @echo "" @echo "πŸ’‘ Usage:" @echo " # Connect to MySQL App DB" - @echo " mysql -h127.0.0.1 -P$$(docker port $(LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'PORT') -uroot -proot submitqueue" + @echo " mysql -h127.0.0.1 -P$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'PORT') -uroot -proot submitqueue" @echo "" @echo " # Call Gateway gRPC" - @echo " grpcurl -plaintext -d '{\"message\":\"test\"}' localhost:$$(docker port $(LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'PORT') submitqueue.SubmitQueueGateway/Ping" + @echo " grpcurl -plaintext -d '{\"message\":\"test\"}' localhost:$$(docker port $(SUBMITQUEUE_LOCAL_PROJECT)-gateway-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'PORT') submitqueue.SubmitQueueGateway/Ping" @echo "" @echo " # View logs" @echo " make local-logs" local-restart: build-all-linux ## Restart all services (rebuild and restart) @echo "Restarting all services..." - @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) restart + @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) restart @echo "Services restarted!" @make local-ps local-start: build-all-linux ## Start full stack (Gateway + Orchestrator + MySQL) @echo "Starting full stack with docker-compose..." - @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) up -d --build --wait + @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) up -d --build --wait @echo "Applying database schemas..." @$(MAKE) -s local-init-schemas @echo "" @@ -254,23 +265,27 @@ local-start: build-all-linux ## Start full stack (Gateway + Orchestrator + MySQL local-stop: ## Stop all services (keep data) @echo "Stopping all services..." - @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) down + @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down @echo "Services stopped. Data volumes preserved." -local-stovepipe-start: build-stovepipe-linux ## Start Stovepipe service locally (stateless, no databases) - @echo "Starting Stovepipe with docker-compose..." - @$(COMPOSE) -f $(STOVEPIPE_COMPOSE_FILE) -p $(LOCAL_PROJECT) up -d --build --wait +local-stovepipe-gateway-start: build-stovepipe-gateway-linux ## Start Stovepipe gateway locally (gateway + 2 MySQL databases) + @echo "Starting Stovepipe gateway with compose..." + @$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) up -d --build --wait + @echo "Applying queue schema to mysql-queue (no Stovepipe app schema yet)..." + @$(MAKE) -s local-init-stovepipe-queue-schema @echo "" - @echo "βœ… Stovepipe is running!" + @echo "βœ… Stovepipe gateway is running!" @echo "" - @$(COMPOSE) -f $(STOVEPIPE_COMPOSE_FILE) -p $(LOCAL_PROJECT) ps + @$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) ps @echo "" - @echo "Stovepipe gRPC port: $$(docker port $(LOCAL_PROJECT)-stovepipe-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "Stovepipe gateway gRPC port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-stovepipe-service-1 8080 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "MySQL App port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" + @echo "MySQL Queue port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" -local-stovepipe-stop: ## Stop Stovepipe service - @echo "Stopping Stovepipe services..." - @$(COMPOSE) -f $(STOVEPIPE_COMPOSE_FILE) -p $(LOCAL_PROJECT) down - @echo "Stovepipe services stopped." +local-stovepipe-gateway-stop: ## Stop Stovepipe gateway service + @echo "Stopping Stovepipe gateway services..." + @$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) down + @echo "Stovepipe gateway services stopped." mocks: ## Generate mock files using mockgen @echo "Generating mocks..." @@ -287,10 +302,10 @@ proto: ## Generate protobuf files from .proto definitions --go-grpc_out=orchestrator/protopb --go-grpc_opt=paths=source_relative \ --yarpc-go_out=orchestrator/protopb --yarpc-go_opt=paths=source_relative \ --proto_path=orchestrator/proto orchestrator/proto/orchestrator.proto - @protoc --go_out=stovepipe/protopb --go_opt=paths=source_relative \ - --go-grpc_out=stovepipe/protopb --go-grpc_opt=paths=source_relative \ - --yarpc-go_out=stovepipe/protopb --yarpc-go_opt=paths=source_relative \ - --proto_path=stovepipe/proto stovepipe/proto/stovepipe.proto + @protoc --go_out=stovepipe/gateway/protopb --go_opt=paths=source_relative \ + --go-grpc_out=stovepipe/gateway/protopb --go-grpc_opt=paths=source_relative \ + --yarpc-go_out=stovepipe/gateway/protopb --yarpc-go_opt=paths=source_relative \ + --proto_path=stovepipe/gateway/proto stovepipe/gateway/proto/gateway.proto @echo "Protobuf files generated successfully!" # Bazel query helpers @@ -308,9 +323,9 @@ run-client-gateway: run-client-orchestrator: @$(BAZEL) run //example/client/orchestrator:orchestrator -- -addr $(or $(SERVER_ADDR),localhost:8082) -message "$(or $(MESSAGE),ping)" -# Run stovepipe client (connects to any running stovepipe service) -run-client-stovepipe: - @$(BAZEL) run //example/client/stovepipe:stovepipe -- -addr $(or $(SERVER_ADDR),localhost:8083) -message "$(or $(MESSAGE),ping)" +# Run stovepipe gateway client (connects to any running stovepipe gateway service) +run-client-stovepipe-gateway: + @$(BAZEL) run //example/stovepipe/gateway/client:gateway -- -addr $(or $(SERVER_ADDR),localhost:8083) -message "$(or $(MESSAGE),ping)" run-queue-admin: ## Run queue-admin CLI (use ARGS to pass arguments, e.g. make run-queue-admin ARGS="list-topics") @$(BAZEL) run //extension/queue/mysql/ctl -- $(ARGS) @@ -337,4 +352,3 @@ help: ## Show this help message @echo "Available targets:" @echo "" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' - diff --git a/core/extension/BUILD.bazel b/core/extension/BUILD.bazel new file mode 100644 index 00000000..c10bde8d --- /dev/null +++ b/core/extension/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "extension", + srcs = ["extension.go"], + importpath = "github.com/uber/submitqueue/core/extension", + visibility = ["//visibility:public"], +) diff --git a/core/extension/extension.go b/core/extension/extension.go new file mode 100644 index 00000000..30d38196 --- /dev/null +++ b/core/extension/extension.go @@ -0,0 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package extension holds extension interfaces and implementations shared +// across SubmitQueue, Stovepipe, and other repo-local services. +package extension diff --git a/example/README.md b/example/README.md index 3929f5fe..92647af4 100644 --- a/example/README.md +++ b/example/README.md @@ -4,10 +4,11 @@ Example gRPC servers and clients for running the submitqueue services locally. ## Services -- **Gateway** (port 8081) β€” entry point for land requests. Exposes `Ping` and `Land` RPCs. -- **Orchestrator** (port 8082) β€” coordinates the pipeline. Exposes `Ping` RPC and consumes queue messages across 9 pipeline topics. +- **SubmitQueue Gateway** (port 8081) β€” entry point for land requests. Exposes `Ping` and `Land` RPCs. +- **SubmitQueue Orchestrator** (port 8082) β€” coordinates the pipeline. Exposes `Ping` RPC and consumes queue messages across 9 pipeline topics. +- **Stovepipe Gateway** (port 8083) - entry point for commit deployment verification requests. Exposes `Ping` RPC. -Both services require MySQL (app database + queue database). Docker Compose handles this automatically. +Services use MySQL (app + queue) when run via the Docker Compose examples below. **Use Docker Compose v2** (`docker compose`, e.g. the `docker-compose-plugin` package) so `make local-*` targets can use `up --wait`. The Makefile sets `COMPOSE ?= docker compose` by default. ## Directory Structure @@ -23,41 +24,56 @@ example/ β”‚ β”œβ”€β”€ main.go # Orchestrator server entry point β”‚ β”œβ”€β”€ Dockerfile β”‚ └── docker-compose.yml # Orchestrator-only stack -└── client/ - β”œβ”€β”€ gateway/main.go # Gateway ping client - └── orchestrator/main.go # Orchestrator ping client +β”œβ”€β”€ client/ +β”‚ β”œβ”€β”€ gateway/main.go # Gateway ping client +β”‚ └── orchestrator/main.go # Orchestrator ping client +└── stovepipe/ + └── gateway/ + β”œβ”€β”€ server/ + β”‚ β”œβ”€β”€ main.go # Stovepipe gateway gRPC server (Docker: :8080; go run default :8083) + β”‚ β”œβ”€β”€ Dockerfile + β”‚ └── docker-compose.yml # Gateway-only stack + └── client/main.go # Stovepipe gateway ping client ``` ## Running -### Docker Compose (Recommended) +### Docker Compose (recommended) + +Requires **Docker Compose v2** (`docker compose`) for `up --wait` used by `make local-*`. On Debian/Ubuntu: `sudo apt-get install -y docker-compose-plugin`, then `docker compose version`. ```bash -# Start full stack (Gateway + Orchestrator + MySQL) +# Start full SubmitQueue stack (Gateway + Orchestrator + MySQL) make local-start - -# Start individual services make local-gateway-start make local-orchestrator-start +# Start Stovepipe gateway (Gateway + 2x MySQL) +make local-stovepipe-gateway-start + # View logs and status make local-logs make local-ps # Stop make local-stop +make local-stovepipe-gateway-stop ``` +For Docker, `make build-stovepipe-gateway-linux` copies a Linux binary to `.docker-bin/stovepipe-gateway` so it does not overwrite SubmitQueue’s `.docker-bin/gateway`. Stovepipe `make local-stovepipe-gateway-start` applies **only the queue schema** on `mysql-queue` (`make local-init-stovepipe-queue-schema`); SubmitQueue storage/counter schemas on `mysql-app` are skipped until Stovepipe has its own app schema. Compose uses project name **`stovepipe`** for Stovepipe (`make STOVEPIPE_LOCAL_PROJECT=myname ...`). SubmitQueue examples use project **`submitqueue`** by default (`make SUBMITQUEUE_LOCAL_PROJECT=myname ...`). Stovepipe containers are named like `stovepipe-mysql-app-1`, not `submitqueue-*`. + ### Bazel ```bash # Build servers bazel build //example/server/gateway:gateway bazel build //example/server/orchestrator:orchestrator +bazel build //example/stovepipe/gateway/server:gateway # Build clients bazel build //example/client/gateway:gateway bazel build //example/client/orchestrator:orchestrator +bazel build //example/stovepipe/gateway/client:gateway ``` ### Go @@ -65,6 +81,7 @@ bazel build //example/client/orchestrator:orchestrator ```bash go run example/server/gateway/main.go go run example/server/orchestrator/main.go +go run example/stovepipe/gateway/server/main.go ``` ## Testing with Clients @@ -73,6 +90,7 @@ go run example/server/orchestrator/main.go # Go clients go run example/client/gateway/main.go -addr localhost:8081 -message "hello" go run example/client/orchestrator/main.go -addr localhost:8082 -message "hello" +go run example/stovepipe/gateway/client/main.go -addr localhost:8083 -message "hello" ``` Client flags: @@ -93,14 +111,17 @@ go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest # Ping grpcurl -plaintext -d '{"message": "hello"}' localhost:8081 uber.submitqueue.gateway.SubmitQueueGateway/Ping grpcurl -plaintext -d '{"message": "hello"}' localhost:8082 uber.submitqueue.orchestrator.SubmitQueueOrchestrator/Ping +grpcurl -plaintext -d '{"message": "hello"}' localhost:8083 uber.submitqueue.stovepipe.StovepipeGateway/Ping # List services grpcurl -plaintext localhost:8081 list grpcurl -plaintext localhost:8082 list +grpcurl -plaintext localhost:8083 list # Describe a service grpcurl -plaintext localhost:8081 describe uber.submitqueue.gateway.SubmitQueueGateway grpcurl -plaintext localhost:8082 describe uber.submitqueue.orchestrator.SubmitQueueOrchestrator +grpcurl -plaintext localhost:8083 describe uber.submitqueue.stovepipe.StovepipeGateway ``` ## API Reference @@ -123,3 +144,12 @@ grpcurl -plaintext localhost:8082 describe uber.submitqueue.orchestrator.SubmitQ | Method | Description | |--------|-------------| | `Ping` | Health check, returns service name and timestamp | + +### Stovepipe Gateway + +**Service**: `uber.submitqueue.stovepipe.StovepipeGateway` +**Proto**: `stovepipe/gateway/proto/gateway.proto` + +| Method | Description | +|--------|-------------| +| `Ping` | Health check | diff --git a/example/server/stovepipe/Dockerfile b/example/server/stovepipe/Dockerfile deleted file mode 100644 index 355a93bd..00000000 --- a/example/server/stovepipe/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM debian:bookworm-slim - -RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* -WORKDIR /root/ - -# Copy pre-built Linux binary -# Built via: make build-stovepipe-linux -COPY .docker-bin/stovepipe ./stovepipe - -EXPOSE 8080 - -CMD ["./stovepipe"] diff --git a/example/server/stovepipe/docker-compose.yml b/example/server/stovepipe/docker-compose.yml deleted file mode 100644 index 88ea99f4..00000000 --- a/example/server/stovepipe/docker-compose.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Docker Compose for Stovepipe Manual Testing -# -# IMPORTANT: Before running docker-compose, build the Linux binary: -# make build-stovepipe-linux -# OR -# bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //example/server/stovepipe -# -# Quick start: -# make local-stovepipe-start - -services: - stovepipe-service: - build: - context: ${REPO_ROOT} - dockerfile: example/server/stovepipe/Dockerfile - ports: - - "8080" # Random ephemeral port to avoid conflicts - environment: - - PORT=:8080 diff --git a/example/client/stovepipe/BUILD.bazel b/example/stovepipe/gateway/client/BUILD.bazel similarity index 61% rename from example/client/stovepipe/BUILD.bazel rename to example/stovepipe/gateway/client/BUILD.bazel index eed30fd1..19a253b4 100644 --- a/example/client/stovepipe/BUILD.bazel +++ b/example/stovepipe/gateway/client/BUILD.bazel @@ -1,19 +1,19 @@ load("@rules_go//go:def.bzl", "go_binary", "go_library") go_library( - name = "stovepipe_lib", + name = "gateway_lib", srcs = ["main.go"], - importpath = "github.com/uber/submitqueue/example/client/stovepipe", + importpath = "github.com/uber/submitqueue/example/stovepipe/gateway/client", visibility = ["//visibility:private"], deps = [ - "//stovepipe/protopb", + "//stovepipe/gateway/protopb", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//credentials/insecure", ], ) go_binary( - name = "stovepipe", - embed = [":stovepipe_lib"], + name = "gateway", + embed = [":gateway_lib"], visibility = ["//visibility:public"], ) diff --git a/example/client/stovepipe/main.go b/example/stovepipe/gateway/client/main.go similarity index 88% rename from example/client/stovepipe/main.go rename to example/stovepipe/gateway/client/main.go index 69bb35d3..3a111190 100644 --- a/example/client/stovepipe/main.go +++ b/example/stovepipe/gateway/client/main.go @@ -21,13 +21,13 @@ import ( "os" "time" - pb "github.com/uber/submitqueue/stovepipe/protopb" + pb "github.com/uber/submitqueue/stovepipe/gateway/protopb" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) func main() { - addr := flag.String("addr", "localhost:8083", "stovepipe server address") + addr := flag.String("addr", "localhost:8083", "stovepipe gateway server address") message := flag.String("message", "", "message to send in ping request") timeout := flag.Duration("timeout", 5*time.Second, "request timeout") flag.Parse() @@ -50,7 +50,7 @@ func run(addr, message string, timeout time.Duration) error { defer conn.Close() // Create a client - client := pb.NewSubmitQueueStovepipeClient(conn) + client := pb.NewStovepipeGatewayClient(conn) // Create context with timeout ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -61,7 +61,7 @@ func run(addr, message string, timeout time.Duration) error { Message: message, } - fmt.Printf("Sending ping to stovepipe at %s...\n", addr) + fmt.Printf("Sending ping to stovepipe gateway at %s...\n", addr) resp, err := client.Ping(ctx, req) if err != nil { return fmt.Errorf("ping failed: %w", err) diff --git a/example/server/stovepipe/BUILD.bazel b/example/stovepipe/gateway/server/BUILD.bazel similarity index 65% rename from example/server/stovepipe/BUILD.bazel rename to example/stovepipe/gateway/server/BUILD.bazel index a8c8b830..d0334013 100644 --- a/example/server/stovepipe/BUILD.bazel +++ b/example/stovepipe/gateway/server/BUILD.bazel @@ -6,13 +6,13 @@ exports_files( ) go_library( - name = "stovepipe_lib", + name = "gateway_server_lib", srcs = ["main.go"], - importpath = "github.com/uber/submitqueue/example/server/stovepipe", + importpath = "github.com/uber/submitqueue/example/stovepipe/gateway/server", visibility = ["//visibility:private"], deps = [ - "//stovepipe/controller", - "//stovepipe/protopb", + "//stovepipe/gateway/controller", + "//stovepipe/gateway/protopb", "@com_github_uber_go_tally_v4//:tally", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//reflection", @@ -21,7 +21,7 @@ go_library( ) go_binary( - name = "stovepipe", - embed = [":stovepipe_lib"], + name = "gateway", + embed = [":gateway_server_lib"], visibility = ["//visibility:public"], ) diff --git a/example/stovepipe/gateway/server/Dockerfile b/example/stovepipe/gateway/server/Dockerfile new file mode 100644 index 00000000..310fbb55 --- /dev/null +++ b/example/stovepipe/gateway/server/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:bookworm-slim + +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* +WORKDIR /root/ + +# Copy pre-built Linux binary (host path is stovepipe-* to avoid clobbering main .docker-bin/gateway). +# Built via: make build-stovepipe-gateway-linux +COPY .docker-bin/stovepipe-gateway ./gateway + +# Reuse SubmitQueue sample queue YAML; compose sets QUEUE_CONFIG_PATH for parity with main gateway image. +COPY example/server/gateway/queues.yaml ./queues.yaml + +EXPOSE 8080 + +CMD ["./gateway"] diff --git a/example/stovepipe/gateway/server/docker-compose.yml b/example/stovepipe/gateway/server/docker-compose.yml new file mode 100644 index 00000000..e847e253 --- /dev/null +++ b/example/stovepipe/gateway/server/docker-compose.yml @@ -0,0 +1,68 @@ +# Docker Compose for Stovepipe gateway manual testing +# +# Mirrors example/server/gateway/docker-compose.yml: same MySQL pair, healthchecks, +# env wiring, and startup ordering. The Stovepipe gateway binary is Ping-only today +# and does not open MySQL yet; variables are set so future work matches SubmitQueue. +# +# IMPORTANT: Before running compose, build the Linux binary: +# make build-stovepipe-gateway-linux +# OR +# bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //example/stovepipe/gateway/server:gateway +# +# Quick start: +# make local-stovepipe-gateway-start +# +# After `up`, only the queue schema is applied (`local-init-stovepipe-queue-schema`). + +services: + # Application Database - Stores business data (requests, counters, etc.) + mysql-app: + image: mysql:8.0 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: submitqueue + ports: + - "3306" # Random ephemeral port to avoid conflicts + healthcheck: + # Use 127.0.0.1 (TCP) instead of localhost (Unix socket). MySQL treats + # "localhost" as a socket connection, which can be ready before the TCP + # listener β€” causing dependent services that connect over TCP to fail. + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-proot"] + interval: 5s + timeout: 5s + retries: 10 + + # Queue Database - Messaging infrastructure (messages, offsets, partition leases) + # Separate from app DB to demonstrate queue is pluggable infrastructure + mysql-queue: + image: mysql:8.0 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: submitqueue + ports: + - "3306" # Random ephemeral port to avoid conflicts + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-proot"] + interval: 5s + timeout: 5s + retries: 10 + + stovepipe-service: + build: + context: ${REPO_ROOT} + dockerfile: example/stovepipe/gateway/server/Dockerfile + ports: + - "8080" # Random ephemeral port to avoid conflicts + environment: + - PORT=:8080 + # Application database connection + - MYSQL_DSN=root:root@tcp(mysql-app:3306)/submitqueue?parseTime=true + # Queue infrastructure connection (separate database) + - QUEUE_MYSQL_DSN=root:root@tcp(mysql-queue:3306)/submitqueue?parseTime=true + # Path to YAML queue configuration baked into the image + - QUEUE_CONFIG_PATH=/root/queues.yaml + depends_on: + mysql-app: + condition: service_healthy + mysql-queue: + condition: service_healthy diff --git a/example/server/stovepipe/main.go b/example/stovepipe/gateway/server/main.go similarity index 81% rename from example/server/stovepipe/main.go rename to example/stovepipe/gateway/server/main.go index 8cdbb9e1..88428b3b 100644 --- a/example/server/stovepipe/main.go +++ b/example/stovepipe/gateway/server/main.go @@ -26,21 +26,21 @@ import ( "time" "github.com/uber-go/tally/v4" - "github.com/uber/submitqueue/stovepipe/controller" - pb "github.com/uber/submitqueue/stovepipe/protopb" + "github.com/uber/submitqueue/stovepipe/gateway/controller" + pb "github.com/uber/submitqueue/stovepipe/gateway/protopb" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) -// StovepipeServer wraps the controller and implements the gRPC service interface -type StovepipeServer struct { - pb.UnimplementedSubmitQueueStovepipeServer +// GatewayServer wraps the controller and implements the gRPC service interface. +type GatewayServer struct { + pb.UnimplementedStovepipeGatewayServer pingController *controller.PingController } -// Ping delegates to the controller -func (s *StovepipeServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error) { +// Ping delegates to the controller. +func (s *GatewayServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error) { return s.pingController.Ping(ctx, req) } @@ -48,13 +48,13 @@ func main() { code := 0 if err := run(); err != nil { if errors.Is(err, context.Canceled) { - fmt.Println("Stovepipe server stopped by signal") + fmt.Println("Stovepipe gateway server stopped by signal") // Return 143 (128 + SIGTERM) as per POSIX standard if the application receives any termination signal from the OS. Ideally we should return 128+SIGINT for SIGINT and 128+SIGTERM for SIGTERM, // but it will require a special processing not yet available in the standard library. code = 128 + int(syscall.SIGTERM) } else { - fmt.Fprintf(os.Stderr, "Stovepipe server failure: %v\n", err) + fmt.Fprintf(os.Stderr, "Stovepipe gateway server failure: %v\n", err) // TODO: classify errors and implement a binary protocol for exit codes, so far 1 for everything code = 1 } @@ -75,7 +75,7 @@ func run() error { defer logger.Sync() // Initialize metrics scope - scope := tally.NewTestScope("stovepipe", nil) + scope := tally.NewTestScope("stovepipe_gateway", nil) metricsStopCh := make(chan interface{}, 1) metricsWgDone := sync.WaitGroup{} metricsWgDone.Add(1) @@ -110,10 +110,10 @@ func run() error { // Create ping controller and wrap it for gRPC pingController := controller.NewPingController(logger, scope) - stovepipeServer := &StovepipeServer{ + srv := &GatewayServer{ pingController: pingController, } - pb.RegisterSubmitQueueStovepipeServer(grpcServer, stovepipeServer) + pb.RegisterStovepipeGatewayServer(grpcServer, srv) // Register reflection service for debugging with grpcurl reflection.Register(grpcServer) @@ -128,7 +128,7 @@ func run() error { return fmt.Errorf("failed to listen on port %s: %w", port, err) } - fmt.Printf("Stovepipe gRPC server is running on %s\n", port) + fmt.Printf("Stovepipe gateway gRPC server is running on %s\n", port) fmt.Println("Press Ctrl+C to stop, or send a SIGTERM.") // Start server in a goroutine and wait for it to finish @@ -143,7 +143,7 @@ func run() error { var serverErr error select { case <-ctx.Done(): - fmt.Println("Shutting down stovepipe server due to interruption signal...") + fmt.Println("Shutting down stovepipe gateway server due to interruption signal...") // Set the error to the context cancellation error to be surfaced as a desired exit code by the main function // to indicate that the server was stopped as intended @@ -154,7 +154,7 @@ func run() error { grpcServer.GracefulStop() serverErr = <-serverErrCh case serverErr = <-serverErrCh: - fmt.Println("Shutting down stovepipe server due to critical GRPC server error...") + fmt.Println("Shutting down stovepipe gateway server due to critical GRPC server error...") } if serverErr != nil { diff --git a/stovepipe/README.md b/stovepipe/README.md index fb922823..8628ef0f 100644 --- a/stovepipe/README.md +++ b/stovepipe/README.md @@ -1 +1,7 @@ -SubmitQueue Stovepipe +# Stovepipe + +Stovepipe service layout: + +- `gateway/` β€” RPC surface, gateway controllers, and generated protobufs +- `extension/` β€” Stovepipe-specific extension implementations +- `entity/` β€” Stovepipe-specific domain entities diff --git a/stovepipe/entity/BUILD.bazel b/stovepipe/entity/BUILD.bazel new file mode 100644 index 00000000..c179fb43 --- /dev/null +++ b/stovepipe/entity/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "entity", + srcs = ["entity.go"], + importpath = "github.com/uber/submitqueue/stovepipe/entity", + visibility = ["//visibility:public"], +) diff --git a/stovepipe/entity/entity.go b/stovepipe/entity/entity.go new file mode 100644 index 00000000..15ac8680 --- /dev/null +++ b/stovepipe/entity/entity.go @@ -0,0 +1,16 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package entity holds Stovepipe-specific domain types (distinct from shared repo entity/). +package entity diff --git a/stovepipe/extension/BUILD.bazel b/stovepipe/extension/BUILD.bazel new file mode 100644 index 00000000..bbf4f83b --- /dev/null +++ b/stovepipe/extension/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "extension", + srcs = ["extension.go"], + importpath = "github.com/uber/submitqueue/stovepipe/extension", + visibility = ["//visibility:public"], +) diff --git a/stovepipe/extension/extension.go b/stovepipe/extension/extension.go new file mode 100644 index 00000000..92d4bcea --- /dev/null +++ b/stovepipe/extension/extension.go @@ -0,0 +1,16 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package extension holds Stovepipe-specific extension implementations. +package extension diff --git a/stovepipe/controller/BUILD.bazel b/stovepipe/gateway/controller/BUILD.bazel similarity index 79% rename from stovepipe/controller/BUILD.bazel rename to stovepipe/gateway/controller/BUILD.bazel index 685b0c20..1fed7fd4 100644 --- a/stovepipe/controller/BUILD.bazel +++ b/stovepipe/gateway/controller/BUILD.bazel @@ -3,11 +3,11 @@ load("@rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "controller", srcs = ["ping.go"], - importpath = "github.com/uber/submitqueue/stovepipe/controller", + importpath = "github.com/uber/submitqueue/stovepipe/gateway/controller", visibility = ["//visibility:public"], deps = [ "//core/metrics", - "//stovepipe/protopb", + "//stovepipe/gateway/protopb", "@com_github_uber_go_tally_v4//:tally", "@org_uber_go_zap//:zap", ], @@ -18,7 +18,7 @@ go_test( srcs = ["ping_test.go"], embed = [":controller"], deps = [ - "//stovepipe/protopb", + "//stovepipe/gateway/protopb", "@com_github_stretchr_testify//assert", "@com_github_stretchr_testify//require", "@com_github_uber_go_tally_v4//:tally", diff --git a/stovepipe/controller/ping.go b/stovepipe/gateway/controller/ping.go similarity index 95% rename from stovepipe/controller/ping.go rename to stovepipe/gateway/controller/ping.go index 41d216d4..f76b7477 100644 --- a/stovepipe/controller/ping.go +++ b/stovepipe/gateway/controller/ping.go @@ -21,7 +21,7 @@ import ( "github.com/uber-go/tally/v4" "github.com/uber/submitqueue/core/metrics" - pb "github.com/uber/submitqueue/stovepipe/protopb" + pb "github.com/uber/submitqueue/stovepipe/gateway/protopb" "go.uber.org/zap" ) @@ -64,7 +64,7 @@ func (c *PingController) Ping(ctx context.Context, req *pb.PingRequest) (resp *p return &pb.PingResponse{ Message: message, - ServiceName: "stovepipe", + ServiceName: "stovepipe-gateway", Timestamp: time.Now().Unix(), Hostname: hostname, }, nil diff --git a/stovepipe/controller/ping_test.go b/stovepipe/gateway/controller/ping_test.go similarity index 95% rename from stovepipe/controller/ping_test.go rename to stovepipe/gateway/controller/ping_test.go index ee628c27..88f3f13f 100644 --- a/stovepipe/controller/ping_test.go +++ b/stovepipe/gateway/controller/ping_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally/v4" - pb "github.com/uber/submitqueue/stovepipe/protopb" + pb "github.com/uber/submitqueue/stovepipe/gateway/protopb" "go.uber.org/zap" ) @@ -75,7 +75,7 @@ func TestPing_ServiceName(t *testing.T) { resp, err := controller.Ping(ctx, req) require.NoError(t, err) - assert.Equal(t, "stovepipe", resp.ServiceName) + assert.Equal(t, "stovepipe-gateway", resp.ServiceName) } func TestPing_Timestamp(t *testing.T) { diff --git a/stovepipe/proto/BUILD.bazel b/stovepipe/gateway/proto/BUILD.bazel similarity index 56% rename from stovepipe/proto/BUILD.bazel rename to stovepipe/gateway/proto/BUILD.bazel index 6d93c5c3..7019f19d 100644 --- a/stovepipe/proto/BUILD.bazel +++ b/stovepipe/gateway/proto/BUILD.bazel @@ -3,33 +3,33 @@ load("@rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( - name = "stovepipepb_proto", - srcs = ["stovepipe.proto"], + name = "gatewaypb_proto", + srcs = ["gateway.proto"], visibility = ["//visibility:public"], ) # keep go_proto_library( - name = "stovepipepb_go_proto", + name = "gatewaypb_go_proto", compilers = [ "@rules_go//proto:go_proto", "@rules_go//proto:go_grpc_v2", ], - importpath = "github.com/uber/submitqueue/stovepipe/proto", - proto = ":stovepipepb_proto", + importpath = "github.com/uber/submitqueue/stovepipe/gateway/proto", + proto = ":gatewaypb_proto", visibility = ["//visibility:public"], ) go_library( name = "proto", - embed = [":stovepipepb_go_proto"], - importpath = "github.com/uber/submitqueue/stovepipe/proto", + embed = [":gatewaypb_go_proto"], + importpath = "github.com/uber/submitqueue/stovepipe/gateway/proto", visibility = ["//visibility:public"], ) go_library( name = "protopb", - embed = [":stovepipepb_go_proto"], - importpath = "github.com/uber/submitqueue/stovepipe/protopb", + embed = [":gatewaypb_go_proto"], + importpath = "github.com/uber/submitqueue/stovepipe/gateway/protopb", visibility = ["//visibility:public"], ) diff --git a/stovepipe/proto/stovepipe.proto b/stovepipe/gateway/proto/gateway.proto similarity index 86% rename from stovepipe/proto/stovepipe.proto rename to stovepipe/gateway/proto/gateway.proto index 3b8eec71..37b8cd46 100644 --- a/stovepipe/proto/stovepipe.proto +++ b/stovepipe/gateway/proto/gateway.proto @@ -16,9 +16,9 @@ syntax = "proto3"; package uber.submitqueue.stovepipe; -option go_package = "github.com/uber/submitqueue/stovepipe/protopb"; +option go_package = "github.com/uber/submitqueue/stovepipe/gateway/protopb"; option java_multiple_files = true; -option java_outer_classname = "StovepipeProto"; +option java_outer_classname = "GatewayProto"; option java_package = "com.uber.submitqueue.stovepipe"; // PingRequest is the request for the Ping method @@ -39,8 +39,8 @@ message PingResponse { string hostname = 4; } -// SubmitQueueStovepipe provides the stovepipe API -service SubmitQueueStovepipe { +// StovepipeGateway provides the Stovepipe gateway API. +service StovepipeGateway { // Ping returns a response indicating the service is alive rpc Ping(PingRequest) returns (PingResponse) {} } diff --git a/stovepipe/protopb/BUILD.bazel b/stovepipe/gateway/protopb/BUILD.bazel similarity index 82% rename from stovepipe/protopb/BUILD.bazel rename to stovepipe/gateway/protopb/BUILD.bazel index aca68418..7f54b03f 100644 --- a/stovepipe/protopb/BUILD.bazel +++ b/stovepipe/gateway/protopb/BUILD.bazel @@ -3,11 +3,11 @@ load("@rules_go//go:def.bzl", "go_library") go_library( name = "protopb", srcs = [ - "stovepipe.pb.go", - "stovepipe.pb.yarpc.go", - "stovepipe_grpc.pb.go", + "gateway.pb.go", + "gateway.pb.yarpc.go", + "gateway_grpc.pb.go", ], - importpath = "github.com/uber/submitqueue/stovepipe/protopb", + importpath = "github.com/uber/submitqueue/stovepipe/gateway/protopb", visibility = ["//visibility:public"], deps = [ "@com_github_gogo_protobuf//jsonpb", diff --git a/stovepipe/protopb/stovepipe.pb.go b/stovepipe/gateway/protopb/gateway.pb.go similarity index 71% rename from stovepipe/protopb/stovepipe.pb.go rename to stovepipe/gateway/protopb/gateway.pb.go index 16b936d6..5ebb3b61 100644 --- a/stovepipe/protopb/stovepipe.pb.go +++ b/stovepipe/gateway/protopb/gateway.pb.go @@ -15,18 +15,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.10 -// protoc v5.29.3 -// source: stovepipe.proto +// protoc v5.27.3 +// source: gateway.proto package protopb import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -47,7 +46,7 @@ type PingRequest struct { func (x *PingRequest) Reset() { *x = PingRequest{} - mi := &file_stovepipe_proto_msgTypes[0] + mi := &file_gateway_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -59,7 +58,7 @@ func (x *PingRequest) String() string { func (*PingRequest) ProtoMessage() {} func (x *PingRequest) ProtoReflect() protoreflect.Message { - mi := &file_stovepipe_proto_msgTypes[0] + mi := &file_gateway_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72,7 +71,7 @@ func (x *PingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PingRequest.ProtoReflect.Descriptor instead. func (*PingRequest) Descriptor() ([]byte, []int) { - return file_stovepipe_proto_rawDescGZIP(), []int{0} + return file_gateway_proto_rawDescGZIP(), []int{0} } func (x *PingRequest) GetMessage() string { @@ -99,7 +98,7 @@ type PingResponse struct { func (x *PingResponse) Reset() { *x = PingResponse{} - mi := &file_stovepipe_proto_msgTypes[1] + mi := &file_gateway_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111,7 +110,7 @@ func (x *PingResponse) String() string { func (*PingResponse) ProtoMessage() {} func (x *PingResponse) ProtoReflect() protoreflect.Message { - mi := &file_stovepipe_proto_msgTypes[1] + mi := &file_gateway_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -124,7 +123,7 @@ func (x *PingResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PingResponse.ProtoReflect.Descriptor instead. func (*PingResponse) Descriptor() ([]byte, []int) { - return file_stovepipe_proto_rawDescGZIP(), []int{1} + return file_gateway_proto_rawDescGZIP(), []int{1} } func (x *PingResponse) GetMessage() string { @@ -155,42 +154,42 @@ func (x *PingResponse) GetHostname() string { return "" } -var File_stovepipe_proto protoreflect.FileDescriptor +var File_gateway_proto protoreflect.FileDescriptor -const file_stovepipe_proto_rawDesc = "" + +const file_gateway_proto_rawDesc = "" + "\n" + - "\x0fstovepipe.proto\x12\x1auber.submitqueue.stovepipe\"'\n" + + "\rgateway.proto\x12\x1auber.submitqueue.stovepipe\"'\n" + "\vPingRequest\x12\x18\n" + "\amessage\x18\x01 \x01(\tR\amessage\"\x85\x01\n" + "\fPingResponse\x12\x18\n" + "\amessage\x18\x01 \x01(\tR\amessage\x12!\n" + "\fservice_name\x18\x02 \x01(\tR\vserviceName\x12\x1c\n" + "\ttimestamp\x18\x03 \x01(\x03R\ttimestamp\x12\x1a\n" + - "\bhostname\x18\x04 \x01(\tR\bhostname2s\n" + - "\x14SubmitQueueStovepipe\x12[\n" + - "\x04Ping\x12'.uber.submitqueue.stovepipe.PingRequest\x1a(.uber.submitqueue.stovepipe.PingResponse\"\x00Ba\n" + - "\x1ecom.uber.submitqueue.stovepipeB\x0eStovepipeProtoP\x01Z-github.com/uber/submitqueue/stovepipe/protopbb\x06proto3" + "\bhostname\x18\x04 \x01(\tR\bhostname2o\n" + + "\x10StovepipeGateway\x12[\n" + + "\x04Ping\x12'.uber.submitqueue.stovepipe.PingRequest\x1a(.uber.submitqueue.stovepipe.PingResponse\"\x00Bg\n" + + "\x1ecom.uber.submitqueue.stovepipeB\fGatewayProtoP\x01Z5github.com/uber/submitqueue/stovepipe/gateway/protopbb\x06proto3" var ( - file_stovepipe_proto_rawDescOnce sync.Once - file_stovepipe_proto_rawDescData []byte + file_gateway_proto_rawDescOnce sync.Once + file_gateway_proto_rawDescData []byte ) -func file_stovepipe_proto_rawDescGZIP() []byte { - file_stovepipe_proto_rawDescOnce.Do(func() { - file_stovepipe_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_stovepipe_proto_rawDesc), len(file_stovepipe_proto_rawDesc))) +func file_gateway_proto_rawDescGZIP() []byte { + file_gateway_proto_rawDescOnce.Do(func() { + file_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gateway_proto_rawDesc), len(file_gateway_proto_rawDesc))) }) - return file_stovepipe_proto_rawDescData + return file_gateway_proto_rawDescData } -var file_stovepipe_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_stovepipe_proto_goTypes = []any{ +var file_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_gateway_proto_goTypes = []any{ (*PingRequest)(nil), // 0: uber.submitqueue.stovepipe.PingRequest (*PingResponse)(nil), // 1: uber.submitqueue.stovepipe.PingResponse } -var file_stovepipe_proto_depIdxs = []int32{ - 0, // 0: uber.submitqueue.stovepipe.SubmitQueueStovepipe.Ping:input_type -> uber.submitqueue.stovepipe.PingRequest - 1, // 1: uber.submitqueue.stovepipe.SubmitQueueStovepipe.Ping:output_type -> uber.submitqueue.stovepipe.PingResponse +var file_gateway_proto_depIdxs = []int32{ + 0, // 0: uber.submitqueue.stovepipe.StovepipeGateway.Ping:input_type -> uber.submitqueue.stovepipe.PingRequest + 1, // 1: uber.submitqueue.stovepipe.StovepipeGateway.Ping:output_type -> uber.submitqueue.stovepipe.PingResponse 1, // [1:2] is the sub-list for method output_type 0, // [0:1] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -198,26 +197,26 @@ var file_stovepipe_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_stovepipe_proto_init() } -func file_stovepipe_proto_init() { - if File_stovepipe_proto != nil { +func init() { file_gateway_proto_init() } +func file_gateway_proto_init() { + if File_gateway_proto != nil { return } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_stovepipe_proto_rawDesc), len(file_stovepipe_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_gateway_proto_rawDesc), len(file_gateway_proto_rawDesc)), NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_stovepipe_proto_goTypes, - DependencyIndexes: file_stovepipe_proto_depIdxs, - MessageInfos: file_stovepipe_proto_msgTypes, + GoTypes: file_gateway_proto_goTypes, + DependencyIndexes: file_gateway_proto_depIdxs, + MessageInfos: file_gateway_proto_msgTypes, }.Build() - File_stovepipe_proto = out.File - file_stovepipe_proto_goTypes = nil - file_stovepipe_proto_depIdxs = nil + File_gateway_proto = out.File + file_gateway_proto_goTypes = nil + file_gateway_proto_depIdxs = nil } diff --git a/stovepipe/gateway/protopb/gateway.pb.yarpc.go b/stovepipe/gateway/protopb/gateway.pb.yarpc.go new file mode 100644 index 00000000..260f73aa --- /dev/null +++ b/stovepipe/gateway/protopb/gateway.pb.yarpc.go @@ -0,0 +1,262 @@ +// Code generated by protoc-gen-yarpc-go. DO NOT EDIT. +// source: gateway.proto + +package protopb + +import ( + "context" + "io/ioutil" + "reflect" + + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + "go.uber.org/fx" + "go.uber.org/yarpc" + "go.uber.org/yarpc/api/transport" + "go.uber.org/yarpc/api/x/restriction" + "go.uber.org/yarpc/encoding/protobuf" + "go.uber.org/yarpc/encoding/protobuf/reflection" +) + +var _ = ioutil.NopCloser + +// StovepipeGatewayYARPCClient is the YARPC client-side interface for the StovepipeGateway service. +type StovepipeGatewayYARPCClient interface { + Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) +} + +func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) StovepipeGatewayYARPCClient { + return &_StovepipeGatewayYARPCCaller{protobuf.NewStreamClient( + protobuf.ClientParams{ + ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", + ClientConfig: clientConfig, + AnyResolver: anyResolver, + Options: options, + }, + )} +} + +// NewStovepipeGatewayYARPCClient builds a new YARPC client for the StovepipeGateway service. +func NewStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) StovepipeGatewayYARPCClient { + return newStovepipeGatewayYARPCClient(clientConfig, nil, options...) +} + +// StovepipeGatewayYARPCServer is the YARPC server-side interface for the StovepipeGateway service. +type StovepipeGatewayYARPCServer interface { + Ping(context.Context, *PingRequest) (*PingResponse, error) +} + +type buildStovepipeGatewayYARPCProceduresParams struct { + Server StovepipeGatewayYARPCServer + AnyResolver jsonpb.AnyResolver +} + +func buildStovepipeGatewayYARPCProcedures(params buildStovepipeGatewayYARPCProceduresParams) []transport.Procedure { + handler := &_StovepipeGatewayYARPCHandler{params.Server} + return protobuf.BuildProcedures( + protobuf.BuildProceduresParams{ + ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", + UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + { + MethodName: "Ping", + Handler: protobuf.NewUnaryHandler( + protobuf.UnaryHandlerParams{ + Handle: handler.Ping, + NewRequest: newStovepipeGatewayServicePingYARPCRequest, + AnyResolver: params.AnyResolver, + }, + ), + }, + }, + OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + }, + ) +} + +// BuildStovepipeGatewayYARPCProcedures prepares an implementation of the StovepipeGateway service for YARPC registration. +func BuildStovepipeGatewayYARPCProcedures(server StovepipeGatewayYARPCServer) []transport.Procedure { + return buildStovepipeGatewayYARPCProcedures(buildStovepipeGatewayYARPCProceduresParams{Server: server}) +} + +// FxStovepipeGatewayYARPCClientParams defines the input +// for NewFxStovepipeGatewayYARPCClient. It provides the +// paramaters to get a StovepipeGatewayYARPCClient in an +// Fx application. +type FxStovepipeGatewayYARPCClientParams struct { + fx.In + + Provider yarpc.ClientConfig + AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + Restriction restriction.Checker `optional:"true"` +} + +// FxStovepipeGatewayYARPCClientResult defines the output +// of NewFxStovepipeGatewayYARPCClient. It provides a +// StovepipeGatewayYARPCClient to an Fx application. +type FxStovepipeGatewayYARPCClientResult struct { + fx.Out + + Client StovepipeGatewayYARPCClient + + // We are using an fx.Out struct here instead of just returning a client + // so that we can add more values or add named versions of the client in + // the future without breaking any existing code. +} + +// NewFxStovepipeGatewayYARPCClient provides a StovepipeGatewayYARPCClient +// to an Fx application using the given name for routing. +// +// fx.Provide( +// protopb.NewFxStovepipeGatewayYARPCClient("service-name"), +// ... +// ) +func NewFxStovepipeGatewayYARPCClient(name string, options ...protobuf.ClientOption) interface{} { + return func(params FxStovepipeGatewayYARPCClientParams) FxStovepipeGatewayYARPCClientResult { + cc := params.Provider.ClientConfig(name) + + if params.Restriction != nil { + if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { + if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + panic(err.Error()) + } + } + } + + return FxStovepipeGatewayYARPCClientResult{ + Client: newStovepipeGatewayYARPCClient(cc, params.AnyResolver, options...), + } + } +} + +// FxStovepipeGatewayYARPCProceduresParams defines the input +// for NewFxStovepipeGatewayYARPCProcedures. It provides the +// paramaters to get StovepipeGatewayYARPCServer procedures in an +// Fx application. +type FxStovepipeGatewayYARPCProceduresParams struct { + fx.In + + Server StovepipeGatewayYARPCServer + AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` +} + +// FxStovepipeGatewayYARPCProceduresResult defines the output +// of NewFxStovepipeGatewayYARPCProcedures. It provides +// StovepipeGatewayYARPCServer procedures to an Fx application. +// +// The procedures are provided to the "yarpcfx" value group. +// Dig 1.2 or newer must be used for this feature to work. +type FxStovepipeGatewayYARPCProceduresResult struct { + fx.Out + + Procedures []transport.Procedure `group:"yarpcfx"` + ReflectionMeta reflection.ServerMeta `group:"yarpcfx"` +} + +// NewFxStovepipeGatewayYARPCProcedures provides StovepipeGatewayYARPCServer procedures to an Fx application. +// It expects a StovepipeGatewayYARPCServer to be present in the container. +// +// fx.Provide( +// protopb.NewFxStovepipeGatewayYARPCProcedures(), +// ... +// ) +func NewFxStovepipeGatewayYARPCProcedures() interface{} { + return func(params FxStovepipeGatewayYARPCProceduresParams) FxStovepipeGatewayYARPCProceduresResult { + return FxStovepipeGatewayYARPCProceduresResult{ + Procedures: buildStovepipeGatewayYARPCProcedures(buildStovepipeGatewayYARPCProceduresParams{ + Server: params.Server, + AnyResolver: params.AnyResolver, + }), + ReflectionMeta: StovepipeGatewayReflectionMeta, + } + } +} + +// StovepipeGatewayReflectionMeta is the reflection server metadata +// required for using the gRPC reflection protocol with YARPC. +// +// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. +var StovepipeGatewayReflectionMeta = reflection.ServerMeta{ + ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", + FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, +} + +type _StovepipeGatewayYARPCCaller struct { + streamClient protobuf.StreamClient +} + +func (c *_StovepipeGatewayYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { + responseMessage, err := c.streamClient.Call(ctx, "Ping", request, newStovepipeGatewayServicePingYARPCResponse, options...) + if responseMessage == nil { + return nil, err + } + response, ok := responseMessage.(*PingResponse) + if !ok { + return nil, protobuf.CastError(emptyStovepipeGatewayServicePingYARPCResponse, responseMessage) + } + return response, err +} + +type _StovepipeGatewayYARPCHandler struct { + server StovepipeGatewayYARPCServer +} + +func (h *_StovepipeGatewayYARPCHandler) Ping(ctx context.Context, requestMessage proto.Message) (proto.Message, error) { + var request *PingRequest + var ok bool + if requestMessage != nil { + request, ok = requestMessage.(*PingRequest) + if !ok { + return nil, protobuf.CastError(emptyStovepipeGatewayServicePingYARPCRequest, requestMessage) + } + } + response, err := h.server.Ping(ctx, request) + if response == nil { + return nil, err + } + return response, err +} + +func newStovepipeGatewayServicePingYARPCRequest() proto.Message { + return &PingRequest{} +} + +func newStovepipeGatewayServicePingYARPCResponse() proto.Message { + return &PingResponse{} +} + +var ( + emptyStovepipeGatewayServicePingYARPCRequest = &PingRequest{} + emptyStovepipeGatewayServicePingYARPCResponse = &PingResponse{} +) + +var yarpcFileDescriptorClosuref1a937782ebbded5 = [][]byte{ + // gateway.proto + []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0x31, 0x4f, 0xc3, 0x30, + 0x10, 0x85, 0x09, 0xad, 0x80, 0x5e, 0x8b, 0x84, 0x3c, 0x45, 0x11, 0x42, 0x25, 0x4b, 0x33, 0x39, + 0x12, 0x88, 0x3f, 0xd0, 0x85, 0x0d, 0x45, 0x61, 0x83, 0x01, 0xd9, 0xd1, 0xc9, 0xf5, 0xe0, 0xd8, + 0xcd, 0xd9, 0x45, 0xfc, 0x00, 0xfe, 0x37, 0x8a, 0x93, 0x96, 0x2e, 0x85, 0xcd, 0x77, 0x7e, 0x9f, + 0xf4, 0xde, 0x3d, 0xb8, 0x56, 0xc2, 0xe3, 0xa7, 0xf8, 0xe2, 0xae, 0xb3, 0xde, 0xb2, 0x2c, 0x48, + 0xec, 0x38, 0x05, 0x69, 0xb4, 0xdf, 0x06, 0x0c, 0xc8, 0xc9, 0xdb, 0x1d, 0x3a, 0xed, 0x30, 0x5f, + 0xc1, 0xbc, 0xd2, 0xad, 0xaa, 0x71, 0x1b, 0x90, 0x3c, 0x4b, 0xe1, 0xd2, 0x20, 0x91, 0x50, 0x98, + 0x26, 0xcb, 0xa4, 0x98, 0xd5, 0xfb, 0x31, 0xff, 0x4e, 0x60, 0x31, 0x28, 0xc9, 0xd9, 0x96, 0xf0, + 0xb4, 0x94, 0xdd, 0xc3, 0x82, 0xb0, 0xdb, 0xe9, 0x06, 0x3f, 0x5a, 0x61, 0x30, 0x3d, 0x8f, 0xdf, + 0xf3, 0x71, 0xf7, 0x22, 0x0c, 0xb2, 0x5b, 0x98, 0x79, 0x6d, 0x90, 0xbc, 0x30, 0x2e, 0x9d, 0x2c, + 0x93, 0x62, 0x52, 0xff, 0x2e, 0x58, 0x06, 0x57, 0x1b, 0x4b, 0x3e, 0xc2, 0xd3, 0x08, 0x1f, 0xe6, + 0x07, 0x0b, 0x37, 0xaf, 0x7b, 0xf7, 0xcf, 0x43, 0x4c, 0xf6, 0x0e, 0xd3, 0xde, 0x1a, 0x5b, 0xf1, + 0xd3, 0x49, 0xf9, 0x51, 0xcc, 0xac, 0xf8, 0x5f, 0x38, 0xa4, 0xcc, 0xcf, 0xd6, 0x0a, 0xee, 0x1a, + 0x6b, 0xfe, 0x00, 0xd6, 0x8b, 0xd1, 0x47, 0xd5, 0x5f, 0xbb, 0x4a, 0xde, 0x9e, 0x94, 0xf6, 0x9b, + 0x20, 0x79, 0x63, 0x4d, 0xd9, 0x63, 0xe5, 0x11, 0x56, 0x1e, 0xb0, 0x72, 0x2c, 0xa9, 0x8c, 0x25, + 0x39, 0x29, 0x2f, 0xe2, 0xe3, 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7d, 0xbf, 0xec, 0xe5, 0xbe, + 0x01, 0x00, 0x00, + }, +} + +func init() { + yarpc.RegisterClientBuilder( + func(clientConfig transport.ClientConfig, structField reflect.StructField) StovepipeGatewayYARPCClient { + return NewStovepipeGatewayYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + }, + ) +} diff --git a/stovepipe/protopb/stovepipe_grpc.pb.go b/stovepipe/gateway/protopb/gateway_grpc.pb.go similarity index 52% rename from stovepipe/protopb/stovepipe_grpc.pb.go rename to stovepipe/gateway/protopb/gateway_grpc.pb.go index 2bbce1bc..2fb64d46 100644 --- a/stovepipe/protopb/stovepipe_grpc.pb.go +++ b/stovepipe/gateway/protopb/gateway_grpc.pb.go @@ -15,14 +15,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.29.3 -// source: stovepipe.proto +// - protoc v5.27.3 +// source: gateway.proto package protopb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -34,109 +33,109 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - SubmitQueueStovepipe_Ping_FullMethodName = "/uber.submitqueue.stovepipe.SubmitQueueStovepipe/Ping" + StovepipeGateway_Ping_FullMethodName = "/uber.submitqueue.stovepipe.StovepipeGateway/Ping" ) -// SubmitQueueStovepipeClient is the client API for SubmitQueueStovepipe service. +// StovepipeGatewayClient is the client API for StovepipeGateway service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // -// SubmitQueueStovepipe provides the stovepipe API -type SubmitQueueStovepipeClient interface { +// StovepipeGateway provides the Stovepipe gateway API. +type StovepipeGatewayClient interface { // Ping returns a response indicating the service is alive Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) } -type submitQueueStovepipeClient struct { +type stovepipeGatewayClient struct { cc grpc.ClientConnInterface } -func NewSubmitQueueStovepipeClient(cc grpc.ClientConnInterface) SubmitQueueStovepipeClient { - return &submitQueueStovepipeClient{cc} +func NewStovepipeGatewayClient(cc grpc.ClientConnInterface) StovepipeGatewayClient { + return &stovepipeGatewayClient{cc} } -func (c *submitQueueStovepipeClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { +func (c *stovepipeGatewayClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PingResponse) - err := c.cc.Invoke(ctx, SubmitQueueStovepipe_Ping_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, StovepipeGateway_Ping_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// SubmitQueueStovepipeServer is the server API for SubmitQueueStovepipe service. -// All implementations must embed UnimplementedSubmitQueueStovepipeServer +// StovepipeGatewayServer is the server API for StovepipeGateway service. +// All implementations must embed UnimplementedStovepipeGatewayServer // for forward compatibility. // -// SubmitQueueStovepipe provides the stovepipe API -type SubmitQueueStovepipeServer interface { +// StovepipeGateway provides the Stovepipe gateway API. +type StovepipeGatewayServer interface { // Ping returns a response indicating the service is alive Ping(context.Context, *PingRequest) (*PingResponse, error) - mustEmbedUnimplementedSubmitQueueStovepipeServer() + mustEmbedUnimplementedStovepipeGatewayServer() } -// UnimplementedSubmitQueueStovepipeServer must be embedded to have +// UnimplementedStovepipeGatewayServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedSubmitQueueStovepipeServer struct{} +type UnimplementedStovepipeGatewayServer struct{} -func (UnimplementedSubmitQueueStovepipeServer) Ping(context.Context, *PingRequest) (*PingResponse, error) { +func (UnimplementedStovepipeGatewayServer) Ping(context.Context, *PingRequest) (*PingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") } -func (UnimplementedSubmitQueueStovepipeServer) mustEmbedUnimplementedSubmitQueueStovepipeServer() {} -func (UnimplementedSubmitQueueStovepipeServer) testEmbeddedByValue() {} +func (UnimplementedStovepipeGatewayServer) mustEmbedUnimplementedStovepipeGatewayServer() {} +func (UnimplementedStovepipeGatewayServer) testEmbeddedByValue() {} -// UnsafeSubmitQueueStovepipeServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SubmitQueueStovepipeServer will +// UnsafeStovepipeGatewayServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StovepipeGatewayServer will // result in compilation errors. -type UnsafeSubmitQueueStovepipeServer interface { - mustEmbedUnimplementedSubmitQueueStovepipeServer() +type UnsafeStovepipeGatewayServer interface { + mustEmbedUnimplementedStovepipeGatewayServer() } -func RegisterSubmitQueueStovepipeServer(s grpc.ServiceRegistrar, srv SubmitQueueStovepipeServer) { - // If the following call pancis, it indicates UnimplementedSubmitQueueStovepipeServer was +func RegisterStovepipeGatewayServer(s grpc.ServiceRegistrar, srv StovepipeGatewayServer) { + // If the following call pancis, it indicates UnimplementedStovepipeGatewayServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&SubmitQueueStovepipe_ServiceDesc, srv) + s.RegisterService(&StovepipeGateway_ServiceDesc, srv) } -func _SubmitQueueStovepipe_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _StovepipeGateway_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PingRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SubmitQueueStovepipeServer).Ping(ctx, in) + return srv.(StovepipeGatewayServer).Ping(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: SubmitQueueStovepipe_Ping_FullMethodName, + FullMethod: StovepipeGateway_Ping_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SubmitQueueStovepipeServer).Ping(ctx, req.(*PingRequest)) + return srv.(StovepipeGatewayServer).Ping(ctx, req.(*PingRequest)) } return interceptor(ctx, in, info, handler) } -// SubmitQueueStovepipe_ServiceDesc is the grpc.ServiceDesc for SubmitQueueStovepipe service. +// StovepipeGateway_ServiceDesc is the grpc.ServiceDesc for StovepipeGateway service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var SubmitQueueStovepipe_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "uber.submitqueue.stovepipe.SubmitQueueStovepipe", - HandlerType: (*SubmitQueueStovepipeServer)(nil), +var StovepipeGateway_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", + HandlerType: (*StovepipeGatewayServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Ping", - Handler: _SubmitQueueStovepipe_Ping_Handler, + Handler: _StovepipeGateway_Ping_Handler, }, }, Streams: []grpc.StreamDesc{}, - Metadata: "stovepipe.proto", + Metadata: "gateway.proto", } diff --git a/stovepipe/protopb/stovepipe.pb.yarpc.go b/stovepipe/protopb/stovepipe.pb.yarpc.go deleted file mode 100644 index 795ba9cf..00000000 --- a/stovepipe/protopb/stovepipe.pb.yarpc.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by protoc-gen-yarpc-go. DO NOT EDIT. -// source: stovepipe.proto - -package protopb - -import ( - "context" - "io/ioutil" - "reflect" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" - "go.uber.org/fx" - "go.uber.org/yarpc" - "go.uber.org/yarpc/api/transport" - "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" - "go.uber.org/yarpc/encoding/protobuf/reflection" -) - -var _ = ioutil.NopCloser - -// SubmitQueueStovepipeYARPCClient is the YARPC client-side interface for the SubmitQueueStovepipe service. -type SubmitQueueStovepipeYARPCClient interface { - Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) -} - -func newSubmitQueueStovepipeYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) SubmitQueueStovepipeYARPCClient { - return &_SubmitQueueStovepipeYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ - ServiceName: "uber.submitqueue.stovepipe.SubmitQueueStovepipe", - ClientConfig: clientConfig, - AnyResolver: anyResolver, - Options: options, - }, - )} -} - -// NewSubmitQueueStovepipeYARPCClient builds a new YARPC client for the SubmitQueueStovepipe service. -func NewSubmitQueueStovepipeYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) SubmitQueueStovepipeYARPCClient { - return newSubmitQueueStovepipeYARPCClient(clientConfig, nil, options...) -} - -// SubmitQueueStovepipeYARPCServer is the YARPC server-side interface for the SubmitQueueStovepipe service. -type SubmitQueueStovepipeYARPCServer interface { - Ping(context.Context, *PingRequest) (*PingResponse, error) -} - -type buildSubmitQueueStovepipeYARPCProceduresParams struct { - Server SubmitQueueStovepipeYARPCServer - AnyResolver jsonpb.AnyResolver -} - -func buildSubmitQueueStovepipeYARPCProcedures(params buildSubmitQueueStovepipeYARPCProceduresParams) []transport.Procedure { - handler := &_SubmitQueueStovepipeYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ - ServiceName: "uber.submitqueue.stovepipe.SubmitQueueStovepipe", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ - { - MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ - Handle: handler.Ping, - NewRequest: newSubmitQueueStovepipeServicePingYARPCRequest, - AnyResolver: params.AnyResolver, - }, - ), - }, - }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, - }, - ) -} - -// BuildSubmitQueueStovepipeYARPCProcedures prepares an implementation of the SubmitQueueStovepipe service for YARPC registration. -func BuildSubmitQueueStovepipeYARPCProcedures(server SubmitQueueStovepipeYARPCServer) []transport.Procedure { - return buildSubmitQueueStovepipeYARPCProcedures(buildSubmitQueueStovepipeYARPCProceduresParams{Server: server}) -} - -// FxSubmitQueueStovepipeYARPCClientParams defines the input -// for NewFxSubmitQueueStovepipeYARPCClient. It provides the -// paramaters to get a SubmitQueueStovepipeYARPCClient in an -// Fx application. -type FxSubmitQueueStovepipeYARPCClientParams struct { - fx.In - - Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` - Restriction restriction.Checker `optional:"true"` -} - -// FxSubmitQueueStovepipeYARPCClientResult defines the output -// of NewFxSubmitQueueStovepipeYARPCClient. It provides a -// SubmitQueueStovepipeYARPCClient to an Fx application. -type FxSubmitQueueStovepipeYARPCClientResult struct { - fx.Out - - Client SubmitQueueStovepipeYARPCClient - - // We are using an fx.Out struct here instead of just returning a client - // so that we can add more values or add named versions of the client in - // the future without breaking any existing code. -} - -// NewFxSubmitQueueStovepipeYARPCClient provides a SubmitQueueStovepipeYARPCClient -// to an Fx application using the given name for routing. -// -// fx.Provide( -// protopb.NewFxSubmitQueueStovepipeYARPCClient("service-name"), -// ... -// ) -func NewFxSubmitQueueStovepipeYARPCClient(name string, options ...protobuf.ClientOption) interface{} { - return func(params FxSubmitQueueStovepipeYARPCClientParams) FxSubmitQueueStovepipeYARPCClientResult { - cc := params.Provider.ClientConfig(name) - - if params.Restriction != nil { - if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { - panic(err.Error()) - } - } - } - - return FxSubmitQueueStovepipeYARPCClientResult{ - Client: newSubmitQueueStovepipeYARPCClient(cc, params.AnyResolver, options...), - } - } -} - -// FxSubmitQueueStovepipeYARPCProceduresParams defines the input -// for NewFxSubmitQueueStovepipeYARPCProcedures. It provides the -// paramaters to get SubmitQueueStovepipeYARPCServer procedures in an -// Fx application. -type FxSubmitQueueStovepipeYARPCProceduresParams struct { - fx.In - - Server SubmitQueueStovepipeYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` -} - -// FxSubmitQueueStovepipeYARPCProceduresResult defines the output -// of NewFxSubmitQueueStovepipeYARPCProcedures. It provides -// SubmitQueueStovepipeYARPCServer procedures to an Fx application. -// -// The procedures are provided to the "yarpcfx" value group. -// Dig 1.2 or newer must be used for this feature to work. -type FxSubmitQueueStovepipeYARPCProceduresResult struct { - fx.Out - - Procedures []transport.Procedure `group:"yarpcfx"` - ReflectionMeta reflection.ServerMeta `group:"yarpcfx"` -} - -// NewFxSubmitQueueStovepipeYARPCProcedures provides SubmitQueueStovepipeYARPCServer procedures to an Fx application. -// It expects a SubmitQueueStovepipeYARPCServer to be present in the container. -// -// fx.Provide( -// protopb.NewFxSubmitQueueStovepipeYARPCProcedures(), -// ... -// ) -func NewFxSubmitQueueStovepipeYARPCProcedures() interface{} { - return func(params FxSubmitQueueStovepipeYARPCProceduresParams) FxSubmitQueueStovepipeYARPCProceduresResult { - return FxSubmitQueueStovepipeYARPCProceduresResult{ - Procedures: buildSubmitQueueStovepipeYARPCProcedures(buildSubmitQueueStovepipeYARPCProceduresParams{ - Server: params.Server, - AnyResolver: params.AnyResolver, - }), - ReflectionMeta: SubmitQueueStovepipeReflectionMeta, - } - } -} - -// SubmitQueueStovepipeReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var SubmitQueueStovepipeReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.stovepipe.SubmitQueueStovepipe", - FileDescriptors: yarpcFileDescriptorClosurefabdb6b3c0b09022, -} - -type _SubmitQueueStovepipeYARPCCaller struct { - streamClient protobuf.StreamClient -} - -func (c *_SubmitQueueStovepipeYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { - responseMessage, err := c.streamClient.Call(ctx, "Ping", request, newSubmitQueueStovepipeServicePingYARPCResponse, options...) - if responseMessage == nil { - return nil, err - } - response, ok := responseMessage.(*PingResponse) - if !ok { - return nil, protobuf.CastError(emptySubmitQueueStovepipeServicePingYARPCResponse, responseMessage) - } - return response, err -} - -type _SubmitQueueStovepipeYARPCHandler struct { - server SubmitQueueStovepipeYARPCServer -} - -func (h *_SubmitQueueStovepipeYARPCHandler) Ping(ctx context.Context, requestMessage proto.Message) (proto.Message, error) { - var request *PingRequest - var ok bool - if requestMessage != nil { - request, ok = requestMessage.(*PingRequest) - if !ok { - return nil, protobuf.CastError(emptySubmitQueueStovepipeServicePingYARPCRequest, requestMessage) - } - } - response, err := h.server.Ping(ctx, request) - if response == nil { - return nil, err - } - return response, err -} - -func newSubmitQueueStovepipeServicePingYARPCRequest() proto.Message { - return &PingRequest{} -} - -func newSubmitQueueStovepipeServicePingYARPCResponse() proto.Message { - return &PingResponse{} -} - -var ( - emptySubmitQueueStovepipeServicePingYARPCRequest = &PingRequest{} - emptySubmitQueueStovepipeServicePingYARPCResponse = &PingResponse{} -) - -var yarpcFileDescriptorClosurefabdb6b3c0b09022 = [][]byte{ - // stovepipe.proto - []byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x86, 0x31, 0xad, 0x80, 0x5e, 0x2b, 0x90, 0x2c, 0x86, 0x28, 0x42, 0xa8, 0x64, 0x69, 0x16, - 0x1c, 0x09, 0xde, 0xa0, 0x0f, 0x80, 0x42, 0xba, 0xc1, 0x80, 0xec, 0xe8, 0x94, 0x7a, 0x70, 0xec, - 0xe6, 0xec, 0xbe, 0x01, 0xef, 0x8d, 0xe2, 0xd2, 0xd0, 0x25, 0x74, 0xf3, 0x9d, 0xff, 0x4f, 0xfa, - 0x3f, 0x1b, 0xee, 0xc8, 0xdb, 0x3d, 0x3a, 0xed, 0x50, 0xb8, 0xce, 0x7a, 0xcb, 0xd3, 0xa0, 0xb0, - 0x13, 0x14, 0x94, 0xd1, 0x7e, 0x17, 0x30, 0xa0, 0x18, 0x12, 0xd9, 0x0a, 0xe6, 0xa5, 0x6e, 0x9b, - 0x0a, 0x77, 0x01, 0xc9, 0xf3, 0x04, 0xae, 0x0d, 0x12, 0xc9, 0x06, 0x13, 0xb6, 0x64, 0xf9, 0xac, - 0x3a, 0x8e, 0xd9, 0x37, 0x83, 0xc5, 0x21, 0x49, 0xce, 0xb6, 0x84, 0xe3, 0x51, 0xfe, 0x04, 0x0b, - 0xc2, 0x6e, 0xaf, 0x6b, 0xfc, 0x6a, 0xa5, 0xc1, 0xe4, 0x32, 0x5e, 0xcf, 0x7f, 0x77, 0x6f, 0xd2, - 0x20, 0x7f, 0x80, 0x99, 0xd7, 0x06, 0xc9, 0x4b, 0xe3, 0x92, 0xc9, 0x92, 0xe5, 0x93, 0xea, 0x6f, - 0xc1, 0x53, 0xb8, 0xd9, 0x5a, 0xf2, 0x11, 0x9e, 0x46, 0x78, 0x98, 0x5f, 0x08, 0xee, 0x37, 0xd1, - 0xe4, 0xbd, 0x37, 0xd9, 0x1c, 0x45, 0xf8, 0x27, 0x4c, 0xfb, 0x7a, 0x7c, 0x25, 0xc6, 0x6d, 0xc5, - 0x89, 0x6a, 0x9a, 0x9f, 0x0f, 0x1e, 0x4c, 0xb3, 0x8b, 0xb5, 0x84, 0xc7, 0xda, 0x9a, 0x7f, 0x80, - 0xf5, 0xed, 0xd0, 0xa4, 0xec, 0xdf, 0xbc, 0x64, 0x1f, 0xcf, 0x8d, 0xf6, 0xdb, 0xa0, 0x44, 0x6d, - 0x4d, 0xd1, 0x83, 0xc5, 0x09, 0x58, 0x0c, 0x60, 0x11, 0xbf, 0xc8, 0x29, 0x75, 0x15, 0x0f, 0xaf, - 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5c, 0xd3, 0x2a, 0x7a, 0xbe, 0x01, 0x00, 0x00, - }, -} - -func init() { - yarpc.RegisterClientBuilder( - func(clientConfig transport.ClientConfig, structField reflect.StructField) SubmitQueueStovepipeYARPCClient { - return NewSubmitQueueStovepipeYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) - }, - ) -} diff --git a/test/integration/stovepipe/BUILD.bazel b/test/integration/stovepipe/BUILD.bazel index 3121c0b0..69166458 100644 --- a/test/integration/stovepipe/BUILD.bazel +++ b/test/integration/stovepipe/BUILD.bazel @@ -6,11 +6,11 @@ go_test( data = [ "//:MODULE.bazel", "//:go.mod", - "//example/server/stovepipe:docker-compose.yml", + "//example/stovepipe/gateway/server:docker-compose.yml", ], tags = ["integration"], deps = [ - "//stovepipe/protopb", + "//stovepipe/gateway/protopb", "//test/testutil", "@com_github_stretchr_testify//assert", "@com_github_stretchr_testify//require", diff --git a/test/integration/stovepipe/suite_test.go b/test/integration/stovepipe/suite_test.go index 262f2502..150d8dc6 100644 --- a/test/integration/stovepipe/suite_test.go +++ b/test/integration/stovepipe/suite_test.go @@ -14,13 +14,18 @@ package stovepipe -// Stovepipe Integration Tests +// Stovepipe gateway integration tests // -// These tests use docker-compose from example/server/stovepipe/docker-compose.yml -// which requires a pre-built Linux binary. +// These tests use compose from example/stovepipe/gateway/server/docker-compose.yml +// and require a pre-built Linux gateway binary (make integration-test runs +// //test/integration/... and builds all Linux binaries via build-all-linux). +// Only the queue database schema is applied (no SubmitQueue app schema until +// Stovepipe has its own storage schema). // -// Run with make target (builds binary + runs test): -// make integration-test-stovepipe +// Run with: +// make integration-test +// or only this package: +// bazel test //test/integration/stovepipe:stovepipe_test import ( "context" @@ -30,68 +35,60 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - pb "github.com/uber/submitqueue/stovepipe/protopb" + pb "github.com/uber/submitqueue/stovepipe/gateway/protopb" "github.com/uber/submitqueue/test/testutil" "google.golang.org/grpc" ) -type StovepipeIntegrationSuite struct { +type StovepipeGatewayIntegrationSuite struct { suite.Suite ctx context.Context log *testutil.TestLogger stack *testutil.ComposeStack - client pb.SubmitQueueStovepipeClient + client pb.StovepipeGatewayClient } -func TestStovepipeIntegration(t *testing.T) { - suite.Run(t, new(StovepipeIntegrationSuite)) +func TestStovepipeGatewayIntegration(t *testing.T) { + suite.Run(t, new(StovepipeGatewayIntegrationSuite)) } -func (s *StovepipeIntegrationSuite) SetupSuite() { +func (s *StovepipeGatewayIntegrationSuite) SetupSuite() { t := s.T() s.ctx = context.Background() s.log = testutil.NewTestLogger(t) - s.log.Logf("Starting Stovepipe integration test suite using docker-compose") + s.log.Logf("Starting Stovepipe integration test suite using compose") - // Set REPO_ROOT for docker-compose volume mounts and build context repoRoot := testutil.FindRepoRoot(t) t.Setenv("REPO_ROOT", repoRoot) - // Use docker-compose from example/server/stovepipe - // NOTE: Assumes Linux binary is pre-built via make target - composeFile := filepath.Join(repoRoot, "example/server/stovepipe/docker-compose.yml") + composeFile := filepath.Join(repoRoot, "example/stovepipe/gateway/server/docker-compose.yml") s.stack = testutil.NewComposeStack(t, s.log, s.ctx, composeFile, "svc-stovepipe") - // Start the compose stack (Stovepipe only β€” stateless service, no DBs) err := s.stack.Up() require.NoError(t, err, "failed to start compose stack") - s.log.Logf("Compose stack started successfully") + queueDB, err := s.stack.ConnectMySQLService("mysql-queue") + require.NoError(t, err, "failed to connect to queue MySQL") + + testutil.ApplySchema(t, s.log, queueDB, testutil.SchemaDir("extension/queue/mysql/schema")) - // Connect to Stovepipe gRPC service var conn *grpc.ClientConn conn, err = s.stack.ConnectGRPC("stovepipe-service", 8080) - require.NoError(t, err, "failed to connect to stovepipe") - s.client = pb.NewSubmitQueueStovepipeClient(conn) - - s.log.Logf("Stovepipe integration test suite ready") + require.NoError(t, err, "failed to connect to stovepipe gateway") + s.client = pb.NewStovepipeGatewayClient(conn) } -func (s *StovepipeIntegrationSuite) TearDownSuite() { +func (s *StovepipeGatewayIntegrationSuite) TearDownSuite() { s.log.Logf("Tearing down Stovepipe integration test suite") - // Cleanup handled automatically by testutil.ComposeStack } -// TestPingAPI tests the Stovepipe Ping API -func (s *StovepipeIntegrationSuite) TestPingAPI() { +func (s *StovepipeGatewayIntegrationSuite) TestPingAPI() { t := s.T() resp, err := s.client.Ping(s.ctx, &pb.PingRequest{Message: "integration test"}) require.NoError(t, err, "Stovepipe Ping failed") - assert.Equal(t, "stovepipe", resp.ServiceName) + assert.Equal(t, "stovepipe-gateway", resp.ServiceName) assert.NotEmpty(t, resp.Message) assert.NotZero(t, resp.Timestamp) - - s.log.Logf("Stovepipe Ping test passed: %s", resp.Message) } From 0720ce8b0d15054a467d94a951c809b9894401d6 Mon Sep 17 00:00:00 2001 From: mnoah1 Date: Tue, 2 Jun 2026 20:27:11 +0000 Subject: [PATCH 2/3] Cleanup --- CLAUDE.md | 7 ++----- Makefile | 18 +++++++----------- example/README.md | 8 +++----- .../stovepipe/{ => gateway}/BUILD.bazel | 3 ++- .../stovepipe/{ => gateway}/suite_test.go | 10 +++++----- 5 files changed, 19 insertions(+), 27 deletions(-) rename test/integration/stovepipe/{ => gateway}/BUILD.bazel (88%) rename test/integration/stovepipe/{ => gateway}/suite_test.go (91%) diff --git a/CLAUDE.md b/CLAUDE.md index c0f8de75..692d815b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -157,10 +157,7 @@ Generated proto files are committed. When modifying `.proto` files: ### Makefile -Targets are **alphabetically sorted**. Each target has `## Description` for auto-generated help and shell completion. - -**Docker Compose:** `COMPOSE` defaults to `docker compose` (Compose v2) so `up --wait` works in `local-*` targets. Install the [Compose plugin](https://docs.docker.com/compose/install/linux/) (e.g. `docker-compose-plugin` on Debian/Ubuntu). Override with `make COMPOSE=docker-compose ...` only if you use a legacy binary (it does not support `--wait` the same way). SubmitQueue stacks use compose project **`SUBMITQUEUE_LOCAL_PROJECT`** (default `submitqueue`); Stovepipe stacks use **`STOVEPIPE_LOCAL_PROJECT`** (default `stovepipe`). Override either with `make SUBMITQUEUE_LOCAL_PROJECT=myname ...` or `STOVEPIPE_LOCAL_PROJECT=...`. - +Targets are **alphabetically sorted**. Each target has `## Description` for auto-generated help and shell completion: ```makefile integration-test: build-all-linux ## Run all integration tests (auto-builds binaries) @$(BAZEL) test //test/integration/... --test_output=streamed @@ -179,7 +176,7 @@ make check-gazelle # Check BUILD.bazel files are up to date make tidy # Run go mod tidy + bazel mod tidy make gazelle # Update BUILD.bazel files make mocks # Generate mock files using mockgen -make integration-test # Run all integration tests (Docker-based; includes Stovepipe gateway) +make integration-test # Run all integration tests (Docker-based) make e2e-test # Run end-to-end tests make proto # Regenerate proto files make local-start # Start full stack with Docker Compose diff --git a/Makefile b/Makefile index fb4006be..573fb595 100644 --- a/Makefile +++ b/Makefile @@ -9,14 +9,14 @@ COMPOSE_FILE = example/server/docker-compose.yml GATEWAY_COMPOSE_FILE = example/server/gateway/docker-compose.yml ORCHESTRATOR_COMPOSE_FILE = example/server/orchestrator/docker-compose.yml +# Fixed project name for local manual testing (tests use unique random names) +SUBMITQUEUE_LOCAL_PROJECT = submitqueue + # Stovepipe compose files STOVEPIPE_GATEWAY_COMPOSE_FILE = example/stovepipe/gateway/server/docker-compose.yml -# Compose project for SubmitQueue example stacks (`docker compose -p`); container prefix e.g. submitqueue-mysql-app-1. -SUBMITQUEUE_LOCAL_PROJECT ?= submitqueue - -# Compose project for Stovepipe example stacks (`docker compose -p`); container prefix e.g. stovepipe-mysql-app-1. -STOVEPIPE_LOCAL_PROJECT ?= stovepipe +# Fixed project name for local manual testing (tests use unique random names) +STOVEPIPE_LOCAL_PROJECT = stovepipe # yamlfmt version for YAML formatting (override with: make fmt YAMLFMT_VERSION=v0.16.0) YAMLFMT_VERSION ?= v0.16.0 @@ -38,7 +38,7 @@ define assert_clean fi endef -.PHONY: build build-all-linux build-gateway-linux build-orchestrator-linux build-stovepipe-gateway-linux check-gazelle check-mocks check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-consumer integration-test-extensions integration-test-gateway integration-test-orchestrator license-fix lint lint-fmt lint-license local-clean local-gateway-start local-gateway-stop local-init-schemas local-init-stovepipe-queue-schema local-logs local-orchestrator-start local-orchestrator-stop local-ps local-restart local-start local-stop local-stovepipe-gateway-start local-stovepipe-gateway-stop mocks proto query-deps query-targets run-client-gateway run-client-orchestrator run-client-stovepipe-gateway run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help +.PHONY: build build-all-linux build-gateway-linux build-orchestrator-linux build-stovepipe-gateway-linux check-gazelle check-mocks check-tidy clean clean-proto deps e2e-test fmt gazelle integration-test integration-test-consumer integration-test-extensions integration-test-gateway integration-test-orchestrator license-fix lint lint-fmt lint-license local-clean local-gateway-start local-gateway-stop local-init-schemas local-init-stovepipe-queue-schema local-logs local-orchestrator-start local-orchestrator-stop local-ps local-restart local-start local-stop local-stovepipe-gateway-start mocks proto query-deps query-targets run-client-gateway run-client-orchestrator run-client-stovepipe-gateway run-queue-admin test test-no-cache tidy tidy-bazel tidy-go help build: ## Build all services and examples @@ -266,6 +266,7 @@ local-start: build-all-linux ## Start full stack (Gateway + Orchestrator + MySQL local-stop: ## Stop all services (keep data) @echo "Stopping all services..." @$(COMPOSE) -f $(COMPOSE_FILE) -p $(SUBMITQUEUE_LOCAL_PROJECT) down + @$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) down @echo "Services stopped. Data volumes preserved." local-stovepipe-gateway-start: build-stovepipe-gateway-linux ## Start Stovepipe gateway locally (gateway + 2 MySQL databases) @@ -282,11 +283,6 @@ local-stovepipe-gateway-start: build-stovepipe-gateway-linux ## Start Stovepipe @echo "MySQL App port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-app-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" @echo "MySQL Queue port: $$(docker port $(STOVEPIPE_LOCAL_PROJECT)-mysql-queue-1 3306 2>/dev/null | cut -d: -f2 || echo 'unknown')" -local-stovepipe-gateway-stop: ## Stop Stovepipe gateway service - @echo "Stopping Stovepipe gateway services..." - @$(COMPOSE) -f $(STOVEPIPE_GATEWAY_COMPOSE_FILE) -p $(STOVEPIPE_LOCAL_PROJECT) down - @echo "Stovepipe gateway services stopped." - mocks: ## Generate mock files using mockgen @echo "Generating mocks..." @$(BAZEL) run @rules_go//go -- generate ./extension/storage/... ./extension/changestore/... ./extension/counter/... ./extension/queue/... ./extension/queueconfig/... ./extension/mergechecker/... ./extension/pusher/... ./extension/scorer/... ./extension/conflict/... ./core/consumer/... diff --git a/example/README.md b/example/README.md index 92647af4..e553512e 100644 --- a/example/README.md +++ b/example/README.md @@ -8,7 +8,7 @@ Example gRPC servers and clients for running the submitqueue services locally. - **SubmitQueue Orchestrator** (port 8082) β€” coordinates the pipeline. Exposes `Ping` RPC and consumes queue messages across 9 pipeline topics. - **Stovepipe Gateway** (port 8083) - entry point for commit deployment verification requests. Exposes `Ping` RPC. -Services use MySQL (app + queue) when run via the Docker Compose examples below. **Use Docker Compose v2** (`docker compose`, e.g. the `docker-compose-plugin` package) so `make local-*` targets can use `up --wait`. The Makefile sets `COMPOSE ?= docker compose` by default. +Services require MySQL (app database + queue database). Docker Compose handles this automatically. ## Directory Structure @@ -40,7 +40,6 @@ example/ ### Docker Compose (recommended) -Requires **Docker Compose v2** (`docker compose`) for `up --wait` used by `make local-*`. On Debian/Ubuntu: `sudo apt-get install -y docker-compose-plugin`, then `docker compose version`. ```bash # Start full SubmitQueue stack (Gateway + Orchestrator + MySQL) @@ -55,12 +54,11 @@ make local-stovepipe-gateway-start make local-logs make local-ps -# Stop +# Stop (SubmitQueue + Stovepipe default projects) make local-stop -make local-stovepipe-gateway-stop ``` -For Docker, `make build-stovepipe-gateway-linux` copies a Linux binary to `.docker-bin/stovepipe-gateway` so it does not overwrite SubmitQueue’s `.docker-bin/gateway`. Stovepipe `make local-stovepipe-gateway-start` applies **only the queue schema** on `mysql-queue` (`make local-init-stovepipe-queue-schema`); SubmitQueue storage/counter schemas on `mysql-app` are skipped until Stovepipe has its own app schema. Compose uses project name **`stovepipe`** for Stovepipe (`make STOVEPIPE_LOCAL_PROJECT=myname ...`). SubmitQueue examples use project **`submitqueue`** by default (`make SUBMITQUEUE_LOCAL_PROJECT=myname ...`). Stovepipe containers are named like `stovepipe-mysql-app-1`, not `submitqueue-*`. +For Docker, `make build-stovepipe-gateway-linux` copies a Linux binary to `.docker-bin/stovepipe-gateway` so it does not overwrite SubmitQueue’s `.docker-bin/gateway`. Stovepipe `make local-stovepipe-gateway-start` applies **only the queue schema** on `mysql-queue` (`make local-init-stovepipe-queue-schema`); SubmitQueue storage/counter schemas on `mysql-app` are skipped until Stovepipe has its own app schema. `make local-stop` stops the SubmitQueue stack and runs `docker compose down` on the Stovepipe gateway compose file for **`STOVEPIPE_LOCAL_PROJECT`** (default `stovepipe`). SubmitQueue examples use project **`submitqueue`** by default (`make SUBMITQUEUE_LOCAL_PROJECT=myname ...`). Stovepipe containers are named like `stovepipe-mysql-app-1`, not `submitqueue-*`. ### Bazel diff --git a/test/integration/stovepipe/BUILD.bazel b/test/integration/stovepipe/gateway/BUILD.bazel similarity index 88% rename from test/integration/stovepipe/BUILD.bazel rename to test/integration/stovepipe/gateway/BUILD.bazel index 69166458..a6d5cb43 100644 --- a/test/integration/stovepipe/BUILD.bazel +++ b/test/integration/stovepipe/gateway/BUILD.bazel @@ -1,12 +1,13 @@ load("@rules_go//go:def.bzl", "go_test") go_test( - name = "stovepipe_test", + name = "gateway_test", srcs = ["suite_test.go"], data = [ "//:MODULE.bazel", "//:go.mod", "//example/stovepipe/gateway/server:docker-compose.yml", + "//extension/queue/mysql/schema", ], tags = ["integration"], deps = [ diff --git a/test/integration/stovepipe/suite_test.go b/test/integration/stovepipe/gateway/suite_test.go similarity index 91% rename from test/integration/stovepipe/suite_test.go rename to test/integration/stovepipe/gateway/suite_test.go index 150d8dc6..aac8bfb2 100644 --- a/test/integration/stovepipe/suite_test.go +++ b/test/integration/stovepipe/gateway/suite_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package stovepipe +package gateway // Stovepipe gateway integration tests // @@ -25,7 +25,7 @@ package stovepipe // Run with: // make integration-test // or only this package: -// bazel test //test/integration/stovepipe:stovepipe_test +// bazel test //test/integration/stovepipe/gateway:gateway_test import ( "context" @@ -57,13 +57,13 @@ func (s *StovepipeGatewayIntegrationSuite) SetupSuite() { s.ctx = context.Background() s.log = testutil.NewTestLogger(t) - s.log.Logf("Starting Stovepipe integration test suite using compose") + s.log.Logf("Starting Stovepipe gateway integration test suite using compose") repoRoot := testutil.FindRepoRoot(t) t.Setenv("REPO_ROOT", repoRoot) composeFile := filepath.Join(repoRoot, "example/stovepipe/gateway/server/docker-compose.yml") - s.stack = testutil.NewComposeStack(t, s.log, s.ctx, composeFile, "svc-stovepipe") + s.stack = testutil.NewComposeStack(t, s.log, s.ctx, composeFile, "svc-stovepipe-gateway") err := s.stack.Up() require.NoError(t, err, "failed to start compose stack") @@ -80,7 +80,7 @@ func (s *StovepipeGatewayIntegrationSuite) SetupSuite() { } func (s *StovepipeGatewayIntegrationSuite) TearDownSuite() { - s.log.Logf("Tearing down Stovepipe integration test suite") + s.log.Logf("Tearing down Stovepipe gateway integration test suite") } func (s *StovepipeGatewayIntegrationSuite) TestPingAPI() { From 7eab09c16c22af5fa676b188bebfe23bf23f34f3 Mon Sep 17 00:00:00 2001 From: mnoah1 Date: Tue, 2 Jun 2026 20:55:44 +0000 Subject: [PATCH 3/3] Lint --- stovepipe/gateway/protopb/gateway.pb.go | 5 +++-- stovepipe/gateway/protopb/gateway_grpc.pb.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stovepipe/gateway/protopb/gateway.pb.go b/stovepipe/gateway/protopb/gateway.pb.go index 5ebb3b61..05769897 100644 --- a/stovepipe/gateway/protopb/gateway.pb.go +++ b/stovepipe/gateway/protopb/gateway.pb.go @@ -21,11 +21,12 @@ package protopb import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/stovepipe/gateway/protopb/gateway_grpc.pb.go b/stovepipe/gateway/protopb/gateway_grpc.pb.go index 2fb64d46..60567b4a 100644 --- a/stovepipe/gateway/protopb/gateway_grpc.pb.go +++ b/stovepipe/gateway/protopb/gateway_grpc.pb.go @@ -22,6 +22,7 @@ package protopb import ( context "context" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status"