File: relax-tests.patch

package info (click to toggle)
rust-trust-dns-resolver 0.22.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 672 kB
  • sloc: makefile: 2
file content (112 lines) | stat: -rw-r--r-- 3,960 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Index: trust-dns-resolver/src/hosts.rs
===================================================================
--- trust-dns-resolver.orig/src/hosts.rs
+++ trust-dns-resolver/src/hosts.rs
@@ -180,79 +180,3 @@ pub(crate) fn read_hosts_conf<P: AsRef<P
     Hosts::default().read_hosts_conf(file)
 }
 
-#[cfg(any(unix, windows))]
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use std::env;
-    use std::net::{Ipv4Addr, Ipv6Addr};
-
-    fn tests_dir() -> String {
-        let server_path = env::var("TDNS_WORKSPACE_ROOT").unwrap_or_else(|_| "../..".to_owned());
-        format! {"{}/crates/resolver/tests", server_path}
-    }
-
-    #[test]
-    fn test_read_hosts_conf() {
-        let path = format!("{}/hosts", tests_dir());
-        let hosts = read_hosts_conf(&path).unwrap();
-
-        let name = Name::from_str("localhost").unwrap();
-        let rdatas = hosts
-            .lookup_static_host(&Query::query(name.clone(), RecordType::A))
-            .unwrap()
-            .iter()
-            .map(ToOwned::to_owned)
-            .collect::<Vec<RData>>();
-
-        assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(127, 0, 0, 1))]);
-
-        let rdatas = hosts
-            .lookup_static_host(&Query::query(name, RecordType::AAAA))
-            .unwrap()
-            .iter()
-            .map(ToOwned::to_owned)
-            .collect::<Vec<RData>>();
-
-        assert_eq!(
-            rdatas,
-            vec![RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1))]
-        );
-
-        let name = Name::from_str("broadcasthost").unwrap();
-        let rdatas = hosts
-            .lookup_static_host(&Query::query(name, RecordType::A))
-            .unwrap()
-            .iter()
-            .map(ToOwned::to_owned)
-            .collect::<Vec<RData>>();
-        assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(255, 255, 255, 255))]);
-
-        let name = Name::from_str("example.com").unwrap();
-        let rdatas = hosts
-            .lookup_static_host(&Query::query(name, RecordType::A))
-            .unwrap()
-            .iter()
-            .map(ToOwned::to_owned)
-            .collect::<Vec<RData>>();
-        assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(10, 0, 1, 102))]);
-
-        let name = Name::from_str("a.example.com").unwrap();
-        let rdatas = hosts
-            .lookup_static_host(&Query::query(name, RecordType::A))
-            .unwrap()
-            .iter()
-            .map(ToOwned::to_owned)
-            .collect::<Vec<RData>>();
-        assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(10, 0, 1, 111))]);
-
-        let name = Name::from_str("b.example.com").unwrap();
-        let rdatas = hosts
-            .lookup_static_host(&Query::query(name, RecordType::A))
-            .unwrap()
-            .iter()
-            .map(ToOwned::to_owned)
-            .collect::<Vec<RData>>();
-        assert_eq!(rdatas, vec![RData::A(Ipv4Addr::new(10, 0, 1, 111))]);
-    }
-}
Index: trust-dns-resolver/src/system_conf/unix.rs
===================================================================
--- trust-dns-resolver.orig/src/system_conf/unix.rs
+++ trust-dns-resolver/src/system_conf/unix.rs
@@ -146,11 +146,6 @@ mod tests {
         ]
     }
 
-    fn tests_dir() -> String {
-        let server_path = env::var("TDNS_WORKSPACE_ROOT").unwrap_or_else(|_| "../..".to_owned());
-        format!("{}/crates/resolver/tests", server_path)
-    }
-
     #[test]
     #[allow(clippy::redundant_clone)]
     fn test_name_server() {
@@ -189,11 +184,4 @@ mod tests {
         assert_eq!(cfg, parsed.0);
         assert_eq!(ResolverOpts::default(), parsed.1);
     }
-
-    #[test]
-    fn test_read_resolv_conf() {
-        read_resolv_conf(format!("{}/resolv.conf-simple", tests_dir())).expect("simple failed");
-        read_resolv_conf(format!("{}/resolv.conf-macos", tests_dir())).expect("macos failed");
-        read_resolv_conf(format!("{}/resolv.conf-linux", tests_dir())).expect("linux failed");
-    }
 }