cmd: allow import/running ctrld as library

This commit is contained in:
Cuong Manh Le
2023-08-15 11:15:37 +00:00
committed by Cuong Manh Le
parent 4896563e3c
commit 829e93c079
34 changed files with 195 additions and 188 deletions
+23
View File
@@ -0,0 +1,23 @@
package cli
import (
"reflect"
"strings"
"testing"
)
func Test_getDNSBySystemdResolvedFromReader(t *testing.T) {
r := strings.NewReader(`Link 2 (eth0)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 8.8.8.8
8.8.4.4`)
want := []string{"8.8.8.8", "8.8.4.4"}
ns := getDNSBySystemdResolvedFromReader(r)
if !reflect.DeepEqual(ns, want) {
t.Logf("unexpected result, want: %v, got: %v", want, ns)
}
}