about summary refs log tree commit diff
path: root/tools/journaldriver/src/tests.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-20T20·18+0000
committerVincent Ambo <tazjin@google.com>2019-12-20T20·18+0000
commit03bfe08e1dd9faf48b06cb146bfa446575cde88a (patch)
tree55317968922a9b2a01516f1b79527874df037517 /tools/journaldriver/src/tests.rs
parente52eed3cd4f73779c2e7c350537fb346835ba9f3 (diff)
chore: Significantly restructure folder layout r/237
This moves the various projects from "type-based" folders (such as
"services" or "tools") into more appropriate semantic folders (such as
"nix", "ops" or "web").

Deprecated projects (nixcon-demo & gotest) which only existed for
testing/demonstration purposes have been removed.

(Note: *all* builds are broken with this commit)
Diffstat (limited to 'tools/journaldriver/src/tests.rs')
-rw-r--r--tools/journaldriver/src/tests.rs95
1 files changed, 0 insertions, 95 deletions
diff --git a/tools/journaldriver/src/tests.rs b/tools/journaldriver/src/tests.rs
deleted file mode 100644
index 779add7a7012..000000000000
--- a/tools/journaldriver/src/tests.rs
+++ /dev/null
@@ -1,95 +0,0 @@
-use super::*;
-use serde_json::to_string;
-
-#[test]
-fn test_text_entry_serialization() {
-    let entry = LogEntry {
-        labels: Value::Null,
-        timestamp: None,
-        payload: Payload::TextPayload {
-            text_payload: "test entry".into(),
-        },
-        severity: None,
-    };
-
-    let expected = "{\"labels\":null,\"textPayload\":\"test entry\"}";
-    let result = to_string(&entry).expect("serialization failed");
-
-    assert_eq!(expected, result, "Plain text payload should serialize correctly")
-}
-
-#[test]
-fn test_json_entry_serialization() {
-    let entry = LogEntry {
-        labels: Value::Null,
-        timestamp: None,
-        payload: Payload::JsonPayload {
-            json_payload: json!({
-                "message": "JSON test"
-            })
-        },
-        severity: None,
-    };
-
-    let expected = "{\"labels\":null,\"jsonPayload\":{\"message\":\"JSON test\"}}";
-    let result = to_string(&entry).expect("serialization failed");
-
-    assert_eq!(expected, result, "JSOn payload should serialize correctly")
-}
-
-#[test]
-fn test_plain_text_payload() {
-    let message = "plain text payload".into();
-    let payload = message_to_payload(Some(message));
-    let expected = Payload::TextPayload {
-        text_payload: "plain text payload".into(),
-    };
-
-    assert_eq!(expected, payload, "Plain text payload should be detected correctly");
-}
-
-#[test]
-fn test_empty_payload() {
-    let payload = message_to_payload(None);
-    let expected = Payload::TextPayload {
-        text_payload: "empty log entry".into(),
-    };
-
-    assert_eq!(expected, payload, "Empty payload should be handled correctly");
-}
-
-#[test]
-fn test_json_payload() {
-    let message = "{\"someKey\":\"someValue\", \"otherKey\": 42}".into();
-    let payload = message_to_payload(Some(message));
-    let expected = Payload::JsonPayload {
-        json_payload: json!({
-            "someKey": "someValue",
-            "otherKey": 42
-        })
-    };
-
-    assert_eq!(expected, payload, "JSON payload should be detected correctly");
-}
-
-#[test]
-fn test_json_no_object() {
-    // This message can be parsed as valid JSON, but it is not an
-    // object - it should be returned as a plain-text payload.
-    let message = "42".into();
-    let payload = message_to_payload(Some(message));
-    let expected = Payload::TextPayload {
-        text_payload: "42".into(),
-    };
-
-    assert_eq!(expected, payload, "Non-object JSON payload should be plain text");
-}
-
-#[test]
-fn test_parse_microseconds() {
-    let input: String = "1529175149291187".into();
-    let expected: DateTime<Utc> = "2018-06-16T18:52:29.291187Z"
-        .to_string().parse().unwrap();
-
-    assert_eq!(Some(expected), parse_microseconds(input));
-}