1// +build !windows
2
3package resolvconf
4
5import (
6	"io/ioutil"
7	"os"
8	"path/filepath"
9	"testing"
10
11	dresolvconf "github.com/docker/libnetwork/resolvconf"
12	"github.com/stretchr/testify/require"
13)
14
15func Test_copySystemDNS(t *testing.T) {
16	require := require.New(t)
17	data, err := ioutil.ReadFile(dresolvconf.Path())
18	require.NoError(err)
19
20	tmp, err := ioutil.TempDir("", "copySystemDNS_Test")
21	require.NoError(err)
22	defer os.RemoveAll(tmp)
23	dest := filepath.Join(tmp, "resolv.conf")
24
25	require.NoError(copySystemDNS(dest))
26	require.FileExists(dest)
27
28	tmpResolv, err := ioutil.ReadFile(dest)
29	require.NoError(err)
30	require.Equal(data, tmpResolv)
31}
32