File tree Expand file tree Collapse file tree 3 files changed +5
-25
lines changed
Expand file tree Collapse file tree 3 files changed +5
-25
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,11 @@ impl PocketIcBuilder {
347347 /// `-- tmp
348348 pub fn with_subnet_state ( mut self , subnet_kind : SubnetKind , path_to_state : PathBuf ) -> Self {
349349 let mut config = self . config . unwrap_or_default ( ) ;
350- let subnet_spec = SubnetSpec :: default ( ) . with_state_dir ( path_to_state) ;
350+ #[ cfg( not( windows) ) ]
351+ let state_dir = path_to_state;
352+ #[ cfg( windows) ]
353+ let state_dir = wsl_path ( & path_to_state, "subnet state" ) . into ( ) ;
354+ let subnet_spec = SubnetSpec :: default ( ) . with_state_dir ( state_dir) ;
351355 match subnet_kind {
352356 SubnetKind :: NNS => config. nns = Some ( subnet_spec) ,
353357 SubnetKind :: SNS => config. sns = Some ( subnet_spec) ,
Original file line number Diff line number Diff line change @@ -34,8 +34,6 @@ use std::collections::BTreeMap;
3434use std:: io:: Read ;
3535use std:: time:: Duration ;
3636use tempfile:: TempDir ;
37- #[ cfg( windows) ]
38- use wslpath:: windows_to_wsl;
3937
4038mod common;
4139
@@ -1020,12 +1018,7 @@ fn read_registry() {
10201018) ]
10211019fn with_all_icp_features_and_nns_state ( ) {
10221020 let state_dir = TempDir :: new ( ) . unwrap ( ) ;
1023- #[ cfg( not( windows) ) ]
10241021 let state_dir_path_buf = state_dir. path ( ) . to_path_buf ( ) ;
1025- #[ cfg( windows) ]
1026- let state_dir_path_buf = windows_to_wsl ( state_dir. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) )
1027- . unwrap ( )
1028- . into ( ) ;
10291022
10301023 let _pic = PocketIcBuilder :: new ( )
10311024 . with_icp_features ( all_icp_features ( ) )
@@ -1036,12 +1029,7 @@ fn with_all_icp_features_and_nns_state() {
10361029#[ tokio:: test]
10371030async fn with_all_icp_features_and_nns_subnet_state ( ) {
10381031 let state_dir = TempDir :: new ( ) . unwrap ( ) ;
1039- #[ cfg( not( windows) ) ]
10401032 let state_dir_path_buf = state_dir. path ( ) . to_path_buf ( ) ;
1041- #[ cfg( windows) ]
1042- let state_dir_path_buf = windows_to_wsl ( state_dir. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) )
1043- . unwrap ( )
1044- . into ( ) ;
10451033
10461034 let ( _, url) = start_server ( StartServerParams :: default ( ) ) . await ;
10471035 let client = reqwest:: Client :: new ( ) ;
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ use std::{
3030 time:: { Duration , SystemTime } ,
3131} ;
3232use tempfile:: { NamedTempFile , TempDir } ;
33- #[ cfg( windows) ]
34- use wslpath:: windows_to_wsl;
3533
3634mod common;
3735
@@ -2783,12 +2781,7 @@ fn test_specified_id_on_resumed_state() {
27832781#[ should_panic( expected = "is not a (subnet state) directory" ) ]
27842782fn with_subnet_state_file ( ) {
27852783 let state_file = NamedTempFile :: new ( ) . unwrap ( ) ;
2786- #[ cfg( not( windows) ) ]
27872784 let state_file_path_buf = state_file. path ( ) . to_path_buf ( ) ;
2788- #[ cfg( windows) ]
2789- let state_file_path_buf = windows_to_wsl ( state_file. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) )
2790- . unwrap ( )
2791- . into ( ) ;
27922785
27932786 let _pic = PocketIcBuilder :: new ( )
27942787 . with_subnet_state ( SubnetKind :: Application , state_file_path_buf)
@@ -2799,12 +2792,7 @@ fn with_subnet_state_file() {
27992792#[ should_panic( expected = "Provided an empty state directory at path" ) ]
28002793fn with_empty_subnet_state ( ) {
28012794 let state_dir = TempDir :: new ( ) . unwrap ( ) ;
2802- #[ cfg( not( windows) ) ]
28032795 let state_dir_path_buf = state_dir. path ( ) . to_path_buf ( ) ;
2804- #[ cfg( windows) ]
2805- let state_dir_path_buf = windows_to_wsl ( state_dir. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) )
2806- . unwrap ( )
2807- . into ( ) ;
28082796
28092797 let _pic = PocketIcBuilder :: new ( )
28102798 . with_subnet_state ( SubnetKind :: Application , state_dir_path_buf)
You can’t perform that action at this time.
0 commit comments