wazuh / wazuh-api

Wazuh - RESTful API
https://wazuh.com
GNU General Public License v2.0
68 stars 57 forks source link

Fix and update mocha tests for 3.13 #490

Closed davidjiglesias closed 4 years ago

davidjiglesias commented 4 years ago

Hello team,

This PR fixes and updates some mocha tests for Wazuh API 3.13. All test are passing except known failure with stats (not yet generated).

Test Results:

  Active Response
    PUT/active-response/:agent_id
(node:1181) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (337ms)
      ✓ Command not found (280ms)
      ✓ Agent does not exist (271ms)
      ✓ Agent ID not valid (79ms)

  4 passing (974ms)

[mochawesome] Report JSON saved to /share/active_response.json

[mochawesome] Report HTML saved to /share/active_response.html

  Agents
    GET/agents
(node:1197) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (270ms)
      ✓ Pagination (279ms)
      ✓ Retrieve all elements with limit=0 (271ms)
      ✓ Sort (273ms)
      ✓ Wrong Sort (272ms)
      ✓ Search (277ms)
      ✓ Selector (271ms)
      ✓ Not allowed selector (276ms)
      ✓ Version (282ms)
      ✓ Os.platform (295ms)
      ✓ Os.version (280ms)
      ✓ ManagerHost (284ms)
      ✓ Filters: status (280ms)
      ✓ Filters: status 2 (280ms)
      ✓ Filters: Invalid filter (82ms)
      ✓ Filters: Invalid filter - Extra field (79ms)
      ✓ Filters: older_than (291ms)
      ✓ Filters: group (281ms)
      ✓ Select: single field (280ms)
      ✓ Select: multiple fields (308ms)
      ✓ Select: wrong field (279ms)
      ✓ Select: invalid character (79ms)
      ✓ Filters: query (290ms)
    GET/agents/summary
      ✓ Request (294ms)
    GET/agents/summary/os
      ✓ Request (283ms)
    GET/agents/outdated
      ✓ Request (287ms)
    GET/agents/:agent_id
      ✓ Request (manager) (272ms)
      ✓ Request (agent) (279ms)
      ✓ Selector (306ms)
      ✓ Not allowed selector (288ms)
      ✓ Params: Bad agent id (80ms)
      ✓ Errors: No agent (311ms)
      ✓ Select (298ms)
      ✓ Select: wrong field (297ms)
    GET/agents/name/:agent_name
      ✓ Request (274ms)
      ✓ Wrong name (271ms)
      ✓ Selector (270ms)
      ✓ Not allowed selector (285ms)
    GET/agents/:agent_id/key
      ✓ Request (295ms)
      ✓ Params: Bad agent id (79ms)
      ✓ Errors: No key (284ms)
    PUT/agents/groups/:group_id
      ✓ Request (297ms)
      ✓ Params: Bad group name (80ms)
      ✓ Params: Group already exists (283ms)
    PUT/agents/:agent_id/group/:group_id
      ✓ Request (275ms)
      ✓ Params: Bad agent name (79ms)
      ✓ Params: Agent does not exist (269ms)
      ✓ Params: Replace parameter (284ms)
    POST/agents/groups/:group_id/files/:file_name
      ✓ Request (291ms)
      ✓ ErrorOnBadGroup (269ms)
      ✓ ErrorOnEmptyConf (89ms)
      ✓ OnlyAgentConfAllowed (287ms)
      ✓ InvalidConfDetected (81ms)
      ✓ WrongConfDetected (340ms)
      ✓ TooBigXML (137ms)
    GET/agents/no_group
      ✓ Request (315ms)
      ✓ Pagination (289ms)
      ✓ Retrieve all elements with limit=0 (284ms)
      ✓ Sort (303ms)
      ✓ Search (293ms)
      ✓ Select (289ms)
      ✓ Wrong select (280ms)
      ✓ Filter: status (282ms)
    GET/agents/groups
      ✓ Request (280ms)
      ✓ Retrieve all elements with limit=0 (271ms)
      ✓ Hash algorithm (289ms)
      ✓ Wrong Hash algorithm (273ms)
      ✓ Filters: query 1 (288ms)
      ✓ Filters: query 2 (290ms)
      ✓ Filters: query 3 (290ms)
    GET/agents/groups/:group_id
      ✓ Request (274ms)
      ✓ Params: Bad group name (77ms)
      ✓ Retrieve all elements with limit=0 (286ms)
      ✓ Select (294ms)
      ✓ Filter: status (282ms)
    GET/agents/groups/:group_id/configuration
      ✓ Request (295ms)
      ✓ Params: Bad group name (78ms)
      ✓ Retrieve all elements with limit=0 (275ms)
    GET/agents/groups/:group_id/files
      ✓ Request (293ms)
      ✓ Params: Bad group name (84ms)
      ✓ Retrieve all elements with limit=0 (277ms)
      ✓ Hash algorithm (274ms)
      ✓ Wrong Hash algorithm (277ms)
    GET/agents/groups/:group_id/files/:filename
      ✓ Request (284ms)
      ✓ UsingFormatAgentConfXML (278ms)
      ✓ UsingFormatAgentConfJSON (324ms)
      ✓ UsingFormatRootcheckXML (391ms)
      ✓ UsingFormatRootcheckJSON (287ms)
      ✓ Params: Bad group name (77ms)
    POST/agents/groups/:group_id/configuration
      ✓ Request (284ms)
      ✓ ErrorOnBadGroup (304ms)
      ✓ ErrorOnEmptyConf (91ms)
      ✓ InvalidConfDetected (103ms)
      ✓ WrongConfDetected (319ms)
      ✓ TooBigXML (151ms)
    DELETE/agents/:agent_id/group
      ✓ Request (290ms)
      ✓ Errors: ID is not present (280ms)
      ✓ Params: Bad agent id (80ms)
    DELETE/agents/:agent_id/group/:group_id
      ✓ Request (309ms)
      ✓ Errors: ID is not present (318ms)
      ✓ Errors: Group is not present (300ms)
      ✓ Params: Bad agent id (77ms)
      ✓ Params: Bad group id (274ms)
    DELETE/agents/groups/:group_id
      ✓ Request (281ms)
      ✓ Params: Bad group id (89ms)
    DELETE/agents
      ✓ Request (95ms)
      ✓ Filter: older_than, status and ids (3860ms)
      ✓ Errors: Get deleted agent (331ms)
      ✓ Filter: older_than (294ms)
    GET/agents/stats/distinct
      ✓ Request (287ms)
      ✓ Pagination (291ms)
      ✓ Retrieve all elements with limit=0 (282ms)
      ✓ Sort (279ms)
      ✓ Search (279ms)
      ✓ Select (288ms)
      ✓ Wrong select (274ms)
    GET/agents/:agent/config/:component/:configuration
      ✓ Request-Agent-Client (289ms)
      ✓ Request-Agent-Buffer (283ms)
      ✓ Request-Agent-Labels (286ms)
      ✓ Request-Agent-Internal (283ms)
      ✓ Request-Agentless-Agentless (275ms)
      ✓ Request-Analysis-Global (272ms)
      ✓ Request-Analysis-Active-response (277ms)
      ✓ Request-Analysis-Alerts (277ms)
      ✓ Request-Analysis-Command (277ms)
      ✓ Request-Analysis-Internal (280ms)
      ✓ Request-Auth-Auth (275ms)
      ✓ Request-Com-Active-response (277ms)
      ✓ Request-Com-Internal (281ms)
      ✓ Request-Csyslog-Csyslog (282ms)
      ✓ Request-Integrator-Integration (300ms)
      ✓ Request-Logcollector-Localfile (296ms)
      ✓ Request-Logcollector-Socket (284ms)
      ✓ Request-Logcollector-Internal (280ms)
      ✓ Request-Mail-Global (273ms)
      ✓ Request-Mail-Alerts (285ms)
      ✓ Request-Mail-Internal (280ms)
      ✓ Request-Monitor-Internal (281ms)
      ✓ Request-Request-Remote (269ms)
      ✓ Request-Request-Internal (270ms)
      ✓ Request-Syscheck-Syscheck (274ms)
      ✓ Request-Syscheck-Rootcheck (274ms)
      ✓ Request-Syscheck-Internal (274ms)
      ✓ Request-Wmodules-Wmodules (278ms)
    PUT/agents/restart
      ✓ Request (300ms)
    PUT/agents/:agent_id/restart
      ✓ Request (3285ms)
      ✓ Params: Bad agent id (77ms)
      ✓ Request (272ms)
    POST/agents/restart
      ✓ Request (2981ms)
      ✓ Params: A good id and a bad one (298ms)
      ✓ Params: Bad agent id (78ms)
      ✓ Request (280ms)
    PUT/agents/groups/:group_id/restart
      ✓ Request (2627ms)
      ✓ Params: Bad group id (272ms)
      ✓ Group without agents (263ms)

  155 passing (55s)

[mochawesome] Report JSON saved to /share/agents.json

[mochawesome] Report HTML saved to /share/agents.html

  Agents
    PUT/agents/:agent_name
(node:1493) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (286ms)
      ✓ Errors: Name already present (285ms)
      ✓ Params: Bad agent name (78ms)
      ✓ Params: New character (%) in agent name (286ms)
    DELETE/agents/:agent_id
      ✓ Request (323ms)
      ✓ Errors: ID is not present (295ms)
      ✓ Params: Bad agent id (78ms)
    POST/agents
      Any
        ✓ Request (309ms)
        ✓ Check key (279ms)
        ✓ Errors: Name already present (318ms)
        ✓ Filters: Missing field name (85ms)
        ✓ Filters: Invalid field (80ms)
      IP Automatic
        ✓ Request: Automatic IP (303ms)
        ✓ Errors: Duplicated IP (293ms)
      IP
        ✓ Request (280ms)
        ✓ Filters: Bad IP (80ms)
        ✓ Filters: Bad IP 2 (94ms)
    POST/agents/insert
      Any
        ✓ Request (371ms)
        ✓ Insert agent with force parameter (ID and name already presents) (318ms)
        ✓ Errors: Name already present (279ms)
        ✓ Errors: ID already present (344ms)
        ✓ Errors: Invalid key (291ms)
        ✓ Filters: Missing fields (80ms)
        ✓ Filters: Invalid field (91ms)
      IP Automatic
        ✓ Request: Automatic IP (281ms)
        ✓ Errors: Duplicated IP (293ms)
      IP
        ✓ Request (291ms)
        ✓ Filters: Bad IP (78ms)
        ✓ Filters: Bad IP 2 (79ms)

  29 passing (10s)

[mochawesome] Report JSON saved to /share/agents2.json

[mochawesome] Report HTML saved to /share/agents2.html

  App
    Authentication
(node:1568) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Wrong USER
      ✓ Wrong password (76ms)
      ✓ Home (78ms)
    Requests
      ✓ Inexistent request (79ms)
      ✓ API version (78ms)

  5 passing (349ms)

[mochawesome] Report JSON saved to /share/app.json

[mochawesome] Report HTML saved to /share/app.html

  Cluster
    GET/cluster/nodes
(node:1579) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (368ms)
      ✓ Pagination (308ms)
      ✓ Retrieve all elements with limit=0 (294ms)
      ✓ Sort (296ms)
      ✓ Search (299ms)
      ✓ Select (283ms)
      ✓ Select 2 (295ms)
      ✓ Wrong select (342ms)
      ✓ Filters: type (297ms)
      ✓ Filters: query 1 (309ms)
      ✓ Filters: query 2 (317ms)
      ✓ Filters: invalid type (292ms)
    GET/cluster/:node_id/stats
      1) Cluster stats
      ✓ Unexisting node stats (317ms)
      ✓ Analysisd stats (master) (308ms)
      ✓ Analysisd stats (worker-1) (369ms)
      ✓ Analysisd stats (worker-2) (323ms)
      ✓ Remoted stats (master) (309ms)
      ✓ Remoted stats (worker-1) (314ms)
      ✓ Remoted stats (worker-2) (317ms)
    GET/cluster/:node_id/logs
      ✓ Request (master) (333ms)
      ✓ Request (worker-1) (356ms)
      ✓ Request (worker-2) (367ms)
      ✓ Pagination (346ms)
      ✓ Sort (331ms)
      ✓ Search (321ms)
      ✓ Filters: type_log (309ms)
      ✓ Filters: category (301ms)
      ✓ Filters: query 1 (329ms)
      ✓ Filters: query 2 (314ms)
      ✓ Filters: query 3 (324ms)
      ✓ Filters: wrong query (88ms)
    GET/cluster/nodes/:node_name
      ✓ Request (306ms)
      ✓ Request wrong name (285ms)
    GET/cluster/status
      ✓ Request (293ms)
    GET/cluster/config
      ✓ Request (303ms)
    GET/cluster/healthcheck
      ✓ Request (303ms)
      ✓ Filter: node name (300ms)
    POST/cluster/:node_id/files
      ✓ Upload ossec.conf (master) (303ms)
      ✓ Upload ossec.conf (worker) (318ms)
      ✓ Upload new rules (293ms)
      ✓ Upload rules (overwrite=true) (279ms)
      ✓ Upload rules (overwrite=false) (279ms)
      ✓ Upload new decoder (275ms)
      ✓ Upload decoder (overwrite=true) (276ms)
      ✓ Upload decoder (without overwrite parameter) (275ms)
      ✓ Upload new list (276ms)
      ✓ Upload list (overwrite=true) (276ms)
      ✓ Upload list (overwrite=false) (272ms)
      ✓ Upload corrupted ossec.conf (master) (77ms)
      ✓ Upload corrupted ossec.conf (worker) (78ms)
      ✓ Upload malformed rules (82ms)
      ✓ Upload rules to unexisting node (293ms)
      ✓ Upload malformed decoder (77ms)
      ✓ Upload decoder to unexisting node (268ms)
      ✓ Upload malformed list (77ms)
      ✓ Upload list to unexisting node (289ms)
      ✓ Upload list with empty path (84ms)
      ✓ Upload a file with a wrong content type (80ms)
    GET/cluster/:node_id/files
      ✓ Request ossec.conf (master) (285ms)
      ✓ Request ossec.conf (worker) (274ms)
      ✓ Request rules (local) (271ms)
      ✓ Request rules (global) (287ms)
      ✓ Request decoders (local) (288ms)
      ✓ Request decoders (global) (269ms)
      ✓ Request lists (287ms)
      ✓ Request wrong path 1 (76ms)
      ✓ Request wrong path 2 (77ms)
      ✓ Request wrong path 3 (76ms)
      ✓ Request unexisting file (282ms)
      ✓ Request file from unexisting node (280ms)
      ✓ Request file with empty path (80ms)
      ✓ Request file with validation parameter (true) (276ms)
    GET/cluster/:node_id/configuration/validation (manager and worker OK)
      ✓ Request validation (master) (796ms)
      ✓ Request validation (worker) (772ms)
      ✓ Request validation (all nodes) (886ms)
    GET/cluster/:node_id/configuration/validation (manager KO, worker OK)
      ✓ Request validation (master) (282ms)
      ✓ Request validation (worker) (810ms)
      ✓ Request validation (all nodes) (813ms)
    GET/cluster/:node_id/configuration/validation (manager OK, worker KO)
      ✓ Request validation (master) (761ms)
      ✓ Request validation (worker) (284ms)
      ✓ Request validation (all nodes) (911ms)
    GET/cluster/:node_id/configuration/validation (manager and worker KO)
      ✓ Request validation (master) (276ms)
      ✓ Request validation (worker) (278ms)
      ✓ Request validation (all nodes) (285ms)
    DELETE/cluster/:node_id/files
      ✓ Delete rules (master) (271ms)
      ✓ Delete decoders (master) (267ms)
      ✓ Delete CDB list (master) (269ms)
      ✓ Delete file with empty path (76ms)
    GET/cluster/master/config/:component/:configuration
      ✓ Request-Agentless-Agentless (273ms)
      ✓ Request-Analysis-Global (271ms)
      ✓ Request-Analysis-Active-response (279ms)
      ✓ Request-Analysis-Alerts (272ms)
      ✓ Request-Analysis-Command (268ms)
      ✓ Request-Analysis-Internal (271ms)
      ✓ Request-Auth-Auth (267ms)
      ✓ Request-Com-Active-response (271ms)
      ✓ Request-Com-Internal (266ms)
      ✓ Request-Csyslog-Csyslog (269ms)
      ✓ Request-Integrator-Integration (275ms)
      ✓ Request-Logcollector-Localfile (277ms)
      ✓ Request-Logcollector-Socket (276ms)
      ✓ Request-Logcollector-Internal (278ms)
      ✓ Request-Mail-Global (269ms)
      ✓ Request-Mail-Alerts (270ms)
      ✓ Request-Mail-Internal (271ms)
      ✓ Request-Monitor-Internal (297ms)
      ✓ Request-Request-Remote (283ms)
      ✓ Request-Request-Internal (281ms)
      ✓ Request-Syscheck-Syscheck (274ms)
      ✓ Request-Syscheck-Rootcheck (275ms)
      ✓ Request-Syscheck-Internal (275ms)
      ✓ Request-Wmodules-Wmodules (279ms)
    PUT/cluster/:node_id/restart
      ✓ Request (worker) (278ms)
      ✓ Request (master) (282ms)

  114 passing (38s)
  1 failing

  1) Cluster
       GET/cluster/:node_id/stats
         Cluster stats:
     Uncaught AssertionError: expected Object { error: 1308, message: 'Stats file has not been created yet' } to have property data
      at Assertion.fail (node_modules/should/cjs/should.js:258:17)
      at Assertion.value [as properties] (node_modules/should/cjs/should.js:335:19)
      at Test.<anonymous> (test/test_cluster.js:285:42)
      at Test.assert (node_modules/supertest/lib/test.js:181:6)
      at localAssert (node_modules/supertest/lib/test.js:131:12)
      at /wazuh-api/node_modules/supertest/lib/test.js:128:5
      at Test.Request.callback (node_modules/superagent/lib/node/index.js:716:12)
      at /wazuh-api/node_modules/superagent/lib/node/index.js:916:18
      at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:19:7)
      at endReadableNT (_stream_readable.js:1221:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)

[mochawesome] Report JSON saved to /share/cluster.json

[mochawesome] Report HTML saved to /share/cluster.html

  Decoders
    GET/decoders
(node:3103) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (373ms)
      ✓ Pagination (364ms)
      ✓ Retrieve all elements with limit=0 (336ms)
      ✓ Sort (341ms)
      ✓ Search (337ms)
      ✓ Filters: File (313ms)
      ✓ Filters: Path (308ms)
      ✓ Filters: query 1 (309ms)
      ✓ Filters: query 2 (325ms)
      ✓ Filters: query 3 (320ms)
      ✓ Filters: Invalid filter (77ms)
      ✓ Filters: Invalid filter - Extra field (76ms)
    GET/decoders/files
      ✓ Request (281ms)
      ✓ Pagination (270ms)
      ✓ Retrieve all elements with limit=0 (286ms)
      ✓ Sort (308ms)
      ✓ Search (316ms)
    GET/decoders/parents
      ✓ Request (335ms)
      ✓ Pagination (332ms)
      ✓ Retrieve all elements with limit=0 (329ms)
      ✓ Sort (321ms)
      ✓ Search (352ms)
    GET/decoders/:decoder_name
      ✓ Request (337ms)
      ✓ Pagination (337ms)
      ✓ Retrieve all elements with limit=0 (331ms)
      ✓ Sort (320ms)
      ✓ Search (336ms)

  27 passing (8s)

[mochawesome] Report JSON saved to /share/decoders.json

[mochawesome] Report HTML saved to /share/decoders.html

  Lists
    GET/lists
(node:3200) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (383ms)
      ✓ Pagination (290ms)
      ✓ Retrieve all elements with limit=0 (277ms)
      ✓ Sort (277ms)
      ✓ Search (277ms)
      ✓ Filters: Path (292ms)
      ✓ Filters: Invalid filter (78ms)
      ✓ Filters: Invalid filter - Extra field (78ms)
    GET/lists/files
      ✓ Request (308ms)
      ✓ Pagination (309ms)
      ✓ Retrieve all elements with limit=0 (280ms)
      ✓ Sort (283ms)
      ✓ Search (278ms)
      ✓ Filters: Invalid filter (77ms)
      ✓ Filters: Invalid filter - Extra field (77ms)

  15 passing (4s)

[mochawesome] Report JSON saved to /share/lists.json

[mochawesome] Report HTML saved to /share/lists.html

  Manager
    GET/manager/status
(node:3234) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (296ms)
    GET/manager/info
      ✓ Request (275ms)
    GET/manager/configuration
      ✓ Request (286ms)
      ✓ Filters: Missing field section (79ms)
      ✓ Filters: Section (282ms)
      ✓ Errors: Invalid Section (279ms)
      ✓ Filters: Section - field (278ms)
      ✓ Errors: Invalid field (275ms)
      ✓ Filters: Invalid filter (78ms)
      ✓ Filters: Invalid filter - Extra field (80ms)
    GET/manager/stats
      1) Request
      2) Filters: date
      ✓ Filters: Invalid date (82ms)
      ✓ Filters: Invalid filter (79ms)
      ✓ Filters: Invalid filter - Extra field (78ms)
    GET/manager/stats/hourly
      ✓ Request (284ms)
    GET/manager/stats/weekly
      ✓ Request (276ms)
    GET/manager/stats/analysisd
      ✓ Request (275ms)
    GET/manager/stats/remoted
      ✓ Request (281ms)
    GET/manager/logs
      ✓ Request (291ms)
      ✓ Pagination (288ms)
      ✓ Retrieve all elements with limit=0 (299ms)
      ✓ Sort (292ms)
      ✓ SortField (285ms)
      ✓ Search (287ms)
      ✓ Filters: type_log (294ms)
      ✓ Filters: category (291ms)
      ✓ Filters: type_log and category (289ms)
      ✓ Filters: Invalid filter (78ms)
      ✓ Filters: Invalid filter - Extra field (77ms)
      ✓ Filters: query 1 (294ms)
      ✓ Filters: query 2 (309ms)
      ✓ Filters: query 3 (301ms)
      ✓ Filters: wrong query (79ms)
    GET/manager/logs/summary
      ✓ Request (290ms)
    POST/manager/files
      ✓ Upload ossec.conf (295ms)
      ✓ Upload ossec.conf (overwrite=false) (284ms)
      ✓ Upload rules (new rule) (279ms)
      ✓ Upload rules (overwrite=true) (271ms)
      ✓ Upload rules (overwrite=false) (265ms)
      ✓ Upload decoder (overwrite=true) (270ms)
      ✓ Upload decoder (without overwrite parameter) (267ms)
      ✓ Upload list (overwrite=true) (270ms)
      ✓ Upload list (without overwrite parameter) (271ms)
      ✓ Upload malformed rule (78ms)
      ✓ Upload malformed decoder (77ms)
      ✓ Upload malformed list (77ms)
      ✓ Upload list with empty path (76ms)
      ✓ Upload a file with a wrong content type (76ms)
    GET/manager/files
      ✓ Request ossec.conf (276ms)
      ✓ Request rules (local) (282ms)
      ✓ Request rules (global) (273ms)
      ✓ Request decoders (local) (293ms)
      ✓ Request decoders (global) (281ms)
      ✓ Request lists (284ms)
      ✓ Request wrong path 1 (81ms)
      ✓ Request wrong path 2 (81ms)
      ✓ Request wrong path 3 (81ms)
      ✓ Request unexisting file (288ms)
      ✓ Request file with empty path (89ms)
      ✓ Request file with validation parameter (true) (273ms)
    DELETE/manager/files
      ✓ Delete rules (271ms)
      ✓ Delete decoders (281ms)
      ✓ Delete CDB list (277ms)
      ✓ Delete file with empty path (77ms)
    GET/manager/configuration/validation (OK)
      ✓ Request validation  (789ms)
    GET/manager/configuration/validation (KO)
      ✓ Request validation (317ms)
    GET/manager/config/:component/:configuration
      ✓ Request-Agentless-Agentless (280ms)
      ✓ Request-Analysis-Global (277ms)
      ✓ Request-Analysis-Active-response (281ms)
      ✓ Request-Analysis-Alerts (276ms)
      ✓ Request-Analysis-Command (291ms)
      ✓ Request-Analysis-Internal (312ms)
      ✓ Request-Auth-Auth (277ms)
      ✓ Request-Com-Active-response (274ms)
      ✓ Request-Com-Internal (270ms)
      ✓ Request-Csyslog-Csyslog (279ms)
      ✓ Request-Integrator-Integration (272ms)
      ✓ Request-Logcollector-Localfile (322ms)
      ✓ Request-Logcollector-Socket (342ms)
      ✓ Request-Logcollector-Internal (279ms)
      ✓ Request-Mail-Global (291ms)
      ✓ Request-Mail-Alerts (298ms)
      ✓ Request-Mail-Internal (282ms)
      ✓ Request-Monitor-Internal (270ms)
      ✓ Request-Request-Remote (268ms)
      ✓ Request-Request-Internal (271ms)
      ✓ Request-Syscheck-Syscheck (280ms)
      ✓ Request-Syscheck-Rootcheck (274ms)
      ✓ Request-Syscheck-Internal (274ms)
      ✓ Request-Wmodules-Wmodules (273ms)
    PUT/manager/restart
      ✓ Request (273ms)

  90 passing (25s)
  2 failing

  1) Manager
       GET/manager/stats
         Request:
     Uncaught AssertionError: expected Object { error: 1308, message: 'Stats file has not been created yet' } to have property data
      at Assertion.fail (node_modules/should/cjs/should.js:258:17)
      at Assertion.value [as properties] (node_modules/should/cjs/should.js:335:19)
      at Test.<anonymous> (test/test_manager.js:226:38)
      at Test.assert (node_modules/supertest/lib/test.js:181:6)
      at localAssert (node_modules/supertest/lib/test.js:131:12)
      at /wazuh-api/node_modules/supertest/lib/test.js:128:5
      at Test.Request.callback (node_modules/superagent/lib/node/index.js:716:12)
      at /wazuh-api/node_modules/superagent/lib/node/index.js:916:18
      at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:19:7)
      at endReadableNT (_stream_readable.js:1221:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)

  2) Manager
       GET/manager/stats
         Filters: date:
     Uncaught AssertionError: expected Object { error: 1308, message: 'Stats file has not been created yet' } to have property data
      at Assertion.fail (node_modules/should/cjs/should.js:258:17)
      at Assertion.value [as properties] (node_modules/should/cjs/should.js:335:19)
      at Test.<anonymous> (test/test_manager.js:246:38)
      at Test.assert (node_modules/supertest/lib/test.js:181:6)
      at localAssert (node_modules/supertest/lib/test.js:131:12)
      at /wazuh-api/node_modules/supertest/lib/test.js:128:5
      at Test.Request.callback (node_modules/superagent/lib/node/index.js:716:12)
      at /wazuh-api/node_modules/superagent/lib/node/index.js:916:18
      at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:19:7)
      at endReadableNT (_stream_readable.js:1221:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)

[mochawesome] Report JSON saved to /share/manager.json

[mochawesome] Report HTML saved to /share/manager.html

  Rootcheck
    GET/rootcheck/:agent_id/last_scan
(node:4597) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (312ms)
      ✓ Params: Bad agent id (79ms)
      ✓ Errors: No agent (268ms)
    DELETE/rootcheck/:agent_id
      ✓ Request (313ms)
      ✓ Params: Bad agent id (79ms)
      ✓ Errors: No agent (271ms)
    DELETE/rootcheck
      ✓ Request (759ms)
    PUT/rootcheck/:agent_id
      ✓ Request (286ms)
      ✓ Params: Bad agent id (79ms)
      ✓ Errors: No agent (272ms)
    PUT/rootcheck
      ✓ Request (299ms)

  11 passing (3s)

[mochawesome] Report JSON saved to /share/rootcheck.json

[mochawesome] Report HTML saved to /share/rootcheck.html

  Rules
    GET/rules
(node:4700) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (647ms)
      ✓ Pagination (514ms)
      ✓ Retrieve all elements with limit=0 (509ms)
      ✓ Sort (504ms)
      ✓ Search (620ms)
      ✓ Filters: Invalid filter (87ms)
      ✓ Filters: Invalid filter - Extra field (91ms)
      ✓ Filters: status (519ms)
      ✓ Filters: group (553ms)
      ✓ Filters: level (1) (493ms)
      ✓ Filters: level (2) (607ms)
      ✓ Filters: path (470ms)
      ✓ Filters: file (483ms)
      ✓ Filters: pci (554ms)
      ✓ Filters: gdpr (481ms)
      ✓ Filters: hipaa (720ms)
      ✓ Filters: nist-800-53 (660ms)
      ✓ Filters: tsc (700ms)
      ✓ Filters: gpg13 (470ms)
      ✓ Filters: mitre (473ms)
      ✓ Filters: query 1 (448ms)
      ✓ Filters: query 2 (453ms)
    GET/rules/groups
      ✓ Request (441ms)
      ✓ Pagination (444ms)
      ✓ Retrieve all elements with limit=0 (448ms)
      ✓ Sort (448ms)
      ✓ Search (442ms)
      ✓ Filters: Invalid filter (76ms)
    GET/rules/pci
      ✓ Request (440ms)
      ✓ Pagination (442ms)
      ✓ Retrieve all elements with limit=0 (454ms)
      ✓ Sort (456ms)
      ✓ Search (445ms)
      ✓ Filters: Invalid filter (78ms)
    GET/rules/gdpr
      ✓ Request (455ms)
      ✓ Pagination (468ms)
      ✓ Retrieve all elements with limit=0 (445ms)
      ✓ Sort (447ms)
      ✓ Search (452ms)
      ✓ Filters: Invalid filter (78ms)
    GET/rules/gpg13
      ✓ Request (445ms)
      ✓ Pagination (442ms)
      ✓ Retrieve all elements with limit=0 (444ms)
      ✓ Sort (462ms)
      ✓ Search (444ms)
      ✓ Filters: Invalid filter (77ms)
    GET/rules/hipaa
      ✓ Request (438ms)
      ✓ Pagination (439ms)
      ✓ Retrieve all elements with limit=0 (444ms)
      ✓ Sort (452ms)
      ✓ Search (447ms)
      ✓ Filters: Invalid filter (78ms)
    GET/rules/nist-800-53
      ✓ Request (445ms)
      ✓ Pagination (446ms)
      ✓ Retrieve all elements with limit=0 (473ms)
      ✓ Sort (444ms)
      ✓ Search (451ms)
      ✓ Filters: Invalid filter (80ms)
    GET/rules/mitre
      ✓ Request (453ms)
      ✓ Pagination (444ms)
      ✓ Retrieve all elements with limit=0 (441ms)
      ✓ Sort (444ms)
      ✓ Search (446ms)
      ✓ Filters: Invalid filter (80ms)
    GET/rules/tsc
      ✓ Request (453ms)
      ✓ Pagination (443ms)
      ✓ Retrieve all elements with limit=0 (440ms)
      ✓ Sort (442ms)
      ✓ Search (444ms)
      ✓ Filters: Invalid filter (77ms)
    GET/rules/files
      ✓ Request (283ms)
      ✓ Pagination (331ms)
      ✓ Retrieve all elements with limit=0 (327ms)
      ✓ Sort (290ms)
      ✓ Search (309ms)
      ✓ Filters: Invalid filter (80ms)
      ✓ Filters: Invalid filter - Extra field (82ms)
      ✓ Filters: status (288ms)
      ✓ Filters: download (272ms)
    GET/rules/:rule_id
      ✓ Request (427ms)
      ✓ Pagination (427ms)
      ✓ Retrieve all elements with limit=0 (440ms)
      ✓ Sort (429ms)
      ✓ Search (426ms)
      ✓ Filters: Invalid filter (77ms)
      ✓ Params: Bad rule id (76ms)
      ✓ Params: No rule (424ms)

  87 passing (35s)

[mochawesome] Report JSON saved to /share/rules.json

[mochawesome] Report HTML saved to /share/rules.html

  SecurityConfigurationAssessment
    GET/sca/:agent_id
(node:4858) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (305ms)
      ✓ Pagination (271ms)
      ✓ Retrieve all elements with limit=0 (270ms)
      ✓ Sort (275ms)
      ✓ Search (281ms)
      ✓ Params: Bad agent id (77ms)
      ✓ Errors: No agent (263ms)
      ✓ Filters: Invalid filter (77ms)
      ✓ Filters: Invalid filter - Extra field (79ms)
      ✓ Filters: query (273ms)
      ✓ Filters: name (272ms)
      ✓ Filters: references (271ms)
      ✓ Retrieve all elements with limit=0 (270ms)
    GET/sca/:agent_id/checks/:policy_id
      ✓ Request (282ms)
      ✓ Pagination (290ms)
      ✓ Retrieve all elements with limit=0 (273ms)
      ✓ Sort (278ms)
      ✓ Search (281ms)
      ✓ Params: Bad agent id (90ms)
      ✓ Errors: No agent (262ms)
      ✓ Check not found (275ms)
      ✓ Retrieve all elements with limit=0 (269ms)
      ✓ Filters: description (273ms)
      ✓ Filters: remediation (273ms)
      ✓ Filters: file (274ms)
      ✓ Filters: references (271ms)
      ✓ Filters: result (271ms)
      ✓ Filters: condition (279ms)

  28 passing (7s)

[mochawesome] Report JSON saved to /share/sca.json

[mochawesome] Report HTML saved to /share/sca.html

  Syscheck
    GET/syscheck/:agent_id
(node:4915) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (351ms)
      ✓ Pagination (272ms)
      ✓ Retrieve all elements with limit=0 (271ms)
      ✓ Sort (274ms)
      ✓ Search (277ms)
      ✓ Params: Bad agent id (78ms)
      ✓ Errors: No agent (265ms)
      ✓ Filters: Invalid filter (78ms)
      ✓ Filters: Invalid filter - Extra field (79ms)
      ✓ Filters: file (277ms)
      ✓ Filters: type (272ms)
      ✓ Filters: summary (279ms)
      ✓ Filters: md5 (289ms)
      ✓ Filters: sha1 (277ms)
      ✓ Filters: sha256 (278ms)
      ✓ Filters: hash (285ms)
      ✓ Filters: distinct (282ms)
      ✓ Filters: "%Y-%m-%d" date (334ms)
      ✓ Filters: "%Y-%m-%d %H:%M:%S" date (335ms)
      ✓ Filters: timestamp date (331ms)
    GET/syscheck/:agent_id/last_scan
      ✓ Request (277ms)
      ✓ Params: Bad agent id (77ms)
      ✓ Errors: No agent (265ms)
    DELETE/syscheck/:agent_id
      ✓ Request (295ms)
      ✓ Params: Bad agent id (76ms)
      ✓ Errors: No agent (260ms)
    DELETE/experimental/syscheck
      ✓ Request (1840ms)
    PUT/syscheck/:agent_id
      ✓ Request (281ms)
      ✓ Params: Bad agent id (76ms)
      ✓ Errors: No agent (263ms)
    PUT/syscheck
      ✓ Request (292ms)

  31 passing (9s)

[mochawesome] Report JSON saved to /share/test_syscheck.json

[mochawesome] Report HTML saved to /share/test_syscheck.html

  Syscollector
    GET/syscollector/:agent_id/os
(node:4973) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
      ✓ Request (308ms)
      ✓ Selector (288ms)
      ✓ Not allowed selector (280ms)
    GET/syscollector/:agent_id/hardware
      ✓ Request (279ms)
      ✓ Selector (275ms)
      ✓ Not allowed selector (275ms)
    GET/syscollector/:agent_id/packages
      ✓ Request (305ms)
      ✓ Selector (285ms)
      ✓ Not allowed selector (272ms)
      ✓ Pagination (269ms)
      ✓ Wrong limit (76ms)
      ✓ Sort - (272ms)
      ✓ Sort + (273ms)
      ✓ Wrong Sort (270ms)
      ✓ Search (290ms)
      ✓ Filter: vendor (277ms)
      ✓ Filter: name (284ms)
      ✓ Filter: architecture (300ms)
      ✓ Filter: format (299ms)
      ✓ Wrong filter (77ms)
      ✓ Query (301ms)
    GET/experimental/syscollector/packages
      ✓ Request (534ms)
      ✓ Selector (555ms)
      ✓ Not allowed selector (303ms)
      ✓ Pagination (297ms)
      ✓ Wrong limit (77ms)
      ✓ Sort - (344ms)
      ✓ Sort + (387ms)
      ✓ Wrong Sort (302ms)
      ✓ Search (401ms)
      ✓ Filter: vendor (332ms)
      ✓ Filter: name (357ms)
      ✓ Filter: architecture (496ms)
      ✓ Filter: format (539ms)
      ✓ Wrong filter (77ms)
      ✓ Query (549ms)
    GET/experimental/syscollector/os
      ✓ Request (335ms)
      ✓ Selector (319ms)
      ✓ Not allowed selector (308ms)
      ✓ Pagination (473ms)
      ✓ Wrong limit (87ms)
      ✓ Search (349ms)
      ✓ Wrong filter (78ms)
      ✓ Filter: architecture (321ms)
      ✓ Filter: os_name (475ms)
      ✓ Filter: release (362ms)
      ✓ Query (323ms)
    GET/experimental/syscollector/hardware
      ✓ Request (313ms)
      ✓ Selector (307ms)
      ✓ Not allowed selector (302ms)
      ✓ Pagination (313ms)
      ✓ Wrong limit (78ms)
      ✓ Search (324ms)
      ✓ Wrong filter (78ms)
      ✓ Wrong Sort (296ms)
      ✓ Filter: ram_total (316ms)
      ✓ Filter: cpu_cores (314ms)
      ✓ Filter: cpu_mhz (312ms)
      ✓ Filter: board_serial (316ms)
      ✓ Query (318ms)
    GET/experimental/syscollector/processes
      ✓ Request (361ms)
      ✓ Selector (340ms)
      ✓ Not allowed selector (301ms)
      ✓ Pagination (305ms)
      ✓ Wrong limit (78ms)
      ✓ Search (393ms)
      ✓ Wrong filter (80ms)
      ✓ Wrong Sort (293ms)
      ✓ Filter: state (302ms)
      ✓ Filter: ppid (305ms)
      ✓ Filter: egroup (304ms)
      ✓ Filter: euser (304ms)
      ✓ Filter: fgroup (305ms)
      ✓ Filter: name (334ms)
      ✓ Filter: nlwp (308ms)
      ✓ Filter: pgrp (325ms)
      ✓ Filter: priority (307ms)
      ✓ Filter: rgroup (320ms)
      ✓ Filter: ruser (381ms)
      ✓ Filter: sgroup (327ms)
      ✓ Filter: suser (313ms)
      ✓ Query (309ms)
    GET/experimental/syscollector/ports
      ✓ Request (352ms)
      ✓ Selector (339ms)
      ✓ Not allowed selector (299ms)
      ✓ Pagination (302ms)
      ✓ Wrong limit (81ms)
      ✓ Search (350ms)
      ✓ Wrong filter (78ms)
      ✓ Wrong Sort (300ms)
      ✓ Filter: protocol (316ms)
      ✓ Filter: local_ip (320ms)
      ✓ Filter: local_port (356ms)
      ✓ Filter: remote_ip (335ms)
      ✓ Filter: tx_queue (322ms)
      ✓ Filter: state (324ms)
      ✓ Query (319ms)
    GET/syscollector/netaddr
      ✓ Request (313ms)
      ✓ Selector (309ms)
      ✓ Not allowed selector (306ms)
      ✓ Pagination (304ms)
      ✓ Wrong limit (78ms)
      ✓ Search (315ms)
      ✓ Wrong filter (77ms)
      ✓ Wrong Sort (297ms)
      ✓ Filter: iface (336ms)
      ✓ Filter: proto (319ms)
      ✓ Filter: address (309ms)
      ✓ Filter: broadcast (312ms)
      ✓ Filter: netmask (310ms)
      ✓ Query (313ms)
    GET/experimental/syscollector/netproto
      ✓ Request (305ms)
      ✓ Selector (306ms)
      ✓ Not allowed selector (294ms)
      ✓ Pagination (299ms)
      ✓ Wrong limit (77ms)
      ✓ Search (309ms)
      ✓ Wrong filter (78ms)
      ✓ Wrong Sort (291ms)
      ✓ Filter: iface (307ms)
      ✓ Filter: type (307ms)
      ✓ Filter: gateway (313ms)
      ✓ Filter: dhcp (322ms)
      ✓ Query (307ms)
    GET/experimental/syscollector/netiface
      ✓ Request (312ms)
      ✓ Selector (308ms)
      ✓ Not allowed selector (299ms)
      ✓ Pagination (299ms)
      ✓ Wrong limit (78ms)
      ✓ Search (327ms)
      ✓ Wrong filter (77ms)
      ✓ Wrong Sort (296ms)
      ✓ Filter: name (312ms)
      ✓ Filter: type (313ms)
      ✓ Filter: state (312ms)
      ✓ Filter: mtu (314ms)
      ✓ Filter: tx_packets (311ms)
      ✓ Filter: rx_packets (310ms)
      ✓ Filter: tx_bytes (308ms)
      ✓ Filter: rx_bytes (310ms)
      ✓ Filter: tx_errors (309ms)
      ✓ Filter: rx_errors (310ms)
      ✓ Filter: tx_dropped (308ms)
      ✓ Filter: rx_dropped (310ms)
      ✓ Query (309ms)
    GET/syscollector/000/processes
      ✓ Request (277ms)
      ✓ Selector (276ms)
      ✓ Not allowed selector (269ms)
      ✓ Pagination (269ms)
      ✓ Wrong limit (78ms)
      ✓ Search (279ms)
      ✓ Wrong filter (77ms)
      ✓ Wrong Sort (272ms)
      ✓ Filter: state (273ms)
      ✓ Filter: ppid (271ms)
      ✓ Filter: egroup (276ms)
      ✓ Filter: euser (274ms)
      ✓ Filter: fgroup (273ms)
      ✓ Filter: name (276ms)
      ✓ Filter: nlwp (273ms)
      ✓ Filter: pgrp (276ms)
      ✓ Filter: priority (272ms)
      ✓ Filter: rgroup (276ms)
      ✓ Filter: ruser (272ms)
      ✓ Filter: sgroup (274ms)
      ✓ Filter: suser (271ms)
      ✓ Query (276ms)
    GET/syscollector/000/ports
      ✓ Request (271ms)
      ✓ Selector (273ms)
      ✓ Not allowed selector (269ms)
      ✓ Pagination (276ms)
      ✓ Wrong limit (76ms)
      ✓ Search (274ms)
      ✓ Wrong filter (79ms)
      ✓ Wrong Sort (272ms)
      ✓ Filter: protocol (275ms)
      ✓ Filter: local_ip (276ms)
      ✓ Filter: local_port (276ms)
      ✓ Filter: remote_ip (277ms)
      ✓ Filter: tx_queue (275ms)
      ✓ Filter: state (275ms)
      ✓ Query (275ms)
    GET/syscollector/000/netaddr
      ✓ Request (275ms)
      ✓ Selector (273ms)
      ✓ Not allowed selector (336ms)
      ✓ Pagination (274ms)
      ✓ Wrong limit (76ms)
      ✓ Search (277ms)
      ✓ Wrong filter (82ms)
      ✓ Wrong Sort (270ms)
      ✓ Filter: iface (273ms)
      ✓ Filter: proto (275ms)
      ✓ Filter: address (272ms)
      ✓ Filter: broadcast (273ms)
      ✓ Filter: netmask (274ms)
      ✓ Query (272ms)
    GET/syscollector/000/netproto
      ✓ Request (273ms)
      ✓ Selector (273ms)
      ✓ Not allowed selector (272ms)
      ✓ Pagination (271ms)
      ✓ Wrong limit (77ms)
      ✓ Search (275ms)
      ✓ Wrong filter (76ms)
      ✓ Wrong Sort (271ms)
      ✓ Filter: iface (273ms)
      ✓ Filter: type (276ms)
      ✓ Filter: gateway (274ms)
      ✓ Filter: dhcp (276ms)
      ✓ Query (273ms)
    GET/syscollector/000/netiface
      ✓ Request (275ms)
      ✓ Selector (279ms)
      ✓ Not allowed selector (285ms)
      ✓ Pagination (284ms)
      ✓ Wrong limit (77ms)
      ✓ Search (283ms)
      ✓ Wrong filter (78ms)
      ✓ Wrong Sort (278ms)
      ✓ Filter: name (277ms)
      ✓ Filter: type (294ms)
      ✓ Filter: state (280ms)
      ✓ Filter: mtu (279ms)
      ✓ Filter: tx_packets (274ms)
      ✓ Filter: rx_packets (278ms)
      ✓ Filter: tx_bytes (272ms)
      ✓ Filter: rx_bytes (272ms)
      ✓ Filter: tx_errors (280ms)
      ✓ Filter: rx_errors (276ms)
      ✓ Filter: tx_dropped (274ms)
      ✓ Filter: rx_dropped (275ms)
      ✓ Query (278ms)
    GET/syscollector/:agent_id/hotfixes
      ✓ Request (281ms)
      ✓ Selector (278ms)
      ✓ Not allowed selector (288ms)
      ✓ Pagination (276ms)
      ✓ Wrong limit (276ms)
      ✓ Sort - (278ms)
      ✓ Sort + (276ms)
      ✓ Search (288ms)
      ✓ Filter: hotfix (276ms)

  239 passing (1m)