async-grpc-xds 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +0,0 @@
1
- FROM ruby:latest
2
-
3
- WORKDIR /app
4
- ENV BUNDLE_GEMFILE=/app/gems.rb \
5
- BUNDLE_WITHOUT=maintenance
6
-
7
- # Install dependencies
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- && rm -rf /var/lib/apt/lists/*
11
-
12
- # Copy gemfile, gemspec, and minimal lib files needed for gemspec.
13
- COPY gems.rb *.gemspec ./
14
- COPY lib/async/grpc/xds/version.rb lib/async/grpc/xds/version.rb
15
- RUN bundle install
16
-
17
- # Copy application code
18
- COPY . .
19
-
20
- # Expose port
21
- EXPOSE ${PORT:-50051}
22
-
23
- # Run gRPC server
24
- CMD bundle exec ruby xds/backend_server.rb
@@ -1,22 +0,0 @@
1
- FROM golang:1.21-alpine AS builder
2
-
3
- # Install build dependencies
4
- RUN apk add --no-cache git
5
-
6
- WORKDIR /build
7
-
8
- COPY go.mod go.sum ./
9
- RUN go mod download
10
-
11
- COPY test_server.go ./
12
- RUN go build -o /xds-test-server test_server.go
13
-
14
- FROM alpine:latest
15
-
16
- RUN apk add --no-cache netcat-openbsd ca-certificates
17
-
18
- COPY --from=builder /xds-test-server /xds-test-server
19
-
20
- EXPOSE 18000 18001
21
-
22
- CMD ["/xds-test-server", "-port", "18000"]
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Released under the MIT License.
5
- # Copyright, 2026, by Samuel Williams.
6
-
7
- require "async"
8
- require "async/http/server"
9
- require "async/http/endpoint"
10
- require "async/grpc/dispatcher"
11
- require "async/grpc/service"
12
- require_relative "../fixtures/async/grpc/test_interface"
13
-
14
- class TestBackendService < Async::GRPC::Service
15
- def initialize(interface_class, service_name, backend_id)
16
- super(interface_class, service_name)
17
- @backend_id = backend_id
18
- end
19
-
20
- def unary_call(input, output, call)
21
- request = input.read
22
-
23
- # Include backend ID in response metadata (trailers)
24
- call.response.headers["backend-id"] = @backend_id
25
-
26
- response = Protocol::GRPC::Fixtures::TestMessage.new(
27
- value: "Response from #{@backend_id}: #{request&.value || 'no value'}"
28
- )
29
-
30
- output.write(response)
31
- end
32
-
33
- def say_hello(input, output, call)
34
- request = input.read
35
-
36
- call.response.headers["backend-id"] = @backend_id
37
-
38
- response = Protocol::GRPC::Fixtures::TestMessage.new(
39
- value: "Hello from #{@backend_id}, #{request.value}!"
40
- )
41
-
42
- output.write(response)
43
- end
44
- end
45
-
46
- port = ENV["PORT"] || "50051"
47
- backend_id = ENV["BACKEND_ID"] || "backend-unknown"
48
- service_name = ENV["SERVICE_NAME"] || "test.Service"
49
-
50
- Async do
51
- # Create gRPC dispatcher
52
- dispatcher = Async::GRPC::Dispatcher.new
53
- service = TestBackendService.new(Async::GRPC::Fixtures::TestInterface, service_name, backend_id)
54
- dispatcher.register(service)
55
-
56
- # Create endpoint (http for h2c - gRPC without TLS in docker)
57
- endpoint = Async::HTTP::Endpoint.parse(
58
- "http://0.0.0.0:#{port}",
59
- protocol: Async::HTTP::Protocol::HTTP2
60
- )
61
-
62
- # Start server
63
- server = Async::HTTP::Server.new(dispatcher, endpoint)
64
-
65
- Console.info{"Starting backend server #{backend_id} on port #{port}"}
66
-
67
- server.run
68
- end
@@ -1,89 +0,0 @@
1
- services:
2
- # xDS control plane (using custom test server built with go-control-plane)
3
- # This provides a simple xDS server for testing
4
- xds-control-plane:
5
- build:
6
- context: .
7
- dockerfile: Dockerfile.control-plane
8
- ports:
9
- - "18000:18000"
10
- - "18001:18001"
11
- environment:
12
- - UPSTREAM=backend-1:50051,backend-2:50052,backend-3:50053
13
- healthcheck:
14
- test: ["CMD", "nc", "-z", "localhost", "18000"]
15
- interval: 1s
16
- timeout: 3s
17
- retries: 30
18
-
19
- # Backend gRPC server 1
20
- backend-1:
21
- build:
22
- context: ..
23
- dockerfile: xds/Dockerfile.backend
24
- command: bundle exec ruby xds/backend_server.rb
25
- environment:
26
- - BUNDLE_WITHOUT=maintenance
27
- - PORT=50051
28
- - SERVICE_NAME=myservice
29
- - BACKEND_ID=backend-1
30
- ports:
31
- - "50051:50051"
32
- depends_on:
33
- xds-control-plane:
34
- condition: service_healthy
35
-
36
- # Backend gRPC server 2
37
- backend-2:
38
- build:
39
- context: ..
40
- dockerfile: xds/Dockerfile.backend
41
- command: bundle exec ruby xds/backend_server.rb
42
- environment:
43
- - BUNDLE_WITHOUT=maintenance
44
- - PORT=50052
45
- - SERVICE_NAME=myservice
46
- - BACKEND_ID=backend-2
47
- ports:
48
- - "50052:50052"
49
- depends_on:
50
- xds-control-plane:
51
- condition: service_healthy
52
-
53
- # Backend gRPC server 3
54
- backend-3:
55
- build:
56
- context: ..
57
- dockerfile: xds/Dockerfile.backend
58
- command: bundle exec ruby xds/backend_server.rb
59
- environment:
60
- - BUNDLE_WITHOUT=maintenance
61
- - PORT=50053
62
- - SERVICE_NAME=myservice
63
- - BACKEND_ID=backend-3
64
- ports:
65
- - "50053:50053"
66
- depends_on:
67
- xds-control-plane:
68
- condition: service_healthy
69
-
70
- # Test runner
71
- tests:
72
- image: ruby:${RUBY_VERSION:-latest}
73
- volumes:
74
- - ../:/code
75
- working_dir: /code
76
- command: bash -c "bundle install && bundle exec sus xds/test"
77
- environment:
78
- - BUNDLE_GEMFILE=/code/gems.rb
79
- - BUNDLE_WITHOUT=maintenance
80
- - CONSOLE_OUTPUT=XTerm
81
- - COVERAGE=${COVERAGE}
82
- - XDS_ADMIN_URI=http://xds-control-plane:18001
83
- - XDS_SERVER_URI=xds-control-plane:18000
84
- - XDS_ENDPOINT_SCHEME=http
85
- depends_on:
86
- - xds-control-plane
87
- - backend-1
88
- - backend-2
89
- - backend-3
data/xds/go.mod DELETED
@@ -1,22 +0,0 @@
1
- module xds-test-server
2
-
3
- go 1.21
4
-
5
- require (
6
- github.com/envoyproxy/go-control-plane v0.12.0
7
- google.golang.org/grpc v1.60.0
8
- )
9
-
10
- require (
11
- github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
12
- github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect
13
- github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect
14
- github.com/golang/protobuf v1.5.3 // indirect
15
- golang.org/x/net v0.17.0 // indirect
16
- golang.org/x/sys v0.13.0 // indirect
17
- golang.org/x/text v0.13.0 // indirect
18
- google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
19
- google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
20
- google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
21
- google.golang.org/protobuf v1.32.0 // indirect
22
- )
data/xds/go.sum DELETED
@@ -1,82 +0,0 @@
1
- cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2
- github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
3
- github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
4
- github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g=
5
- github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
6
- github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
7
- github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k=
8
- github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
9
- github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
10
- github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
11
- github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
12
- github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI=
13
- github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0=
14
- github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
15
- github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA=
16
- github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
17
- github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
18
- github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
19
- github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
20
- github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
21
- github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
22
- github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
23
- github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
24
- github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
25
- github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
26
- github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
27
- github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
28
- github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
29
- github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
30
- github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
31
- github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
32
- github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
33
- golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
34
- golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
35
- golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
36
- golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
37
- golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
38
- golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
39
- golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
40
- golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
41
- golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
42
- golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
43
- golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
44
- golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
45
- golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
46
- golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
47
- golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
48
- golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
49
- golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
50
- golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
51
- golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
52
- golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
53
- golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
54
- golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
55
- golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
56
- golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
57
- golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
58
- golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
59
- golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
60
- google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
61
- google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
62
- google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
63
- google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
64
- google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0=
65
- google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk=
66
- google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU=
67
- google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0=
68
- google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0=
69
- google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY=
70
- google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
71
- google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
72
- google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
73
- google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k=
74
- google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
75
- google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
76
- google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
77
- google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
78
- google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
79
- gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
80
- gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
81
- honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
82
- honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
data/xds/readme.md DELETED
@@ -1,95 +0,0 @@
1
- # xDS Integration Tests
2
-
3
- This directory contains Docker Compose configuration and test files for xDS integration testing, following the same pattern as `async-redis` (Sentinel and Cluster tests).
4
-
5
- ## Setup
6
-
7
- The Docker Compose setup includes:
8
- - **xds-control-plane**: xDS control plane server (using go-control-plane)
9
- - **backend-1, backend-2, backend-3**: Multiple gRPC backend servers
10
- - **tests**: Test runner container
11
-
12
- ## Running Tests
13
-
14
- From this directory:
15
-
16
- ```bash
17
- cd xds
18
- docker compose up --build --exit-code-from tests
19
- ```
20
-
21
- ## Test Structure
22
-
23
- Tests are located in `xds/test/async/grpc/xds/` and follow the same pattern as other async-grpc tests:
24
-
25
- - `client.rb`: Tests for `Async::GRPC::XDS::Client`
26
- - Tests use `Sus::Fixtures::Async::ReactorContext` for async test support
27
- - Tests connect to docker compose services using service names (e.g., `xds-control-plane:18000`)
28
-
29
- ## Environment Variables
30
-
31
- - `XDS_SERVER_URI`: xDS control plane server URI (default: `xds-control-plane:18000`)
32
- - `RUBY_VERSION`: Ruby version for test container (default: `latest`)
33
- - `COVERAGE`: Enable code coverage reporting
34
-
35
- ## Backend Servers
36
-
37
- The backend servers (`backend-1`, `backend-2`, `backend-3`) are simple gRPC servers that:
38
- - Implement the test service interface
39
- - Include backend ID in response metadata
40
- - Can be used to test load balancing and failover
41
-
42
- See `backend_server.rb` for implementation details.
43
-
44
- ## Mock xDS Control Plane
45
-
46
- For simpler unit testing, you can use a mock xDS server instead of the full Docker Compose setup. See the test files for examples of mocking xDS responses.
47
-
48
- ## Troubleshooting
49
-
50
- ### Services not starting
51
-
52
- Check logs:
53
- ```bash
54
- docker compose logs xds-control-plane
55
- docker compose logs backend-1
56
- ```
57
-
58
- ### Tests failing to connect
59
-
60
- Ensure services are healthy:
61
- ```bash
62
- docker compose ps
63
- ```
64
-
65
- Check network connectivity:
66
- ```bash
67
- docker compose exec tests ping xds-control-plane
68
- ```
69
-
70
- ## Protobuf Setup
71
-
72
- The xDS implementation uses Envoy protobuf definitions. Protos come from [envoyproxy/envoy](https://github.com/envoyproxy/envoy) (`api/`) or [envoyproxy/data-plane-api](https://github.com/envoyproxy/data-plane-api). Use **xDS v3** (v2 is deprecated).
73
-
74
- ### Required protobuf files
75
-
76
- - `envoy/service/discovery/v3/discovery.proto` - DiscoveryRequest/Response.
77
- - `envoy/service/discovery/v3/ads.proto` - AggregatedDiscoveryService.
78
- - `envoy/config/cluster/v3/cluster.proto` - Cluster (CDS).
79
- - `envoy/config/endpoint/v3/endpoint.proto` - ClusterLoadAssignment (EDS).
80
- - `envoy/config/core/v3/base.proto` - Node, Locality, etc.
81
- - `google/protobuf/any.proto` - For Any type in DiscoveryResponse.
82
-
83
- ### Generating Ruby code
84
-
85
- ```bash
86
- protoc --ruby_out=lib \
87
- --proto_path=vendor/envoy-api \
88
- envoy/service/discovery/v3/discovery.proto \
89
- envoy/service/discovery/v3/ads.proto \
90
- envoy/config/cluster/v3/cluster.proto \
91
- envoy/config/endpoint/v3/endpoint.proto \
92
- envoy/config/core/v3/base.proto
93
- ```
94
-
95
- Lock the Envoy API version (submodule tag or commit) for compatibility.