Skip to content

Commit

Permalink
Docs + JSDocs added
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed Nov 20, 2024
1 parent 7195892 commit 4a6cd51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/NooBaaNonContainerized/CI&Tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand All @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions src/test/unit_tests/nc_coretest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -139,13 +147,20 @@ 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;
await announce('stop nsfs script');
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;
}
Expand Down

0 comments on commit 4a6cd51

Please sign in to comment.