-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete deprecated field in PUT /active-response
performance test
#5611
Labels
Comments
Test Results
Resultsnv) federamos@pop-os:~/Documents/Wazuh/Repositories/wazuh-qa/tests/performance/test_api$ python3 -m pytest test_api_endpoints_performance.py
========================================================================================================== test session starts ==========================================================================================================
platform linux -- Python 3.9.18, pytest-7.1.2, pluggy-1.4.0
rootdir: /home/federamos/Documents/Wazuh/Repositories/wazuh-qa/tests, configfile: pytest.ini
plugins: metadata-3.1.1, html-3.1.1, testinfra-5.0.0
collected 55 items
test_api_endpoints_performance.py FFF.FFF..........................FFF..................F [100%]
=============================================================================================================== FAILURES ================================================================================================================
______________________________________________________________________________________________ test_api_endpoints[get_/cluster/local/info] ______________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/local/info', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/local/info', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.014s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
________________________________________________________________________________________________ test_api_endpoints[get_/cluster/nodes] _________________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/nodes', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/nodes', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.014s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
_____________________________________________________________________________________________ test_api_endpoints[get_/cluster/healthcheck] ______________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/healthcheck', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/healthcheck', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.014s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
_____________________________________________________________________________________________ test_api_endpoints[get_/cluster/local/config] _____________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/local/config', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/local/config', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.015s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
______________________________________________________________________________________________ test_api_endpoints[get_/cluster/api/config] ______________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/api/config', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/api/config', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.014s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
_______________________________________________________________________________________ test_api_endpoints[get_/cluster/configuration/validation] _______________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/configuration/validation', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/configuration/validation', 'method': 'get', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.014s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
___________________________________________________________________________________________________ test_api_endpoints[post_/agents] ____________________________________________________________________________________________________
test_case = {'body': {'ip': 'any', 'name': 'new_test_agent'}, 'endpoint': '/agents', 'method': 'post', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {'ip': 'any', 'name': 'new_test_agent'}, 'endpoint': '/agents', 'method': 'post', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.019s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Wazuh authd is not running",
"remediation": "Please enable authd or check if there is any error",
"dapi_errors": {
"node01": {
"error": "Wazuh authd is not running"
}
},
"error": 1726
}
________________________________________________________________________________________________ test_api_endpoints[post_/agents/insert] ________________________________________________________________________________________________
test_case = {'body': {'ip': 'any', 'name': 'new_test_agent_insert'}, 'endpoint': '/agents/insert', 'method': 'post', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {'ip': 'any', 'name': 'new_test_agent_insert'}, 'endpoint': '/agents/insert', 'method': 'post', 'parameters': {}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.018s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Wazuh authd is not running",
"remediation": "Please enable authd or check if there is any error",
"dapi_errors": {
"node01": {
"error": "Wazuh authd is not running"
}
},
"error": 1726
}
_____________________________________________________________________________________________ test_api_endpoints[post_/agents/insert/quick] _____________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/agents/insert/quick', 'method': 'post', 'parameters': {'agent_name': 'new_test_agent_insert_quick'}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/agents/insert/quick', 'method': 'post', 'parameters': {'agent_name': 'new_test_agent_insert_quick'}}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.017s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Wazuh authd is not running",
"remediation": "Please enable authd or check if there is any error",
"dapi_errors": {
"node01": {
"error": "Wazuh authd is not running"
}
},
"error": 1726
}
_______________________________________________________________________________________________ test_api_endpoints[put_/cluster/restart] ________________________________________________________________________________________________
test_case = {'body': {}, 'endpoint': '/cluster/restart', 'method': 'put', 'parameters': {}, ...}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
assert response.status_code == 200
assert response.json()['error'] == 0
except AssertionError as e:
# If the assertion fails, and is marked as xfail
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
> raise e
test_api_endpoints_performance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_case = {'body': {}, 'endpoint': '/cluster/restart', 'method': 'put', 'parameters': {}, ...}, set_api_test_environment = None, api_healthcheck = None
@pytest.mark.parametrize('test_case', test_data['test_cases'], ids=case_ids)
def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
"""Make an API request for each `test_case`.
Args:
test_case (dict): Dictionary with the endpoint to be tested and the necessary parameters for the test.
set_api_test_environment (fixture): Fixture that modifies the API security options.
api_healthcheck (fixture): Fixture used to check that the API is ready to respond requests.
"""
base_url = api_details['base_url']
headers = api_details['auth_headers']
response = None
try:
response = getattr(requests, test_case['method'])(f"{base_url}{test_case['endpoint']}", headers=headers,
params=test_case['parameters'], json=test_case['body'],
verify=False)
> assert response.status_code == 200
E assert 400 == 200
E + where 400 = <Response [400]>.status_code
test_api_endpoints_performance.py:41: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------------
Request elapsed time: 0.014s
Status code: 400
Full response:
{
"title": "Bad Request",
"detail": "Cluster is not running, it might be disabled in `WAZUH_HOME/etc/ossec.conf`",
"remediation": "Please, visit the official documentation (https://documentation.wazuh.com/4.9/user-manual/configuring-cluster/index.html) to get more information about how to configure a cluster",
"error": 3013
}
=========================================================================================================== warnings summary ============================================================================================================
performance/test_api/test_api_endpoints_performance.py: 56 warnings
/home/federamos/Documents/Wazuh/Repositories/wazuh-qa/venv/lib/python3.9/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
performance/test_api/test_api_endpoints_performance.py::test_api_endpoints[put_/agents/group]
/home/federamos/Documents/Wazuh/Repositories/wazuh-qa/tests/performance/test_api/test_api_endpoints_performance.py:56: UserWarning: Test /agents/group should have failed due to Investigate performance issues with PUT /agents/group API endpoint: https://github.com/wazuh/wazuh/issues/13872
warnings.warn(f"Test {test_case['endpoint']} should have failed due "
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================================== short test summary info ========================================================================================================
FAILED test_api_endpoints_performance.py::test_api_endpoints[get_/cluster/local/info] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[get_/cluster/nodes] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[get_/cluster/healthcheck] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[get_/cluster/local/config] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[get_/cluster/api/config] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[get_/cluster/configuration/validation] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[post_/agents] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[post_/agents/insert] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[post_/agents/insert/quick] - assert 400 == 200
FAILED test_api_endpoints_performance.py::test_api_endpoints[put_/cluster/restart] - assert 400 == 200
======================================================================================== 10 failed, 45 passed, 57 warnings in 175.25s (0:02:55) ========================================================================================= |
Waiting for the QA team to merge the PR. GJ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
As described in #1266 (comment), the test for
PUT /active-response
failed because, when thecustom
field was deleted inPUT /active-response
, the performance tests for the API weren't updated. We should delete the field from the configuration:wazuh-qa/tests/performance/test_api/data/wazuh_api_endpoints_performance.yaml
Lines 113 to 119 in 243fb08
Tasks
custom
field from the body of thePUT /active-response
request configured in /tests/performance/test_api/data/wazuh_api_endpoints_performance.yamlThe text was updated successfully, but these errors were encountered: