@@ -23,11 +23,13 @@ const DEFAULT_FS_CONFIG = get_process_fs_context();
23
23
const config_fs_account_options = { show_secrets : true , decrypt_secret_key : true } ;
24
24
const root_path = path . join ( tmp_fs_path , 'root_path_manage_nsfs/' ) ;
25
25
const config_root = path . join ( tmp_fs_path , 'config_root_manage_nsfs' ) ;
26
+ const config_root_empty = path . join ( tmp_fs_path , 'config_root_manage_nsfs_empty' ) ;
26
27
const config_fs = new ConfigFS ( config_root ) ;
27
28
// TODO: needed for NC_CORETEST FLOW - should be handled better
28
29
const nc_coretest_master_key_location = config . NC_MASTER_KEYS_FILE_LOCATION ;
29
30
30
31
set_nc_config_dir_in_config ( config_root ) ;
32
+ set_nc_config_dir_in_config ( config_root_empty ) ;
31
33
32
34
mocha . describe ( 'manage_nsfs cli' , function ( ) {
33
35
@@ -37,6 +39,7 @@ mocha.describe('manage_nsfs cli', function() {
37
39
} ) ;
38
40
mocha . after ( async ( ) => {
39
41
await fs_utils . folder_delete ( `${ config_root } ` ) ;
42
+ await fs_utils . folder_delete ( `${ config_root_empty } ` ) ;
40
43
await fs_utils . folder_delete ( `${ root_path } ` ) ;
41
44
await fs_utils . file_delete ( path . join ( config_root , 'master_keys.json' ) ) ;
42
45
config . NC_MASTER_KEYS_FILE_LOCATION = nc_coretest_master_key_location ;
@@ -1055,6 +1058,16 @@ mocha.describe('manage_nsfs cli', function() {
1055
1058
assert_error ( err , ManageCLIError . InvalidArgument ) ;
1056
1059
}
1057
1060
} ) ;
1061
+
1062
+ mocha . it ( 'cli add whitelist config file doesnt exist' , async function ( ) {
1063
+ const new_config_options = { } ;
1064
+ const ips = [ '127.0.0.1' ] ; // IPV4 format
1065
+ const res = await exec_manage_cli ( type , '' , { config_root : config_root_empty , ips : JSON . stringify ( ips ) } ) ;
1066
+ new_config_options . S3_SERVER_IP_WHITELIST = ips ;
1067
+ const config_data = await config_fs . get_config_data ( path . join ( config_root_empty , 'config.json' ) ) ;
1068
+ await assert_response ( '' , type , res , ips ) ;
1069
+ assert_whitelist ( config_data , new_config_options ) ;
1070
+ } ) ;
1058
1071
} ) ;
1059
1072
1060
1073
} ) ;
0 commit comments