mirror of https://github.com/jetkvm/kvm.git
36 lines
627 B
Go
36 lines
627 B
Go
package dhclient
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestToResolvConf(t *testing.T) {
|
|
rc, err := toResolvConf(
|
|
"eth0",
|
|
[]net.IP{
|
|
net.ParseIP("198.51.100.53"),
|
|
net.ParseIP("203.0.113.53"),
|
|
},
|
|
[]string{"example.com"},
|
|
"example.com",
|
|
)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
want := `# the resolv.conf file is managed by the jetkvm-dhclient service
|
|
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
|
|
|
|
|
search example.com # eth0
|
|
domain example.com # eth0
|
|
nameserver 198.51.100.53 # eth0
|
|
nameserver 203.0.113.53 # eth0
|
|
`
|
|
|
|
assert.Equal(t, want, rc.String())
|
|
}
|