@@ -29,6 +29,9 @@ console.log('test_nc_lifecycle_cli: replacing old umask: ', old_umask.toString(8
29
29
const config_root = path . join ( TMP_PATH , 'config_root_nc_lifecycle' ) ;
30
30
const root_path = path . join ( TMP_PATH , 'root_path_nc_lifecycle/' ) ;
31
31
const config_fs = new ConfigFS ( config_root ) ;
32
+ const account_options1 = { uid : 2002 , gid : 2002 , new_buckets_path : root_path , name : 'user2' , config_root, allow_bucket_creation : 'true' } ;
33
+ const test_bucket = 'test-bucket' ;
34
+ const test_bucket1 = 'test-bucket1' ;
32
35
33
36
const yesterday = new Date ( ) ;
34
37
yesterday . setDate ( yesterday . getDate ( ) - 1 ) ; // yesterday
@@ -138,15 +141,13 @@ describe('noobaa cli - lifecycle - lock check', () => {
138
141
139
142
describe ( 'noobaa cli - lifecycle' , ( ) => {
140
143
const bucketspace_fs = new BucketSpaceFS ( { config_root } , undefined ) ;
141
- const test_bucket = 'test-bucket' ;
142
144
const test_bucket_path = `${ root_path } /${ test_bucket } ` ;
143
145
const test_bucket2 = 'test-bucket2' ;
144
146
const test_bucket2_path = `${ root_path } /${ test_bucket2 } ` ;
145
147
const test_key1 = 'test_key1' ;
146
148
const test_key2 = 'test_key2' ;
147
149
const prefix = 'test/' ;
148
150
const test_prefix_key = `${ prefix } /test_key1` ;
149
- const account_options1 = { uid : 2002 , gid : 2002 , new_buckets_path : root_path , name : 'user2' , config_root, allow_bucket_creation : 'true' } ;
150
151
let dummy_sdk ;
151
152
let nsfs ;
152
153
@@ -439,6 +440,15 @@ describe('noobaa cli lifecycle - timeout check', () => {
439
440
await fs_utils . create_fresh_path ( config_root , 0o777 ) ;
440
441
set_nc_config_dir_in_config ( config_root ) ;
441
442
await fs_utils . create_fresh_path ( root_path , 0o777 ) ;
443
+ const res = await exec_manage_cli ( TYPES . ACCOUNT , ACTIONS . ADD , account_options1 ) ;
444
+ const json_account = JSON . parse ( res ) . response . reply ;
445
+ console . log ( json_account ) ;
446
+ const object_sdk = new NsfsObjectSDK ( '' , config_fs , json_account , "DISABLED" , config_fs . config_root , undefined ) ;
447
+ object_sdk . requesting_account = json_account ;
448
+ // don't delete this bucket creation - it's being used for making sure that the lifecycle run will take more than 1 ms
449
+ await object_sdk . create_bucket ( { name : test_bucket } ) ;
450
+ await object_sdk . create_bucket ( { name : test_bucket1 } ) ;
451
+
442
452
} ) ;
443
453
444
454
afterEach ( async ( ) => {
@@ -455,19 +465,18 @@ describe('noobaa cli lifecycle - timeout check', () => {
455
465
await config_fs . create_config_json_file ( JSON . stringify ( { NC_LIFECYCLE_TIMEOUT_MS : 1 } ) ) ;
456
466
const res1 = await exec_manage_cli ( TYPES . LIFECYCLE , '' , { disable_service_validation : 'true' , disable_runtime_validation : 'true' , config_root } , true , undefined ) ;
457
467
await config_fs . delete_config_json_file ( ) ;
458
- const parsed_res1 = JSON . parse ( res1 . stdout ) . error ;
459
- expect ( parsed_res1 . code ) . toBe ( ManageCLIError . LifecycleWorkerReachedTimeout . code ) ;
460
- expect ( parsed_res1 . message ) . toBe ( ManageCLIError . LifecycleWorkerReachedTimeout . message ) ;
468
+ const parsed_res1 = JSON . parse ( res1 . stdout ) ;
469
+ const actual_error = parsed_res1 . error ;
470
+ expect ( actual_error . code ) . toBe ( ManageCLIError . LifecycleWorkerReachedTimeout . code ) ;
471
+ expect ( actual_error . message ) . toBe ( ManageCLIError . LifecycleWorkerReachedTimeout . message ) ;
461
472
} ) ;
462
473
} ) ;
463
474
464
475
describe ( 'noobaa cli - lifecycle batching' , ( ) => {
465
476
const bucketspace_fs = new BucketSpaceFS ( { config_root } , undefined ) ;
466
- const test_bucket = 'test-bucket' ;
467
477
const test_bucket_path = `${ root_path } /${ test_bucket } ` ;
468
478
const test_key1 = 'test_key1' ;
469
479
const test_key2 = 'test_key2' ;
470
- const account_options1 = { uid : 2002 , gid : 2002 , new_buckets_path : root_path , name : 'user2' , config_root, allow_bucket_creation : 'true' } ;
471
480
let object_sdk ;
472
481
const tmp_lifecycle_logs_dir_path = path . join ( root_path , 'test_lifecycle_logs' ) ;
473
482
@@ -634,7 +643,7 @@ describe('noobaa cli - lifecycle batching', () => {
634
643
try {
635
644
await exec_manage_cli ( TYPES . LIFECYCLE , '' , { disable_service_validation : 'true' , disable_runtime_validation : 'true' , config_root} , undefined , undefined ) ;
636
645
} catch ( e ) {
637
- //ignore error
646
+ //ignore timout error
638
647
}
639
648
await exec_manage_cli ( TYPES . LIFECYCLE , '' , { continue : 'true' , disable_service_validation : 'true' , disable_runtime_validation : 'true' , config_root} , undefined , undefined ) ;
640
649
const object_list2 = await object_sdk . list_objects ( { bucket : test_bucket } ) ;
@@ -687,11 +696,9 @@ describe('noobaa cli - lifecycle batching', () => {
687
696
} ) ;
688
697
689
698
describe ( 'noobaa cli - lifecycle notifications' , ( ) => {
690
- const test_bucket = 'test-bucket' ;
691
699
const test_bucket_path = `${ root_path } /${ test_bucket } ` ;
692
700
const test_key1 = 'test_key1' ;
693
701
const test_key2 = 'test_key2' ;
694
- const account_options1 = { uid : 2002 , gid : 2002 , new_buckets_path : root_path , name : 'user2' , config_root, allow_bucket_creation : 'true' } ;
695
702
let object_sdk ;
696
703
const tmp_lifecycle_logs_dir_path = path . join ( root_path , 'test_lifecycle_notifications_logs' ) ;
697
704
const tmp_conn_dir_path = path . join ( root_path , 'test_notification_logs' ) ;
0 commit comments