Skip to content

Commit 733deaf

Browse files
committed
trying other mock_http_resposne
1 parent 29a3e2b commit 733deaf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

redis_enterprise_prometheus/tests/test_redis_enterprise_prometheus.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def test_instance_additional_check(aggregator, dd_run_check, mock_http_response)
2323
text_data = f.read()
2424

2525
# Mock the HTTP response
26-
mock_http_response(text_data, status_code=200, headers={"Content-Type": "text/plain"})
26+
mock_http_response(file_path=os.path.join(os.path.dirname(__file__), "data", "metrics.txt"), status_code=200, headers={"Content-Type": "text/plain"})
27+
2728

2829
# add additional metric groups for validation
2930
additional_metric_groups = ["REDIS2.DISK", "REDIS2.REPLICATION", "REDIS2.SEARCH"]
@@ -52,7 +53,7 @@ def test_instance_all_additional_check(aggregator, dd_run_check, mock_http_respo
5253
text_data = f.read()
5354

5455
# Mock the HTTP response
55-
mock_http_response(text_data, status_code=200, headers={"Content-Type": "text/plain"})
56+
mock_http_response(file_path=os.path.join(os.path.dirname(__file__), "data", "metrics.txt"), status_code=200, headers={"Content-Type": "text/plain"})
5657

5758
# add additional metric groups for validation
5859
additional_metric_groups = [
@@ -93,7 +94,7 @@ def test_instance_exclude_metrics(aggregator, dd_run_check, mock_http_response):
9394
text_data = f.read()
9495

9596
# Mock the HTTP response
96-
mock_http_response(text_data, status_code=200, headers={"Content-Type": "text/plain"})
97+
mock_http_response(file_path=os.path.join(os.path.dirname(__file__), "data", "metrics.txt"), status_code=200, headers={"Content-Type": "text/plain"})
9798

9899
# validate exclude_metrics are not present in metrics
99100
exclude_metrics = ["endpoint_client_connections", "redis_server_up"]
@@ -121,7 +122,7 @@ def test_instance_invalid_group_check(aggregator, dd_run_check, mock_http_respon
121122
text_data = f.read()
122123

123124
# Mock the HTTP response
124-
mock_http_response(text_data, status_code=200, headers={"Content-Type": "text/plain"})
125+
mock_http_response(file_path=os.path.join(os.path.dirname(__file__), "data", "metrics.txt"), status_code=200, headers={"Content-Type": "text/plain"})
125126

126127
instance = deepcopy(INSTANCE)
127128
instance["metric_groups"] = ["redis.bogus", "redis.raft"]
@@ -144,7 +145,7 @@ def test_invalid_instance(aggregator, dd_run_check, mock_http_response):
144145
text_data = f.read()
145146

146147
# Mock the HTTP response
147-
mock_http_response(text_data, status_code=200, headers={"Content-Type": "text/plain"})
148+
mock_http_response(file_path=os.path.join(os.path.dirname(__file__), "data", "metrics.txt"), status_code=200, headers={"Content-Type": "text/plain"})
148149

149150
instance = deepcopy(ERSATZ_INSTANCE)
150151
instance.pop("openmetrics_endpoint")

0 commit comments

Comments
 (0)