wazuh / wazuh-indexer

Wazuh indexer, the Wazuh search engine
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
11 stars 19 forks source link

Add Imposter to our development tools #500

Open AlexRuiz7 opened 1 day ago

AlexRuiz7 commented 1 day ago

Description

The Command Manager plugin is interacting with an HTTP RESTful API in the Wazuh Server. We need to mock this service to develop and test our code, avoiding setting up a complete Wazuh Server.

As for now, the Command Manager interacts with the Management API (M_API) in two ways:

We need to mock these 2 endpoints to test our code under different behaviors, success and failure, to properly handle them.

The @wazuh/devel-dashboard team has been using Imposter as a mock server for quite some time now. We'll also use this tool as we are already familiar with it, and has proven to fit our needs.

Imposter allows different deployment methods that can be useful for us:

Imposter can be configured to load an OpenAPI spec file and to respond to whatever we need on each endpoint call. The most recent spec for the Management API is here.

https://github.com/wazuh/wazuh/blob/enhancement/25599-server-orders-distribution/api/api/spec/spec.yaml

Functional requirements

Plan

AlexRuiz7 commented 1 day ago

To reuse the JS script to generate a valid token from the Wazuh Dashboard tooling, we need to add this environment variable.

export IMPOSTER_JS_PLUGIN=js-graal-compat 

https://github.com/outofcoffee/imposter/issues/581