diff --git a/docs/NooBaaNonContainerized/CI&Tests.md b/docs/NooBaaNonContainerized/CI&Tests.md index 0c8eb776cd..857bd01e4f 100644 --- a/docs/NooBaaNonContainerized/CI&Tests.md +++ b/docs/NooBaaNonContainerized/CI&Tests.md @@ -90,6 +90,7 @@ The following is a list of `NC mocha test` files - 1. `test_nc_nsfs_cli.js` - Tests NooBaa CLI. 2. `test_nc_nsfs_health` - Tests NooBaa Health CLI. 3. `test_nsfs_glacier_backend.js` - Tests NooBaa Glacier Backend. +4. `test_nc_with_a_couple_of_forks.js` - Tests the `bucket_namespace_cache` when running with a couple of forks. Please notice that it uses `nc_coretest` with setup that includes a couple of forks. #### NC Jest test files The following is a list of `NC jest tests` files - @@ -110,6 +111,7 @@ The following is a list of `NC jest tests` files - #### nc_index.js File * The `nc_index.js` is a file that runs several NC and NSFS mocha related tests. * Before running NC tests, `nc_coretest` setup will be called, and after the run of all tests, `nc_coretest` teardown will be executed. +* Tip for developers: if you want to run all the NC tests you can run: `sudo NC_CORETEST=true node ./node_modules/mocha/bin/mocha src/test/unit_tests/nc_index.js` (instead of waiting for the image to build and run them in a container using `make run-nc-tests`). The tests will run according to the list. Please notice that in this file there's a part where the `nc_coretest` setup changed (see comment about `test_nc_with_a_couple_of_forks.js`) and add new test files according to the setup you need, probably in the first part with the default setup. #### nc_coretest.js File * The `nc_coretest.js` is a file that runs setup and teardown before/after NC integration tests run. diff --git a/src/test/unit_tests/nc_coretest.js b/src/test/unit_tests/nc_coretest.js index 666596b031..6c15818bc9 100644 --- a/src/test/unit_tests/nc_coretest.js +++ b/src/test/unit_tests/nc_coretest.js @@ -64,6 +64,7 @@ let current_setup_options = {}; /** * setup will setup nc coretest + * currently the setup_options we use are for the nsfs process: fork and debug * @param {object} setup_options */ function setup(setup_options = {}) { @@ -99,6 +100,13 @@ function setup(setup_options = {}) { }); } +/** + * start_nsfs_process starts the NSFS process and attach the logs in a file + * the setup_options we support: + * 1. forks (number of processes to run) + * 2. debug (for logs printing level) + * @param {object} setup_options + */ async function start_nsfs_process(setup_options) { console.log(`in start_nsfs_process - variables values: _setup ${_setup} _nsfs_process ${_nsfs_process}`); const { forks, debug } = setup_options; @@ -139,6 +147,9 @@ async function start_nsfs_process(setup_options) { await P.delay(5000); } +/** + * stop_nsfs_process stops the NSFS + */ async function stop_nsfs_process() { console.log(`in stop_nsfs_process - variables values: _setup ${_setup} _nsfs_process ${_nsfs_process}`); _nsfs_process = false; @@ -146,6 +157,10 @@ async function stop_nsfs_process() { if (nsfs_process) nsfs_process.kill('SIGKILL'); } +/** + * get_current_setup_options returns the current_setup_options + * currently the setup_options we use are for the nsfs process: fork and debug + */ function get_current_setup_options() { return current_setup_options; }