Skip to content

Commit

Permalink
Enable update check for a specific set of cases only
Browse files Browse the repository at this point in the history
  • Loading branch information
GGP1 committed May 10, 2024
1 parent 1ac2f10 commit 374173b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
7 changes: 4 additions & 3 deletions api/test/integration/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ variables:
<email_notification>no</email_notification>
<agents_disconnection_time>20s</agents_disconnection_time>
<agents_disconnection_alert_time>100s</agents_disconnection_alert_time>
<update_check>yes</update_check>
<update_check>no</update_check>
</global>

<logging>
Expand Down Expand Up @@ -197,7 +197,7 @@ variables:
</vulnerability-detection>
</ossec_config>

valid_ossec_conf_with_update_check_disabled:
valid_ossec_conf_with_update_check_enabled:
<ossec_config>
<global>
<jsonout_output>yes</jsonout_output>
Expand All @@ -207,7 +207,8 @@ variables:
<email_notification>no</email_notification>
<agents_disconnection_time>20s</agents_disconnection_time>
<agents_disconnection_alert_time>100s</agents_disconnection_alert_time>
<update_check>no</update_check>
<update_check>yes</update_check>
<cti-url>http://cti:4041</cti-url>
</global>

<logging>
Expand Down
1 change: 0 additions & 1 deletion api/test/integration/env/base/cti/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def do_GET(self):
self.send_header('Content-Type', 'application/json')
self.end_headers()

# Return JSON mock response
data = json.dumps(MOCK_RESPONSE).encode('utf-8')
self.wfile.write(data)
else:
Expand Down
80 changes: 40 additions & 40 deletions api/test/integration/test_manager_endpoints.tavern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,45 @@ stages:
save:
json:
wazuh_version: data.api_version

- name: Enable update check
request:
verify: False
url: "{protocol:s}://{host:s}:{port:d}/manager/configuration"
method: PUT
data: "{valid_ossec_conf_with_update_check_enabled:s}"
headers:
Authorization: "Bearer {test_login_token}"
content-type: application/octet-stream
response:
status_code: 200
json:
data:
affected_items:
- 'manager'
failed_items: []
total_affected_items: 1
total_failed_items: 0
error: 0

- name: Restart manager to apply the configuration
request:
verify: False
url: "{protocol:s}://{host:s}:{port:d}/manager/restart"
method: PUT
headers:
Authorization: "Bearer {test_login_token}"
response:
status_code: 200
json:
error: 0
data:
affected_items:
- !anystr
failed_items: []
total_affected_items: 1
total_failed_items: 0
delay_after: 50

- name: Get available updates
request:
Expand Down Expand Up @@ -1300,7 +1339,7 @@ stages:
verify: False
url: "{protocol:s}://{host:s}:{port:d}/manager/configuration"
method: PUT
data: "{valid_ossec_conf_with_update_check_disabled:s}"
data: "{valid_ossec_conf:s}"
headers:
Authorization: "Bearer {test_login_token}"
content-type: application/octet-stream
Expand Down Expand Up @@ -1366,45 +1405,6 @@ stages:
current_version: "v{wazuh_version:s}"
update_check: false

- name: Enable the update check
request:
verify: False
url: "{protocol:s}://{host:s}:{port:d}/manager/configuration"
method: PUT
data: "{valid_ossec_conf:s}"
headers:
Authorization: "Bearer {test_login_token}"
content-type: application/octet-stream
response:
status_code: 200
json:
data:
affected_items:
- 'manager'
failed_items: []
total_affected_items: 1
total_failed_items: 0
error: 0

- name: Restart manager to apply the configuration
request:
verify: False
url: "{protocol:s}://{host:s}:{port:d}/manager/restart"
method: PUT
headers:
Authorization: "Bearer {test_login_token}"
response:
status_code: 200
json:
error: 0
data:
affected_items:
- !anystr
failed_items: []
total_affected_items: 1
total_failed_items: 0
delay_after: 50

---
test_name: GET /manager/version/check with update check service error

Expand Down

0 comments on commit 374173b

Please sign in to comment.