Skip to content

NC | Unit tests suggestions and refactoring #8056

@romayalon

Description

@romayalon

Environment info

  • NooBaa Version: 5.17
  • Platform: NC

Unit tests refactoring ideas

  • 1. CLI validations unit tests - as mentioned in NC | Health fix cli arguments validation and some small fixes #8052 (comment) - currently CLI validations unit tests are scattered in different files, we should have a single unit test file for CLI argument validations.
  • 2. test_bucketspace.js should be renamed to test_nsfs_integrations.js test_s3_on_nsfs_flow.js or something similar as it is not actually a unit test file but it provides integration tests - will be fixed by NC | NSFS | Add stat to bucket_namespace_cache #8527
  • 3. Full RPM/Linux flow tests - install, upgrade, health, syslog.
  • 4. Metrics tests.
  • 5. Add more existing s3 tests to nc_index.js (currently commented).
  • 6. S3 concurrency tests - bucket/objects scale 1000. Concurrent ops example for buckets: create, list, delete.
  • 7. CLI concurrency tests - bucket/account scale 1000. Concurrent ops example for buckets: create, list, delete, health.
  • 8. Remove duplicate code - like exec_manage_cli() and other functions used by mocha/jest i different ways.
  • 9. Add tests to every function in configFS.
  • 10. Move variables name of constant to a place where we can reuse them in test_utils for example:
    const buckets_dir_name = '/buckets/';
    const identities_dir_name = '/identities/';
    const accounts_by_name = '/accounts_by_name/';
    const access_keys_dir_name = '/access_keys/';
    const system_json = '/system.json';
  • 11. Move the fail function that we have copies in many files to one place and reuse it, for example:
    // Jest has builtin function fail that based on Jasmine
    // in case Jasmine would get removed from jest, created this one
    // based on this: https://stackoverflow.com/a/55526098/16571658
    function fail(reason) {
    throw new Error(reason);
    }
  • 12. Rename the file test_nc_nsfs_bucket_cli.test.js to test_nc_bucket_cli.test.js (notice that we also have the file test_nc_nsfs_account_cli.test.js and we also need to update the CI&Tests.md) - will be fixed by NC | Test Files | Remove nsfs From File Name and Update Docs #8780.
  • 13. Events tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions