Skip to content

Commit 635891b

Browse files
committed
fix: bind blob payloads as parameters in postgres test helpers
1 parent c23fe49 commit 635891b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/db/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@ mod tests {
205205
async fn insert_test_event(pool: &DbPool, event_id: &str, project_id: i64, timestamp: i64) {
206206
sqlx::query(sql!(
207207
"INSERT INTO events (event_id, item_type, payload, project_id, public_key, timestamp, level, title, received_at, monitor_slug, session_status, parent_event_id)
208-
VALUES (?1, 'event', X'00', ?2, 'testkey', ?3, 'error', 'test title', ?3, NULL, NULL, NULL)",
208+
VALUES (?1, 'event', ?2, ?3, 'testkey', ?4, 'error', 'test title', ?4, NULL, NULL, NULL)",
209209
))
210210
.bind(event_id)
211+
.bind(&[0u8] as &[u8])
211212
.bind(project_id)
212213
.bind(timestamp)
213214
.execute(pool)
@@ -286,9 +287,10 @@ mod tests {
286287
) {
287288
sqlx::query(sql!(
288289
"INSERT INTO events (event_id, item_type, payload, project_id, public_key, timestamp, level, title, received_at, fingerprint)
289-
VALUES (?1, 'event', X'00', ?2, 'testkey', ?3, 'error', 'test title', ?3, ?4)",
290+
VALUES (?1, 'event', ?2, ?3, 'testkey', ?4, 'error', 'test title', ?4, ?5)",
290291
))
291292
.bind(event_id)
293+
.bind(&[0u8] as &[u8])
292294
.bind(project_id)
293295
.bind(received_at)
294296
.bind(fingerprint)

src/queries/events.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,9 @@ mod tests {
710710
// Shove in a garbage payload to make sure decompression errors surface
711711
sqlx::query(sql!(
712712
"INSERT INTO events (event_id, item_type, payload, project_id, public_key, timestamp, received_at)
713-
VALUES ('bad', 'event', X'DEADBEEF', 1, 'testkey', 100, 100)"
713+
VALUES ('bad', 'event', ?1, 1, 'testkey', 100, 100)"
714714
))
715+
.bind(&[0xDE, 0xAD, 0xBE, 0xEF] as &[u8])
715716
.execute(&pool)
716717
.await
717718
.unwrap();

0 commit comments

Comments
 (0)