Skip to content

Commit ac2fcf9

Browse files
committed
test: Add URL argument to command line
1 parent 3e81c08 commit ac2fcf9

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Changed
44
- Updated Firebolt C++ Transport dependency to `v1.1.3`
5+
- In API Test App, URL can be specified on command line: `--url URL`
56

67
### Fixed
78
- Prevented a crash when a mandatory field was missing from the JSON payload

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ params=
2424
buildType="Debug"
2525
cleanFirst=false
2626

27-
while [[ -n "${1:-}" ]]; do
27+
while [[ ! -z $1 ]]; do
2828
case $1 in
2929
--clean) cleanFirst=true;;
3030
--release) buildType="Release";;

test/api_test_app/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,34 @@ The app binary name is:
1717
## Command Line Usage
1818

1919
```bash
20-
api-test-app [--auto] [--mock] [--platform] [--dbg] [--help]
20+
api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--dbg] [--help]
2121
```
2222

2323
### Options
2424

25-
- `--auto`
25+
- `--auto`
2626
Run all methods for all interfaces automatically.
2727

28-
- `--mock`
28+
- `--mock`
2929
Use local mock endpoint: `ws://127.0.0.1:9998/`.
3030

31-
- `--platform`
31+
- `--platform`
3232
Use platform endpoint: `ws://127.0.0.1:3474/`.
3333

34-
- `--dbg`
34+
- `--url URL`
35+
Set the WebSocket endpoint to the specified URL.
36+
37+
- `--dbg`
3538
Enable debug logging.
3639

37-
- `--help`
40+
- `--help`
3841
Print usage and exit.
3942

4043
## Endpoint Selection Priority
4144

4245
The app chooses the WebSocket endpoint in this order:
4346

44-
1. `--mock` or `--platform` (if provided)
47+
1. `--mock` or `--platform` or `--url URL` (if provided)
4548
2. `FIREBOLT_ENDPOINT` environment variable (if set)
4649
3. Default fallback: `ws://127.0.0.1:9998/`
4750

test/api_test_app/main.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,32 @@ int main(int argc, char** argv)
5757
{
5858
url = "ws://127.0.0.1:3474/";
5959
}
60+
else if (std::string(argv[i]) == "--url")
61+
{
62+
if (i + 1 >= argc)
63+
{
64+
std::cerr << "Error: --url option requires a URL argument. Use --help to see usage" << std::endl;
65+
return 1;
66+
}
67+
url = argv[++i];
68+
}
6069
else if (std::string(argv[i]) == "--dbg")
6170
{
6271
logLevel = Firebolt::LogLevel::Debug;
6372
}
6473
else if (std::string(argv[i]) == "--help")
6574
{
6675
/* clang-format off */
67-
std::cout << "Usage: " << argv[0] << " [--auto] [--mock] [--platform] [--dbg] [--help]" << std::endl;
68-
std::cout << " --auto Automatically run all methods for all interfaces without user input." << std::endl;
69-
std::cout << " --mock Connect to a local mock server instead of the default Firebolt Demo Service." << std::endl;
70-
std::cout << " --platform Connect to the platform's Firebolt service (default if available)." << std::endl;
71-
std::cout << " --dbg Enable debug logging." << std::endl;
72-
std::cout << " --help Show this help message." << std::endl;
76+
std::cout << "SYNOPSIS" << std::endl;
77+
std::cout << " " << argv[0] << " [<options>]" << std::endl;
78+
std::cout << std::endl;
79+
std::cout << "OPTIONS" << std::endl;
80+
std::cout << " --auto Automatically run all methods for all interfaces without user input" << std::endl;
81+
std::cout << " --mock Connect to a local mock server instead of the default Firebolt Demo Service" << std::endl;
82+
std::cout << " --platform Connect to the platform's Firebolt service (default if available)" << std::endl;
83+
std::cout << " --url <URL> Specify a custom URL for the Firebolt service" << std::endl;
84+
std::cout << " --dbg Enable debug logging" << std::endl;
85+
std::cout << " --help Show this help message" << std::endl;
7386
/* clang-format on */
7487
return 0;
7588
}

0 commit comments

Comments
 (0)