Skip to content

Commit c27b77e

Browse files
format + add python version to manifest
1 parent a5d280b commit c27b77e

4 files changed

Lines changed: 20 additions & 22 deletions

File tree

drift/instrumentation/redis/e2e-tests/src/app.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def redis_keys(pattern):
8888
except Exception as e:
8989
return jsonify({"error": str(e)}), 500
9090

91+
9192
@app.route("/test/mget-mset", methods=["GET"])
9293
def test_mget_mset():
9394
"""Test MGET/MSET - multiple key operations."""
@@ -102,6 +103,7 @@ def test_mget_mset():
102103
except Exception as e:
103104
return jsonify({"error": str(e)}), 500
104105

106+
105107
@app.route("/test/pipeline-basic", methods=["GET"])
106108
def test_pipeline_basic():
107109
"""Test basic pipeline operations."""
@@ -134,6 +136,7 @@ def test_pipeline_no_transaction():
134136
except Exception as e:
135137
return jsonify({"error": str(e)}), 500
136138

139+
137140
@app.route("/test/async-pipeline", methods=["GET"])
138141
def test_async_pipeline():
139142
"""Test async pipeline operations using asyncio."""
@@ -146,7 +149,7 @@ async def run_async_pipeline():
146149
host=os.getenv("REDIS_HOST", "redis"),
147150
port=int(os.getenv("REDIS_PORT", "6379")),
148151
db=0,
149-
decode_responses=True
152+
decode_responses=True,
150153
)
151154

152155
try:
@@ -167,13 +170,11 @@ async def run_async_pipeline():
167170

168171
try:
169172
results = asyncio.run(run_async_pipeline())
170-
return jsonify({
171-
"success": True,
172-
"results": results
173-
})
173+
return jsonify({"success": True, "results": results})
174174
except Exception as e:
175175
return jsonify({"error": str(e)}), 500
176176

177+
177178
@app.route("/test/binary-data", methods=["GET"])
178179
def test_binary_data():
179180
"""Test binary data that cannot be decoded as UTF-8."""
@@ -183,7 +184,7 @@ def test_binary_data():
183184
host=os.getenv("REDIS_HOST", "redis"),
184185
port=int(os.getenv("REDIS_PORT", "6379")),
185186
db=0,
186-
decode_responses=False
187+
decode_responses=False,
187188
)
188189

189190
# Binary data that cannot be decoded as UTF-8
@@ -198,15 +199,18 @@ def test_binary_data():
198199
# Clean up
199200
binary_client.delete("test:binary:key")
200201

201-
return jsonify({
202-
"success": True,
203-
"original_hex": binary_value.hex(),
204-
"retrieved_hex": retrieved.hex() if retrieved else None,
205-
"match": binary_value == retrieved
206-
})
202+
return jsonify(
203+
{
204+
"success": True,
205+
"original_hex": binary_value.hex(),
206+
"retrieved_hex": retrieved.hex() if retrieved else None,
207+
"match": binary_value == retrieved,
208+
}
209+
)
207210
except Exception as e:
208211
return jsonify({"error": str(e)}), 500
209212

213+
210214
@app.route("/test/transaction-watch", methods=["GET"])
211215
def test_transaction_watch():
212216
"""Test transaction with WATCH pattern.
@@ -235,12 +239,7 @@ def test_transaction_watch():
235239
# Clean up
236240
redis_client.delete("test:watch:counter")
237241

238-
return jsonify({
239-
"success": True,
240-
"initial_value": 10,
241-
"expected_final": 15,
242-
"results": results
243-
})
242+
return jsonify({"success": True, "initial_value": 10, "expected_final": 15, "results": results})
244243
except Exception as e:
245244
return jsonify({"error": str(e)}), 500
246245

drift/instrumentation/redis/e2e-tests/src/test_requests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def make_request(method, endpoint, **kwargs):
3333
# Get operations
3434
make_request("GET", "/redis/get/test_key")
3535
make_request("GET", "/redis/get/test_key_expiry")
36-
# TODO: figure out why this test fails during replay
37-
# make_request("GET", "/redis/get/nonexistent_key")
36+
make_request("GET", "/redis/get/nonexistent_key")
3837

3938
# Increment operations
4039
make_request("POST", "/redis/incr/counter")

drift/instrumentation/redis/instrumentation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,7 @@ def _build_command_input_value(self, command_str: str, args: tuple) -> dict[str,
732732
def _build_pipeline_input_value(self, command_str: str, command_stack: list) -> dict[str, Any]:
733733
"""Build input_value for pipeline operations (used by both record and replay)."""
734734
serialized_commands = [
735-
self._serialize_args(cmd.args if hasattr(cmd, "args") else cmd[0])
736-
for cmd in command_stack
735+
self._serialize_args(cmd.args if hasattr(cmd, "args") else cmd[0]) for cmd in command_stack
737736
]
738737
return {
739738
"command": command_str,

scripts/generate_manifest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def main() -> int:
176176
manifest = {
177177
"sdkVersion": sdk_version,
178178
"language": "python",
179+
"pythonVersion": ">=3.12",
179180
"generatedAt": datetime.now(UTC).isoformat().replace("+00:00", "Z"),
180181
"instrumentations": instrumentations,
181182
}

0 commit comments

Comments
 (0)