mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-12 07:14:38 +00:00
tests: fix flakiness in shallow Git repo test
Some checks are pending
binaries / Build binary artifacts (linux-aarch64-gnu, ubuntu-24.04, aarch64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-aarch64-musl, ubuntu-24.04, aarch64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-gnu, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-musl, ubuntu-24.04, x86_64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (macos-aarch64, macos-14, aarch64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (macos-x86_64, macos-13, x86_64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (win-x86_64, windows-2022, x86_64-pc-windows-msvc) (push) Waiting to run
nix / flake check (macos-14) (push) Waiting to run
nix / flake check (ubuntu-latest) (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with Poetry 1.8 (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Some checks are pending
binaries / Build binary artifacts (linux-aarch64-gnu, ubuntu-24.04, aarch64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-aarch64-musl, ubuntu-24.04, aarch64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-gnu, ubuntu-24.04, x86_64-unknown-linux-gnu) (push) Waiting to run
binaries / Build binary artifacts (linux-x86_64-musl, ubuntu-24.04, x86_64-unknown-linux-musl) (push) Waiting to run
binaries / Build binary artifacts (macos-aarch64, macos-14, aarch64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (macos-x86_64, macos-13, x86_64-apple-darwin) (push) Waiting to run
binaries / Build binary artifacts (win-x86_64, windows-2022, x86_64-pc-windows-msvc) (push) Waiting to run
nix / flake check (macos-14) (push) Waiting to run
nix / flake check (ubuntu-latest) (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with Poetry 1.8 (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This test reliably failed if I dropped tv_nsec part from statx(). Since we reload the repo now, several assertions get "fixed". I've added index().has_id() test to clarify that it's still broken.
This commit is contained in:
parent
9ea91dc02a
commit
7be4904982
1 changed files with 9 additions and 5 deletions
|
@ -3485,6 +3485,7 @@ ignoreThisSection = foo
|
|||
fn test_shallow_commits_lack_parents() {
|
||||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init_with_backend(TestRepoBackend::Git);
|
||||
let test_env = &test_repo.env;
|
||||
let repo = &test_repo.repo;
|
||||
let git_repo = get_git_repo(repo);
|
||||
|
||||
|
@ -3515,8 +3516,10 @@ fn test_shallow_commits_lack_parents() {
|
|||
writeln!(buf, "{commit}").unwrap();
|
||||
}
|
||||
fs::write(shallow_file, buf).unwrap();
|
||||
// Reload the repo to invalidate mtime-based in-memory cache
|
||||
test_env.load_repo_at_head(&settings, test_repo.repo_path())
|
||||
};
|
||||
make_shallow(repo, vec![b.id(), c.id()]);
|
||||
let repo = make_shallow(repo, vec![b.id(), c.id()]);
|
||||
|
||||
let mut tx = repo.start_transaction(&settings);
|
||||
git::import_refs(tx.repo_mut(), &GitSettings::default()).unwrap();
|
||||
|
@ -3547,7 +3550,7 @@ fn test_shallow_commits_lack_parents() {
|
|||
);
|
||||
|
||||
// deepen the shallow clone
|
||||
make_shallow(&repo, vec![a.id()]);
|
||||
let repo = make_shallow(&repo, vec![a.id()]);
|
||||
|
||||
let mut tx = repo.start_transaction(&settings);
|
||||
git::import_refs(tx.repo_mut(), &GitSettings::default()).unwrap();
|
||||
|
@ -3560,15 +3563,16 @@ fn test_shallow_commits_lack_parents() {
|
|||
vec![root.clone()],
|
||||
"shallow commits have the root commit as a parent"
|
||||
);
|
||||
// TODO: These should be assert_eq!
|
||||
assert_ne!(
|
||||
assert_eq!(
|
||||
parents(store, &b),
|
||||
vec![jj_id(&a)],
|
||||
"unshallowed commits have parents"
|
||||
);
|
||||
assert_ne!(
|
||||
assert_eq!(
|
||||
parents(store, &c),
|
||||
vec![jj_id(&a)],
|
||||
"unshallowed commits have correct parents"
|
||||
);
|
||||
// FIXME: new ancestors should be indexed
|
||||
assert!(!repo.index().has_id(&jj_id(&a)));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue