Skip to content

Commit 79ee4aa

Browse files
rishagg01Clint Baxley
andauthored
Changes to test scripts for docker install (#663)
* Changes to test scripts for docker install * Auto approve docker install --------- Co-authored-by: Clint Baxley <Clinon.Baxley@ecstech.com>
1 parent 67c18cb commit 79ee4aa

File tree

1 file changed

+43
-23
lines changed

1 file changed

+43
-23
lines changed

testing/tests/api_tests/cluster/test_server.py

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,32 @@ def convertJsonFileToString(file_path):
2727
@pytest.fixture(autouse=True)
2828
def suppress_insecure_request_warning():
2929
warnings.simplefilter("ignore", urllib3.exceptions.InsecureRequestWarning)
30-
31-
30+
31+
3232
def test_host_search(es_host, es_port, username, password):
3333

3434
url = f"https://{es_host}:{es_port}/.ds-metrics-system.cpu-default-*/_search"
35-
body = load_json_schema(f"{current_script_dir}/queries/hostsearch.json")
36-
response = make_request(url, username, password, body=body)
35+
#body = load_json_schema(f"{current_script_dir}/queries/hostsearch.json")
36+
#response = make_request(url, username, password, body=body)
37+
response = make_request(url, username, password)
3738

3839
assert response.status_code == 200, f"Expected 200, got {response.status_code}"
3940
data = json.loads(response.text)
40-
41-
#assert "winlog" in data ["winlogbeat-imported"]["mappings"]["properties"]
4241

4342
# Getting the value of Root Key
4443
for key in data:
4544
rootKey = key
46-
4745

4846
assert (data[rootKey]["total"]["value"] > 0)
47+
assert ".ds-metrics-system.cpu-default" in data[rootKey]["hits"][0]["_index"]
4948
assert ".ds-metrics-system.cpu-default" in data[rootKey]["hits"][0]["_index"]
50-
assert (data[rootKey]["hits"][0]["_source"]["agent"]["name"] == "ubuntu-vm")
51-
assert (data[rootKey]["hits"][0]["_source"]["agent"]["version"] == "8.15.3")
49+
#assert (data[rootKey]["hits"][0]["_source"]["agent"]["name"] == "ubuntu-vm")
50+
assert (data[rootKey]["hits"][0]["_source"]["agent"]["version"] == "8.15.5")
5251
assert (data[rootKey]["hits"][0]["_source"]["data_stream"]["dataset"] == "system.cpu")
5352
assert (data[rootKey]["hits"][0]["_source"]["ecs"]["version"] == "8.0.0")
54-
assert (data[rootKey]["hits"][0]["_source"]["elastic_agent"]["version"] == "8.15.3")
53+
assert (data[rootKey]["hits"][0]["_source"]["elastic_agent"]["version"] == "8.15.5")
5554
assert (data[rootKey]["hits"][0]["_source"]["event"]["dataset"] == "system.cpu")
56-
assert (data[rootKey]["hits"][0]["_source"]["host"]["hostname"] == "ubuntu-vm")
55+
#assert (data[rootKey]["hits"][0]["_source"]["host"]["hostname"] == "ubuntu-vm")
5756
assert (data[rootKey]["hits"][0]["_source"]["metricset"]["name"] == "cpu")
5857
assert (data[rootKey]["hits"][0]["_source"]["service"]["type"] == "system")
5958
assert "system" in data[rootKey]["hits"][0]["_source"]
@@ -68,14 +67,26 @@ def test_logs_mapping(es_host, es_port, username, password):
6867
assert ".ds-logs-elastic_agent.endpoint_security-default-" in response.text
6968
assert ".ds-logs-elastic_agent-default-" in response.text
7069
assert ".ds-logs-elastic_agent.filebeat-default-" in response.text
71-
assert ".ds-logs-system.auth-default-" in response.text
72-
assert ".ds-logs-endpoint.events.network-default-" in response.text
73-
assert ".ds-logs-system.syslog-default-" in response.text
70+
#assert ".ds-logs-system.auth-default-" in response.text
71+
72+
#assert ".ds-logs-endpoint.events.network-default-" in response.text
73+
74+
#assert ".ds-logs-system.syslog-default-" in response.text
7475
assert ".ds-logs-elastic_agent.fleet_server-default-" in response.text
7576
assert ".ds-logs-endpoint.events.file-default-" in response.text
7677
assert ".ds-logs-endpoint.events.process-default-" in response.text
7778
assert ".ds-logs-elastic_agent.metricbeat-default-" in response.text
7879

80+
assert ".ds-logs-endpoint.events.network-default-" in response.text
81+
82+
#assert ".ds-logs-endpoint.events.library-default-" in response.text
83+
assert ".ds-logs-system.application-default-" in response.text
84+
assert ".ds-logs-system.system-default-" in response.text
85+
#assert ".ds-logs-endpoint.events.api-default-" in response.text
86+
assert ".ds-logs-system.security-default-" in response.text
87+
#assert ".ds-logs-endpoint.events.security-default-" in response.text
88+
assert ".ds-logs-endpoint.events.registry-default-" in response.text
89+
7990
def test_logs_settings(es_host, es_port, username, password):
8091

8192
url = f"https://{es_host}:{es_port}/logs-*/_settings"
@@ -88,10 +99,18 @@ def test_logs_settings(es_host, es_port, username, password):
8899
assert ".ds-logs-endpoint.events.file-default-" in response.text
89100
assert ".ds-logs-elastic_agent.endpoint_security-default-" in response.text
90101
assert ".ds-logs-elastic_agent-default-" in response.text
91-
assert ".ds-logs-system.syslog-default-" in response.text
102+
#assert ".ds-logs-system.syslog-default-" in response.text
92103
assert ".ds-logs-elastic_agent.filebeat-default-" in response.text
93-
assert ".ds-logs-system.auth-default-" in response.text
104+
#assert ".ds-logs-system.auth-default-" in response.text
94105
assert ".ds-logs-endpoint.events.network-default-" in response.text
106+
107+
assert ".ds-logs-endpoint.events.library-default-" in response.text
108+
assert ".ds-logs-system.system-default-" in response.text
109+
assert ".ds-logs-system.application-default-" in response.text
110+
assert ".ds-logs-endpoint.events.registry-default-" in response.text
111+
#assert ".ds-logs-endpoint.events.api-default-" in response.text
112+
assert ".ds-logs-system.security-default-" in response.text
113+
#assert ".ds-logs-endpoint.events.security-default-" in response.text
95114

96115
#@pytest.mark.skip(reason="Test is currently failing on develop branch")
97116
def test_elastic_agent_logs_search(es_host, es_port, username, password):
@@ -117,12 +136,12 @@ def test_elastic_agent_logs_search(es_host, es_port, username, password):
117136
assert "type" in data[rootKey]["hits"][x]["_source"]["agent"]
118137
assert "ephemeral_id" in data[rootKey]["hits"][x]["_source"]["agent"]
119138
assert "version" in data[rootKey]["hits"][x]["_source"]["agent"]
120-
assert data[rootKey]["hits"][x]["_source"]["agent"]["version"]=="8.15.3"
139+
assert data[rootKey]["hits"][x]["_source"]["agent"]["version"]=="8.15.5"
121140
assert "log" in data[rootKey]["hits"][x]["_source"]
122141
assert "offset" in data[rootKey]["hits"][x]["_source"]["log"]
123142
assert "id" in data[rootKey]["hits"][x]["_source"]["elastic_agent"]
124143
assert "version" in data[rootKey]["hits"][x]["_source"]["elastic_agent"]
125-
assert data[rootKey]["hits"][x]["_source"]["elastic_agent"]["version"]=="8.15.3"
144+
assert data[rootKey]["hits"][x]["_source"]["elastic_agent"]["version"]=="8.15.5"
126145
assert "snapshot" in data[rootKey]["hits"][x]["_source"]["elastic_agent"]
127146
assert "message" in data[rootKey]["hits"][x]["_source"]
128147
assert "file.line" in data[rootKey]["hits"][x]["_source"]["log.origin"]
@@ -145,7 +164,7 @@ def test_metrics_mapping(es_host, es_port, username, password):
145164
response = make_request(url, username, password)
146165

147166
assert response.status_code == 200, f"Expected 200, got {response.status_code}"
148-
assert ".ds-metrics-system.process.summary-default" in response.text
167+
#assert ".ds-metrics-system.process.summary-default" in response.text
149168
assert ".ds-metrics-system.memory-default-" in response.text
150169
assert ".ds-metrics-elastic_agent.endpoint_security-default-" in response.text
151170
assert ".ds-metrics-system.cpu-default-" in response.text
@@ -155,7 +174,7 @@ def test_metrics_mapping(es_host, es_port, username, password):
155174
assert ".ds-metrics-system.diskio-default-" in response.text
156175
assert ".ds-metrics-endpoint.policy-default-" in response.text
157176
assert ".ds-metrics-system.socket_summary-default-" in response.text
158-
assert ".ds-metrics-system.load-default-" in response.text
177+
#assert ".ds-metrics-system.load-default-" in response.text
159178
assert ".ds-metrics-fleet_server.agent_status-default-" in response.text
160179
assert "metrics-endpoint.metadata_current_default" in response.text
161180
assert ".ds-metrics-elastic_agent.elastic_agent-default-" in response.text
@@ -169,6 +188,7 @@ def test_metrics_mapping(es_host, es_port, username, password):
169188
assert ".ds-metrics-system.uptime-default-" in response.text
170189
assert ".ds-metrics-system.filesystem-default-" in response.text
171190

191+
assert ".ds-metrics-system.process.summary-default-" in response.text
172192

173193
def test_metrics_settings(es_host, es_port, username, password):
174194

@@ -179,7 +199,7 @@ def test_metrics_settings(es_host, es_port, username, password):
179199
assert ".ds-metrics-system.process.summary-default-" in response.text
180200
assert ".ds-metrics-system.fsstat-default-" in response.text
181201
assert ".ds-metrics-elastic_agent.fleet_server-default-" in response.text
182-
assert ".ds-metrics-system.load-default-" in response.text
202+
#assert ".ds-metrics-system.load-default-" in response.text
183203
assert ".ds-metrics-endpoint.metrics-default-" in response.text
184204
assert ".ds-metrics-endpoint.policy-default-" in response.text
185205
assert ".ds-metrics-elastic_agent.filebeat-default-" in response.text
@@ -328,8 +348,8 @@ def test_elastic_indices(es_host, es_port, username, password):
328348
assert ("open .ds-logs-elastic_agent.endpoint_security-default" in response.text)
329349
assert ("open elastalert_status_status" in response.text)
330350
assert ("open elastalert_status_past" in response.text)
331-
assert ("open .ds-logs-system.auth-default" in response.text)
332-
assert ("open .ds-logs-system.syslog-default" in response.text)
351+
#assert ("open .ds-logs-system.auth-default" in response.text)
352+
#assert ("open .ds-logs-system.syslog-default" in response.text)
333353
assert ("open .ds-logs-endpoint.events.network-default" in response.text)
334354
assert ("open .ds-logs-endpoint.events.file-default" in response.text)
335355
assert ("open wazuh-alerts-4.x" in response.text)

0 commit comments

Comments
 (0)