@@ -23,11 +23,13 @@ const DEFAULT_FS_CONFIG = get_process_fs_context();
2323const config_fs_account_options = { show_secrets : true , decrypt_secret_key : true } ;
2424const root_path = path . join ( tmp_fs_path , 'root_path_manage_nsfs/' ) ;
2525const 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' ) ;
2627const config_fs = new ConfigFS ( config_root ) ;
2728// TODO: needed for NC_CORETEST FLOW - should be handled better
2829const nc_coretest_master_key_location = config . NC_MASTER_KEYS_FILE_LOCATION ;
2930
3031set_nc_config_dir_in_config ( config_root ) ;
32+ set_nc_config_dir_in_config ( config_root_empty ) ;
3133
3234mocha . describe ( 'manage_nsfs cli' , function ( ) {
3335
@@ -37,6 +39,7 @@ mocha.describe('manage_nsfs cli', function() {
3739 } ) ;
3840 mocha . after ( async ( ) => {
3941 await fs_utils . folder_delete ( `${ config_root } ` ) ;
42+ await fs_utils . folder_delete ( `${ config_root_empty } ` ) ;
4043 await fs_utils . folder_delete ( `${ root_path } ` ) ;
4144 await fs_utils . file_delete ( path . join ( config_root , 'master_keys.json' ) ) ;
4245 config . NC_MASTER_KEYS_FILE_LOCATION = nc_coretest_master_key_location ;
@@ -1055,6 +1058,16 @@ mocha.describe('manage_nsfs cli', function() {
10551058 assert_error ( err , ManageCLIError . InvalidArgument ) ;
10561059 }
10571060 } ) ;
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+ } ) ;
10581071 } ) ;
10591072
10601073} ) ;
0 commit comments