Skip to content

Commit d484024

Browse files
authored
Fix Test Failure - TestScanAsync_InvalidCursorId (#133)
Signed-off-by: currantw <taylor.curran@improving.com>
1 parent 3d94ecb commit d484024

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

rust/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,14 @@ pub unsafe extern "C-unwind" fn request_cluster_scan(
482482
Ok(existing_cursor) => existing_cursor,
483483
Err(_error) => {
484484
unsafe {
485-
(core.failure_callback)(
485+
report_error(
486+
core.failure_callback,
486487
callback_index,
487-
format!("Invalid cursor ID: {}", cursor_id).as_ptr() as *const c_char,
488+
format!("Invalid cursor ID: {}", cursor_id),
488489
RequestErrorType::Unspecified,
489490
);
490491
}
492+
panic_guard.panicked = false;
491493
return;
492494
}
493495
}
@@ -504,7 +506,10 @@ pub unsafe extern "C-unwind" fn request_cluster_scan(
504506
)
505507
} {
506508
Some(args) => args,
507-
None => return,
509+
None => {
510+
panic_guard.panicked = false;
511+
return;
512+
}
508513
};
509514

510515
// Run cluster scan.

tests/Valkey.Glide.IntegrationTests/ScanTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,16 @@ public async Task TestScanAsync_CombinedOptions(BaseClient client)
104104
[Fact]
105105
public async Task TestScanAsync_InvalidCursorId()
106106
{
107-
var standaloneClient = TestConfiguration.DefaultStandaloneClient();
108-
var exception = await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(async () =>
107+
using var standaloneClient = TestConfiguration.DefaultStandaloneClient();
108+
await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(() =>
109109
{
110-
await standaloneClient.ScanAsync("invalid");
110+
return standaloneClient.ScanAsync("invalid");
111111
});
112112

113-
var clusterClient = TestConfiguration.DefaultClusterClient();
114-
exception = await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(async () =>
113+
using var clusterClient = TestConfiguration.DefaultClusterClient();
114+
await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(() =>
115115
{
116-
await clusterClient.ScanAsync(new ClusterScanCursor("invalid"));
116+
return clusterClient.ScanAsync(new ClusterScanCursor("invalid"));
117117
});
118118
}
119119

0 commit comments

Comments
 (0)