New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: MockConnection
helper for testing clients without a server
#465
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,2 @@ | ||
[package] | ||
name = "redis" | ||
version = "0.21.5" | ||
keywords = ["redis", "database"] | ||
description = "Redis driver for Rust." | ||
homepage = "https://github.com/redis-rs/redis-rs" | ||
repository = "https://github.com/redis-rs/redis-rs" | ||
documentation = "https://docs.rs/redis" | ||
license = "BSD-3-Clause" | ||
edition = "2018" | ||
rust-version = "1.57" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[dependencies] | ||
# These two are generally really common simple dependencies so it does not seem | ||
# much of a point to optimize these, but these could in theory be removed for | ||
# an indirection through std::Formatter. | ||
ryu = "1.0" | ||
itoa = "1.0" | ||
|
||
# This is a dependency that already exists in url | ||
percent-encoding = "2.1" | ||
|
||
# We need this for redis url parsing | ||
url = "2.1" | ||
|
||
# We need this for script support | ||
sha1_smol = { version = "1.0", optional = true } | ||
|
||
combine = { version = "4.6", default-features = false, features = ["std"] } | ||
|
||
# Only needed for AIO | ||
bytes = { version = "1", optional = true } | ||
futures-util = { version = "0.3.15", default-features = false, optional = true } | ||
pin-project-lite = { version = "0.2", optional = true } | ||
tokio-util = { version = "0.7", optional = true } | ||
tokio = { version = "1", features = ["rt", "net"], optional = true } | ||
|
||
# Only needed for the connection manager | ||
arc-swap = { version = "1.1.0", optional = true } | ||
futures = { version = "0.3.3", optional = true } | ||
|
||
# Only needed for the r2d2 feature | ||
r2d2 = { version = "0.8.8", optional = true } | ||
|
||
# Only needed for cluster | ||
crc16 = { version = "0.4", optional = true } | ||
rand = { version = "0.8", optional = true } | ||
# Only needed for async_std support | ||
async-std = { version = "1.8.0", optional = true} | ||
async-trait = { version = "0.1.24", optional = true } | ||
|
||
# Only needed for TLS | ||
native-tls = { version = "0.2", optional = true } | ||
tokio-native-tls = { version = "0.3", optional = true } | ||
async-native-tls = { version = "0.4", optional = true } | ||
|
||
# Optional aHash support | ||
ahash = { version = "0.7.6", optional = true } | ||
|
||
[features] | ||
default = ["acl", "streams", "geospatial", "script"] | ||
acl = [] | ||
aio = ["bytes", "pin-project-lite", "futures-util", "futures-util/alloc", "futures-util/sink", "tokio/io-util", "tokio-util", "tokio-util/codec", "tokio/sync", "combine/tokio", "async-trait"] | ||
geospatial = [] | ||
cluster = ["crc16", "rand"] | ||
script = ["sha1_smol"] | ||
tls = ["native-tls"] | ||
async-std-comp = ["aio", "async-std"] | ||
async-std-tls-comp = ["async-std-comp", "async-native-tls", "tls"] | ||
tokio-comp = ["aio", "tokio", "tokio/net"] | ||
tokio-native-tls-comp = ["tls", "tokio-native-tls"] | ||
connection-manager = ["arc-swap", "futures", "aio"] | ||
streams = [] | ||
|
||
|
||
[dev-dependencies] | ||
rand = "0.8" | ||
socket2 = "0.4" | ||
assert_approx_eq = "1.0" | ||
fnv = "1.0.5" | ||
futures = "0.3" | ||
criterion = "0.3" | ||
partial-io = { version = "0.5", features = ["tokio", "quickcheck1"] } | ||
quickcheck = "1.0.3" | ||
tokio = { version = "1", features = ["rt", "macros", "rt-multi-thread", "time"] } | ||
tempfile = "3.2" | ||
|
||
[[test]] | ||
name = "test_async" | ||
required-features = ["tokio-comp"] | ||
|
||
[[test]] | ||
name = "test_async_async_std" | ||
required-features = ["async-std-comp"] | ||
|
||
[[test]] | ||
name = "parser" | ||
required-features = ["aio"] | ||
|
||
[[test]] | ||
name = "test_acl" | ||
|
||
[[bench]] | ||
name = "bench_basic" | ||
harness = false | ||
required-features = ["tokio-comp"] | ||
|
||
[[bench]] | ||
name = "bench_cluster" | ||
harness = false | ||
required-features = ["cluster"] | ||
|
||
[[example]] | ||
name = "async-multiplexed" | ||
required-features = ["tokio-comp"] | ||
|
||
[[example]] | ||
name = "async-await" | ||
required-features = ["aio"] | ||
|
||
[[example]] | ||
name = "async-pub-sub" | ||
required-features = ["aio"] | ||
|
||
[[example]] | ||
name = "async-scan" | ||
required-features = ["aio"] | ||
|
||
[[example]] | ||
name = "async-connection-loss" | ||
required-features = ["connection-manager"] | ||
|
||
[[example]] | ||
name = "streams" | ||
required-features = ["streams"] | ||
[workspace] | ||
members = ["redis", "redis-test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "redis-test" | ||
version = "0.1.0" | ||
edition = "2018" | ||
description = "Testing helpers for the `redis` crate" | ||
homepage = "https://github.com/redis-rs/redis-rs" | ||
repository = "https://github.com/redis-rs/redis-rs" | ||
documentation = "https://docs.rs/redis-test" | ||
license = "BSD-3-Clause" | ||
|
||
[dependencies] | ||
redis = { version = "0.21.5", path = "../redis" } | ||
|
||
bytes = { version = "1", optional = true } | ||
djc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
futures = { version = "0.3", optional = true } | ||
|
||
[features] | ||
aio = ["futures", "redis/aio"] | ||
|
||
[dev-dependencies] | ||
redis = { version = "0.21.5", path = "../redis", features = ["aio", "tokio-comp"] } | ||
tokio = { version = "1", features = ["rt", "macros", "rt-multi-thread"] } | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to find nested crate workspaces confusing to navigate. Would you mind changing this so that the top-level
Cargo.toml
only contains the workspace, and move the redis crate into aredis
directory?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that be done in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(to avoid confusing commit history)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my mind the ideal way to submit it would be a single PR with clean commits: one commit that moves the code around and one commit that adds the new crate. Each commit should ideally pass CI, though I usually don't test that explicitly (but it sucks if formatting changes for one commit make it into another).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it sounds like that PRs are not squashed before merge then. Will do as separate commits in this PR then. (Context: My company merges via squash-and-merge generally for PRs so a separate PR would be the only way to accomplish having separate commit history in that case.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also okay with separate PRs if you prefer. For my own changes I usually submit clean commits "manually" (squashing with interactive rebase). If a PR only contains one logical change, I'll also squash via merge in the Git UI, but I don't like doing that for changes that contain multiple logical changes.