github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/drivers/shared/resolvconf/mount_unix_test.go (about)

     1  // +build !windows
     2  
     3  package resolvconf
     4  
     5  import (
     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  
    15  func 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  }