Skip to content

Commit 405c885

Browse files
committed
fix(tests): add assertions to debug CI failures
1 parent f7627d8 commit 405c885

File tree

1 file changed

+60
-9
lines changed

1 file changed

+60
-9
lines changed

tests/workflow_onboarding.rs

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,45 @@ fn github_setup_clones_existing_repo() -> Result<()> {
205205
.output()?;
206206

207207
// Commit and push to "remote"
208-
std::process::Command::new("git")
208+
let add_output = std::process::Command::new("git")
209209
.args(["add", "."])
210210
.current_dir(&temp_repo)
211211
.output()?;
212-
std::process::Command::new("git")
212+
assert!(
213+
add_output.status.success(),
214+
"git add failed: {:?}",
215+
String::from_utf8_lossy(&add_output.stderr)
216+
);
217+
218+
let commit_output = std::process::Command::new("git")
213219
.args(["commit", "-m", "initial"])
214220
.current_dir(&temp_repo)
215221
.output()?;
216-
std::process::Command::new("git")
222+
assert!(
223+
commit_output.status.success(),
224+
"git commit failed: {:?}",
225+
String::from_utf8_lossy(&commit_output.stderr)
226+
);
227+
228+
let remote_output = std::process::Command::new("git")
217229
.args(["remote", "add", "origin", remote_path.to_str().unwrap()])
218230
.current_dir(&temp_repo)
219231
.output()?;
220-
std::process::Command::new("git")
232+
assert!(
233+
remote_output.status.success(),
234+
"git remote add failed: {:?}",
235+
String::from_utf8_lossy(&remote_output.stderr)
236+
);
237+
238+
let push_output = std::process::Command::new("git")
221239
.args(["push", "-u", "origin", "HEAD:main"])
222240
.current_dir(&temp_repo)
223241
.output()?;
242+
assert!(
243+
push_output.status.success(),
244+
"git push failed: {:?}",
245+
String::from_utf8_lossy(&push_output.stderr)
246+
);
224247

225248
// When: clone the "remote" repo
226249
let clone_path = base.join("cloned");
@@ -504,32 +527,60 @@ fn github_clone_existing_dotstate_repo() -> Result<()> {
504527
.output()?;
505528

506529
// Commit and push
507-
std::process::Command::new("git")
530+
let add_output = std::process::Command::new("git")
508531
.args(["add", "."])
509532
.current_dir(&temp_repo)
510533
.output()?;
511-
std::process::Command::new("git")
534+
assert!(
535+
add_output.status.success(),
536+
"git add failed: {:?}",
537+
String::from_utf8_lossy(&add_output.stderr)
538+
);
539+
540+
let commit_output = std::process::Command::new("git")
512541
.args(["commit", "-m", "initial dotstate setup"])
513542
.current_dir(&temp_repo)
514543
.output()?;
515-
std::process::Command::new("git")
544+
assert!(
545+
commit_output.status.success(),
546+
"git commit failed: {:?}",
547+
String::from_utf8_lossy(&commit_output.stderr)
548+
);
549+
550+
let remote_output = std::process::Command::new("git")
516551
.args(["remote", "add", "origin", remote_path.to_str().unwrap()])
517552
.current_dir(&temp_repo)
518553
.output()?;
519-
std::process::Command::new("git")
554+
assert!(
555+
remote_output.status.success(),
556+
"git remote add failed: {:?}",
557+
String::from_utf8_lossy(&remote_output.stderr)
558+
);
559+
560+
let push_output = std::process::Command::new("git")
520561
.args(["push", "-u", "origin", "HEAD:main"])
521562
.current_dir(&temp_repo)
522563
.output()?;
564+
assert!(
565+
push_output.status.success(),
566+
"git push failed: {:?}",
567+
String::from_utf8_lossy(&push_output.stderr)
568+
);
523569

524570
// When: clone
525571
let clone_path = base.join("cloned");
526-
std::process::Command::new("git")
572+
let clone_output = std::process::Command::new("git")
527573
.args([
528574
"clone",
529575
remote_path.to_str().unwrap(),
530576
clone_path.to_str().unwrap(),
531577
])
532578
.output()?;
579+
assert!(
580+
clone_output.status.success(),
581+
"git clone failed: {:?}",
582+
String::from_utf8_lossy(&clone_output.stderr)
583+
);
533584

534585
// Then: recognizes existing setup
535586
let loaded_manifest = dotstate::utils::profile_manifest::ProfileManifest::load(&clone_path)?;

0 commit comments

Comments
 (0)