chore: cfg(test) a test in rpc. (#3978)

The test in particular should be included in our release binary at
present. :/
Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-01-09 18:00:54 +01:00 committed by GitHub
parent 824d06e2b2
commit ab6cd1d93a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 31 deletions

23
Cargo.lock generated
View file

@ -1515,7 +1515,7 @@ dependencies = [
"tonic", "tonic",
"tower", "tower",
"tracing", "tracing",
"tracing-log", "tracing-log 0.1.3",
"tracing-subscriber", "tracing-subscriber",
"unindent", "unindent",
"util", "util",
@ -6930,9 +6930,9 @@ dependencies = [
[[package]] [[package]]
name = "sharded-slab" name = "sharded-slab"
version = "0.1.4" version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
] ]
@ -8316,6 +8316,17 @@ dependencies = [
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]] [[package]]
name = "tracing-serde" name = "tracing-serde"
version = "0.1.3" version = "0.1.3"
@ -8328,9 +8339,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.17" version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
dependencies = [ dependencies = [
"matchers", "matchers",
"nu-ansi-term", "nu-ansi-term",
@ -8343,7 +8354,7 @@ dependencies = [
"thread_local", "thread_local",
"tracing", "tracing",
"tracing-core", "tracing-core",
"tracing-log", "tracing-log 0.2.0",
"tracing-serde", "tracing-serde",
] ]

View file

@ -76,8 +76,12 @@ impl Notification {
} }
} }
#[test] #[cfg(test)]
fn test_notification() { mod tests {
use crate::Notification;
#[test]
fn test_notification() {
// Notifications can be serialized and deserialized. // Notifications can be serialized and deserialized.
for notification in [ for notification in [
Notification::ContactRequest { sender_id: 1 }, Notification::ContactRequest { sender_id: 1 },
@ -102,4 +106,5 @@ fn test_notification() {
// stored separately, and do not appear redundantly in the JSON. // stored separately, and do not appear redundantly in the JSON.
let notification = Notification::ContactRequest { sender_id: 1 }; let notification = Notification::ContactRequest { sender_id: 1 };
assert_eq!(notification.to_proto().content, "{}"); assert_eq!(notification.to_proto().content, "{}");
}
} }