LCOV - code coverage report
Current view: top level - libs/pageserver_api/src/config - tests.rs (source / functions) Coverage Total Hit
Test: 5fe7fa8d483b39476409aee736d6d5e32728bfac.info Lines: 100.0 % 41 41
Test Date: 2025-03-12 16:10:49 Functions: 100.0 % 2 2

            Line data    Source code
       1              : use super::*;
       2              : 
       3              : #[test]
       4            1 : fn test_node_metadata_v1_backward_compatibilty() {
       5            1 :     let v1 = serde_json::to_vec(&serde_json::json!({
       6            1 :         "host": "localhost",
       7            1 :         "port": 23,
       8            1 :         "http_host": "localhost",
       9            1 :         "http_port": 42,
      10            1 :     }));
      11            1 : 
      12            1 :     assert_eq!(
      13            1 :         serde_json::from_slice::<NodeMetadata>(&v1.unwrap()).unwrap(),
      14            1 :         NodeMetadata {
      15            1 :             postgres_host: "localhost".to_string(),
      16            1 :             postgres_port: 23,
      17            1 :             http_host: "localhost".to_string(),
      18            1 :             http_port: 42,
      19            1 :             https_port: None,
      20            1 :             other: HashMap::new(),
      21            1 :         }
      22            1 :     )
      23            1 : }
      24              : 
      25              : #[test]
      26            1 : fn test_node_metadata_v2_backward_compatibilty() {
      27            1 :     let v2 = serde_json::to_vec(&serde_json::json!({
      28            1 :         "host": "localhost",
      29            1 :         "port": 23,
      30            1 :         "http_host": "localhost",
      31            1 :         "http_port": 42,
      32            1 :         "https_port": 123,
      33            1 :     }));
      34            1 : 
      35            1 :     assert_eq!(
      36            1 :         serde_json::from_slice::<NodeMetadata>(&v2.unwrap()).unwrap(),
      37            1 :         NodeMetadata {
      38            1 :             postgres_host: "localhost".to_string(),
      39            1 :             postgres_port: 23,
      40            1 :             http_host: "localhost".to_string(),
      41            1 :             http_port: 42,
      42            1 :             https_port: Some(123),
      43            1 :             other: HashMap::new(),
      44            1 :         }
      45            1 :     )
      46            1 : }
        

Generated by: LCOV version 2.1-beta