Skip to content

Commit

Permalink
Improve testing of optional features. (redis-rs#1448)
Browse files Browse the repository at this point in the history
* Test for all optional dependencies.

This ensures that we test for combinations that include r2d2, which historically introduced build errors in some combinations.
In order not to include all optional dependencies, we declare them with the `dep:` prefix, so that they won't create an implicit feature.

* Bunch default features together.

In order to reduce the combinatorical explosion of feature combinations, we group all features that are in `default` into a single check.
  • Loading branch information
nihohit authored Dec 16, 2024
1 parent 42dc164 commit a871419
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion config/global.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
max_combo_size=3
skip_optional_deps=true
skip_optional_deps=false
7 changes: 6 additions & 1 deletion config/redis.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,9 @@ forbid = "tls"
# deprecated
[[rule]]
when = true
forbid = "async-std-tls-comp"
forbid = "async-std-tls-comp"

# these are all included in the `default` feature, so in order to reduce combinatoric explosion, we don't check them individually.
[[rule]]
when = true
forbid = ["acl", "OR", "streams", "OR", "geospatial", "OR", "script", "OR", "keep-alive"]
36 changes: 16 additions & 20 deletions redis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,29 @@ itertools = "0.13.0"
[features]
default = ["acl", "streams", "geospatial", "script", "keep-alive"]
acl = []
aio = ["bytes", "pin-project-lite", "futures-util", "futures-util/alloc", "futures-util/sink", "tokio/io-util", "tokio-util", "tokio-util/codec", "combine/tokio", "async-trait"]
aio = ["bytes", "dep:pin-project-lite", "dep:futures-util", "futures-util/alloc", "futures-util/sink", "dep:tokio", "tokio/io-util", "dep:tokio-util", "tokio-util/codec", "combine/tokio", "dep:async-trait"]
geospatial = []
json = ["serde", "serde/derive", "serde_json"]
cluster = ["crc16", "rand"]
script = ["sha1_smol"]
tls-native-tls = ["native-tls"]
tls-rustls = ["rustls/std", "rustls/ring", "rustls-native-certs", "rustls-pemfile", "rustls-pki-types"]
json = ["dep:serde", "serde/derive", "dep:serde_json"]
cluster = ["dep:crc16", "dep:rand"]
script = ["dep:sha1_smol"]
tls-native-tls = ["dep:native-tls"]
tls-rustls = ["dep:rustls","rustls/std", "rustls/ring", "dep:rustls-native-certs", "dep:rustls-pemfile", "dep:rustls-pki-types"]
tls-rustls-insecure = ["tls-rustls"]
tls-rustls-webpki-roots = ["tls-rustls", "webpki-roots"]
async-std-comp = ["aio", "async-std"]
async-std-native-tls-comp = ["async-std-comp", "async-native-tls", "tls-native-tls"]
async-std-rustls-comp = ["async-std-comp", "futures-rustls", "tls-rustls"]
tls-rustls-webpki-roots = ["tls-rustls", "dep:webpki-roots"]
async-std-comp = ["aio", "dep:async-std"]
async-std-native-tls-comp = ["async-std-comp", "dep:async-native-tls", "tls-native-tls"]
async-std-rustls-comp = ["async-std-comp", "dep:futures-rustls", "tls-rustls"]
tokio-comp = ["aio", "tokio/net"]
tokio-native-tls-comp = ["tokio-comp", "tls-native-tls", "tokio-native-tls"]
tokio-rustls-comp = ["tokio-comp", "tls-rustls", "tokio-rustls"]
connection-manager = ["futures", "aio", "backon"]
tokio-native-tls-comp = ["tokio-comp", "tls-native-tls", "dep:tokio-native-tls"]
tokio-rustls-comp = ["tokio-comp", "tls-rustls", "dep:tokio-rustls"]
connection-manager = ["dep:futures", "aio", "dep:backon"]
streams = []
cluster-async = ["cluster", "futures", "futures-util", "log"]
keep-alive = ["socket2"]
sentinel = ["rand"]
cluster-async = ["cluster", "dep:futures", "dep:futures-util", "dep:log"]
keep-alive = ["dep:socket2"]
sentinel = ["dep:rand"]
tcp_nodelay = []
rust_decimal = ["dep:rust_decimal"]
bigdecimal = ["dep:bigdecimal"]
num-bigint = []
uuid = ["dep:uuid"]
disable-client-setinfo = []
hashbrown = ["dep:hashbrown"]

# Deprecated features
tls = ["tls-native-tls"] # use "tls-native-tls" instead
Expand Down
2 changes: 1 addition & 1 deletion redis/tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl RedisServer {
modules: &[Module],
spawner: F,
) -> RedisServer {
#[cfg(feature = "rustls")]
#[cfg(feature = "tls-rustls")]
if rustls::crypto::CryptoProvider::get_default().is_none() {
// we don't care about success, because failure means that the provider was set from another thread.
let _ = rustls::crypto::ring::default_provider().install_default();
Expand Down

0 comments on commit a871419

Please sign in to comment.