Skip to content

Commit 240a3f9

Browse files
fix(cli): Accept --url for dart-symbol-map (#3108)
### Description The `dart-symbol-map` command uses the derive parser, which was missing the `--url` field. This change adds it so `--url` is accepted for dart-symbol-map and removes an unused dart symbol map fixture. ### Issues - Fixes #3106 - Fixes [CLI-272](https://linear.app/getsentry/issue/CLI-272/dart-symbol-map-error-unexpected-argument-url-found) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent bfb7c3b commit 240a3f9

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- Add `--install-group` parameter to `sentry-cli build upload` for controlling update visibility between builds ([#3094](https://github.com/getsentry/sentry-cli/pull/3094))
88

9+
### Fixes
10+
11+
- Fixed a bug where the `dart-symbol-map` command did not accept the `--url` argument ([#3108](https://github.com/getsentry/sentry-cli/pull/3108)).
12+
913
## 3.1.0
1014

1115
### New Features

src/commands/derive_parser.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ pub(super) struct SentryCLI {
1818
#[arg(help = "Use the given Sentry auth token")]
1919
pub(super) auth_token: Option<AuthToken>,
2020

21+
#[arg(global = true, long, value_name = "URL")]
22+
#[arg(help = "Fully qualified URL to the Sentry server.{n}[default: https://sentry.io/]")]
23+
pub(super) url: Option<String>,
24+
2125
#[arg(global=true, ignore_case=true, value_parser=["trace", "debug", "info", "warn", "error"])]
2226
#[arg(long, help = "Set the log output verbosity")]
2327
pub(super) log_level: Option<String>,

tests/integration/upload_dart_symbol_map.rs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,76 @@ fn command_upload_dart_symbol_map_invalid_mapping() {
102102
.with_default_token()
103103
.run_and_assert(AssertCommand::Failure);
104104
}
105+
106+
#[test]
107+
fn command_upload_dart_symbol_map_with_custom_url() {
108+
let call_count = AtomicU8::new(0);
109+
110+
let manager = TestManager::new()
111+
.mock_endpoint(
112+
MockEndpointBuilder::new("GET", "/api/0/organizations/wat-org/chunk-upload/")
113+
.with_response_file("dart_symbol_map/get-chunk-upload.json"),
114+
)
115+
.mock_endpoint(MockEndpointBuilder::new(
116+
"POST",
117+
"/api/0/organizations/wat-org/chunk-upload/",
118+
))
119+
.mock_endpoint(
120+
MockEndpointBuilder::new(
121+
"POST",
122+
"/api/0/projects/wat-org/wat-project/files/difs/assemble/",
123+
)
124+
.with_response_fn(move |_request| {
125+
let value = match call_count.fetch_add(1, Ordering::Relaxed) {
126+
0 => serde_json::json!({
127+
"state": "not_found",
128+
"missingChunks": ["6aa44eb08e4a72d1cf32fe7c2504216fb1a3e862"]
129+
}),
130+
1 => serde_json::json!({
131+
"state": "created",
132+
"missingChunks": []
133+
}),
134+
2 => serde_json::json!({
135+
"state": "ok",
136+
"detail": serde_json::Value::Null,
137+
"missingChunks": [],
138+
"dif": {
139+
"id": "1",
140+
"uuid": "00000000-0000-0000-0000-000000000000",
141+
"debugId": "00000000-0000-0000-0000-000000000000",
142+
"objectName": "dartsymbolmap.json",
143+
"cpuName": "any",
144+
"headers": { "Content-Type": "application/octet-stream" },
145+
"size": 1,
146+
"sha1": "6aa44eb08e4a72d1cf32fe7c2504216fb1a3e862",
147+
"dateCreated": "1776-07-04T12:00:00.000Z",
148+
"data": {}
149+
}
150+
}),
151+
n => panic!(
152+
"Only 3 calls to the assemble endpoint expected, but there were {}.",
153+
n + 1
154+
),
155+
};
156+
let response = serde_json::json!({
157+
"6aa44eb08e4a72d1cf32fe7c2504216fb1a3e862": value
158+
});
159+
serde_json::to_vec(&response).unwrap()
160+
})
161+
.expect(3),
162+
);
163+
164+
let server_url = manager.server_url();
165+
166+
manager
167+
.assert_cmd([
168+
"--url",
169+
&server_url,
170+
"dart-symbol-map",
171+
"upload",
172+
"tests/integration/_fixtures/dart_symbol_map/dartsymbolmap.json",
173+
"tests/integration/_fixtures/Sentry.Samples.Console.Basic.pdb",
174+
])
175+
.with_default_token()
176+
.run_and_assert(AssertCommand::Success);
177+
}

0 commit comments

Comments
 (0)