Skip to content

Commit 5d2c65d

Browse files
fix(tests): preserve platform daemon lifecycle
1 parent 2ab7a9f commit 5d2c65d

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

tests/core_cli_suite/cli_non_interactive_test.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use tracedecay::storage::{
2222
profile_sharded_layout, read_enrollment_marker, write_enrollment_marker,
2323
write_repository_identity_marker, write_store_manifest,
2424
};
25+
use tracedecay::tracedecay::{TraceDecay, TraceDecayOpenOptions};
2526

2627
fn canonical_temp_path(path: &Path) -> PathBuf {
2728
path.canonicalize().unwrap_or_else(|_| path.to_path_buf())
@@ -101,16 +102,20 @@ fn add_tracedecay_path_shim(command: &mut Command, home: &Path) -> PathBuf {
101102
/// not the behaviour under test.
102103
fn init_project_in_process(home: &Path, project: &Path) {
103104
let project = canonical_temp_path(project);
104-
let output = tracedecay_command(home, &project)
105-
.arg("init")
106-
.output()
105+
let profile_root = profile_root(home);
106+
create_runtime().block_on(async {
107+
let cg = TraceDecay::init_with_options(
108+
&project,
109+
TraceDecayOpenOptions {
110+
global_db_path: Some(profile_root.join("global.db")),
111+
profile_root: Some(profile_root),
112+
},
113+
)
114+
.await
107115
.expect("fixture init should run");
108-
assert!(
109-
output.status.success(),
110-
"fixture init failed\nstdout:\n{}\nstderr:\n{}",
111-
String::from_utf8_lossy(&output.stdout),
112-
String::from_utf8_lossy(&output.stderr)
113-
);
116+
cg.checkpoint().await.expect("fixture checkpoint");
117+
cg.close();
118+
});
114119
}
115120

116121
fn git(project: &Path, args: &[&str]) {
@@ -1591,6 +1596,7 @@ fn branch_add_writes_new_branch_db_into_profile_shard() {
15911596
git(&project_root, &["checkout", "-b", "feature/new"]);
15921597
let project_id = default_profile_project_id(&project_root);
15931598
let shard_root = profile_sharded_data_root(&profile_root(home.path()), &project_id);
1599+
#[cfg(unix)]
15941600
let _daemon = crate::common::spawn_tracedecay_daemon(home.path());
15951601
let mut command = tracedecay_command_without_daemon(home.path(), &project_root);
15961602
command.args(["branch", "add", "feature/new"]);

0 commit comments

Comments
 (0)