From abe2686caf5e809f33c7b2177904d35ecb4706ed Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 14 Aug 2014 17:05:01 -0700 Subject: [PATCH] Fix issues related to git updates We observed that after updating the git repo in a test, unless we waited for 1s, we got intermittent cases where a subsequent update of the git source would not pick up the changes. We observed this both with the git CLI and the branch using libgit2. There may be a better solution, but we did not find it. --- tests/test_cargo_compile_git_deps.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index 107c6aa05..d20bbbfdf 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -1,4 +1,6 @@ use std::io::File; +use std::io::timer; +use std::time::Duration; use support::{ProjectBuilder, ResultTest, project, execs, main_file, paths}; use support::{cargo_dir, path2url}; @@ -659,6 +661,9 @@ test!(update_with_shared_deps { git_project.process("git").args(["add", "."]).exec_with_output().assert(); git_project.process("git").args(["commit", "-m", "test"]).exec_with_output() .assert(); + + timer::sleep(Duration::milliseconds(1000)); + assert_that(p.process(cargo_dir().join("cargo-update")).arg("dep1"), execs().with_stdout(format!("{} git repository `{}`", UPDATING, @@ -824,6 +829,9 @@ test!(stale_cached_version { bar.process("git").args(["add", "."]).exec_with_output().assert(); bar.process("git").args(["commit", "-m", "test"]).exec_with_output() .assert(); + + timer::sleep(Duration::milliseconds(1000)); + let rev = bar.process("git").args(["rev-parse", "HEAD"]) .exec_with_output().assert(); let rev = String::from_utf8(rev.output).unwrap();