Skip to content

Commit f6e00cc

Browse files
authored
Improve error handling in Proxy startup and adjust executable path for Windows (Azure#2398)
1 parent ff4b6f3 commit f6e00cc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

sdk/core/azure_core_test/src/proxy/bootstrap.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ pub async fn start(
7777
let mut proxy = Proxy::default();
7878
let max_seconds = Duration::from_secs(env::var(SYSTEM_TEAMPROJECTID).map_or(5, |_| 20));
7979
tokio::select! {
80-
_ = proxy.start(git_dir, &executable_file_path, args.into_iter()) => {
80+
result = proxy.start(git_dir, &executable_file_path, args.into_iter()) => {
81+
result?;
8182
proxy.endpoint()
8283
}
8384
_ = tokio::time::sleep(max_seconds) => {
@@ -143,7 +144,8 @@ async fn ensure_test_proxy(git_dir: &Path) -> Result<PathBuf> {
143144
let output_dir = git_dir.join(".proxy");
144145
let mut executable_file_path = output_dir.join("Azure.Sdk.Tools.TestProxy");
145146
if cfg!(windows) {
146-
executable_file_path.set_extension("exe");
147+
let path = executable_file_path.as_mut_os_string();
148+
path.push(".exe");
147149
}
148150

149151
// TODO: Create a lock file lock? https://github.com/Azure/azure-sdk-for-rust/issues/2299

sdk/core/azure_core_test/src/proxy/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ impl Proxy {
6464
.stdout(Stdio::piped())
6565
.stderr(Stdio::piped())
6666
.spawn()
67-
.map_err(|err| azure_core::Error::full(ErrorKind::Io, err, "test-proxy not found"))?;
67+
.map_err(|err| {
68+
azure_core::Error::full(
69+
ErrorKind::Io,
70+
err,
71+
format!("{} failed to start", executable_file_path.display()),
72+
)
73+
})?;
6874

6975
let mut stdout = command
7076
.stdout

0 commit comments

Comments
 (0)