Skip to content

Commit 5bc3bc3

Browse files
feat: add test-support feature for consumer testing (#43)
Add a new test-support feature that provides mock server utilities and fixtures for testing code that uses the redis-cloud client library. The testing module includes: - MockCloudServer: A pre-configured mock server wrapper around wiremock with convenience methods for common Redis Cloud API endpoints - Fixtures: Builder-pattern fixtures for Subscription, Database, Task, Account, and User responses - Response helpers: Convenience functions for creating success and error HTTP responses (success, created, accepted, not_found, rate_limited, etc.) Consumers can enable this with: redis-cloud = { version = "0.8", features = ["test-support"] } This mirrors the test-support feature already available in redis-enterprise.
1 parent 86f480f commit 5bc3bc3

File tree

6 files changed

+1336
-0
lines changed

6 files changed

+1336
-0
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ futures-core = "0.3"
3333

3434
[features]
3535
tower-integration = ["tower"]
36+
test-support = ["wiremock"]
37+
38+
[dependencies.wiremock]
39+
version = "0.6"
40+
optional = true
3641

3742
[dev-dependencies]
3843
wiremock = "0.6"

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ pub use error::{CloudError, Result};
295295
#[cfg(feature = "tower-integration")]
296296
pub use client::tower_support;
297297

298+
// Test support module - only available with test-support feature
299+
#[cfg(feature = "test-support")]
300+
pub mod testing;
301+
298302
// Types module for shared models
299303
pub mod types;
300304

0 commit comments

Comments
 (0)