From 69af33db6da00da4e1fab83cb77d3b92170629fc Mon Sep 17 00:00:00 2001 From: Prithvi Shahi Date: Wed, 27 Jan 2021 15:32:31 -0800 Subject: [PATCH 1/3] fix: The dfx replica command panics because it tries to write the replica-pid to a nonexistent replica-configuration directory --- src/dfx/src/commands/replica.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dfx/src/commands/replica.rs b/src/dfx/src/commands/replica.rs index 8e1153a74e..8da68dc9f2 100644 --- a/src/dfx/src/commands/replica.rs +++ b/src/dfx/src/commands/replica.rs @@ -125,13 +125,16 @@ pub fn exec(env: &dyn Environment, opts: ReplicaOpts) -> DfxResult { }) .start(); + let replica_configuration_dir = env.get_temp_dir().join("replica-configuration"); + std::fs::create_dir_all(&replica_configuration_dir)?; + let _replica_addr = actors::replica::Replica::new(actors::replica::Config { ic_starter_path: ic_starter_pathbuf, replica_config: config, replica_path: replica_pathbuf, shutdown_controller, logger: Some(env.get_logger().clone()), - replica_configuration_dir: env.get_temp_dir().join("replica-configuration"), + replica_configuration_dir, }) .start(); From d803835c0354953551a1d2984c1930377eb227ab Mon Sep 17 00:00:00 2001 From: Prithvi Shahi Date: Wed, 27 Jan 2021 15:47:02 -0800 Subject: [PATCH 2/3] suddenly this file does not exist? --- e2e/tests-dfx/signals.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/tests-dfx/signals.bash b/e2e/tests-dfx/signals.bash index f7b9451966..f209945935 100644 --- a/e2e/tests-dfx/signals.bash +++ b/e2e/tests-dfx/signals.bash @@ -31,6 +31,7 @@ dfx_replica_kills_replica() { # wait for replica to start assert_file_eventually_exists .dfx/config/port.txt 15s + assert_file_eventually_exists .dfx/replica-configuration/replica-pid 15s kill -$signal $DFX_PID From 638d0081738d997a5d602b985a3299f74e2da3f8 Mon Sep 17 00:00:00 2001 From: Prithvi Shahi Date: Fri, 29 Jan 2021 14:19:41 -0800 Subject: [PATCH 3/3] fix assertions --- e2e/tests-dfx/signals.bash | 1 - e2e/utils/assertions.bash | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/tests-dfx/signals.bash b/e2e/tests-dfx/signals.bash index f209945935..f7b9451966 100644 --- a/e2e/tests-dfx/signals.bash +++ b/e2e/tests-dfx/signals.bash @@ -31,7 +31,6 @@ dfx_replica_kills_replica() { # wait for replica to start assert_file_eventually_exists .dfx/config/port.txt 15s - assert_file_eventually_exists .dfx/replica-configuration/replica-pid 15s kill -$signal $DFX_PID diff --git a/e2e/utils/assertions.bash b/e2e/utils/assertions.bash index 4faca9a149..66d0e5df7f 100644 --- a/e2e/utils/assertions.bash +++ b/e2e/utils/assertions.bash @@ -149,7 +149,7 @@ assert_process_exits() { # Asserts that `dfx start` and `replica` are no longer running assert_no_dfx_start_or_replica_processes() { ! ( ps | grep "[/[:space:]]dfx start" ) - ! ( ps | cat .dfx/replica-configuration/replica-pid ) + ! ( kill -0 $(cat .dfx/replica-configuration/replica-pid) 2>/dev/null ) } assert_file_eventually_exists() {