Skip to content

Commit a2d87d8

Browse files
committed
feat(routing): add testing feature
Prefix, defined in the routing crate is used by crates mgmt and dataplane. Add a feature flag 'testing' so that external crates can use prefix converters that are only available for testing. Signed-off-by: Fredi Raspall <[email protected]>
1 parent 6b46043 commit a2d87d8

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

mgmt/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ tracing = { workspace = true }
1818
tracing-test = { workspace = true }
1919
nix = { workspace = true }
2020

21+
[dev-dependencies]
22+
routing = { workspace = true, features = ["testing"] }
23+

routing/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ license = "Apache-2.0"
77

88
[features]
99
auto-learn = []
10+
testing = []
1011

1112
[dependencies]
1213
ipnet = { workspace = true }

routing/src/prefix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl From<Ipv6Prefix> for Prefix {
171171
}
172172

173173
/// Only for testing. Will panic with badly formed address strings
174-
#[cfg(test)]
174+
#[cfg(any(test, feature = "testing"))]
175175
impl From<(&str, u8)> for Prefix {
176176
fn from(tuple: (&str, u8)) -> Self {
177177
let a = IpAddr::from_str(tuple.0).expect("Bad address");

0 commit comments

Comments
 (0)