Skip to content

Commit eef089b

Browse files
authored
fix: Make the JSONRPC and gRPC URLs used for TCK testing configurable (#239)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Follow the [`CONTRIBUTING` Guide](../CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [x] Ensure the tests pass - [x] Appropriate READMEs were updated (if necessary)
1 parent 26ab76d commit eef089b

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.github/workflows/run-tck.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ env:
1515
TCK_VERSION: 0.3.0.alpha
1616
# Tells uv to not need a venv, and instead use system
1717
UV_SYSTEM_PYTHON: 1
18+
# SUT_JSONRPC_URL to use for the TCK
19+
SUT_JSONRPC_URL: http://localhost:9999
20+
# SUT_GRPC_URL to use for the TCK
21+
SUT_GRPC_URL: http://localhost:9000
1822

1923
# Only run the latest job
2024
concurrency:
@@ -57,7 +61,7 @@ jobs:
5761
working-directory: tck
5862
- name: Wait for SUT to start
5963
run: |
60-
URL="http://localhost:9999/.well-known/agent-card.json"
64+
URL="${{ env.SUT_JSONRPC_URL }}/.well-known/agent-card.json"
6165
EXPECTED_STATUS=200
6266
TIMEOUT=120
6367
RETRY_INTERVAL=2
@@ -91,5 +95,5 @@ jobs:
9195
9296
- name: Run TCK
9397
run: |
94-
./run_tck.py --sut-url http://localhost:9999 --category all --compliance-report report.json
98+
./run_tck.py --sut-url ${{ env.SUT_JSONRPC_URL }} --category all --transports jsonrpc,grpc --compliance-report report.json
9599
working-directory: tck/a2a-tck

tck/src/main/java/io/a2a/tck/server/AgentCardProducer.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ public class AgentCardProducer {
2020
@Produces
2121
@PublicAgentCard
2222
public AgentCard agentCard() {
23+
String sutJsonRpcUrl = getEnvOrDefault("SUT_JSONRPC_URL", "http://localhost:9999");
24+
String sutGrpcUrl = getEnvOrDefault("SUT_GRPC_URL", "http://localhost:9000");
2325
return new AgentCard.Builder()
2426
.name("Hello World Agent")
2527
.description("Just a hello world agent")
26-
.url("http://localhost:9999")
28+
.url(sutJsonRpcUrl)
2729
.version("1.0.0")
2830
.documentationUrl("http://example.com/docs")
2931
.capabilities(new AgentCapabilities.Builder()
@@ -42,9 +44,14 @@ public AgentCard agentCard() {
4244
.build()))
4345
.protocolVersion("0.3.0")
4446
.additionalInterfaces(List.of(
45-
new AgentInterface(TransportProtocol.JSONRPC.asString(), "http://localhost:9999"),
46-
new AgentInterface(TransportProtocol.GRPC.asString(), "http://localhost:9000")))
47+
new AgentInterface(TransportProtocol.JSONRPC.asString(), sutJsonRpcUrl),
48+
new AgentInterface(TransportProtocol.GRPC.asString(), sutGrpcUrl)))
4749
.build();
4850
}
51+
52+
private static String getEnvOrDefault(String envVar, String defaultValue) {
53+
String value = System.getenv(envVar);
54+
return value == null || value.isBlank() ? defaultValue : value;
55+
}
4956
}
5057

0 commit comments

Comments
 (0)