github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/drivers/shared/resolvconf/mount_unix_test.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package resolvconf
     5  
     6  import (
     7  	"io/ioutil"
     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  	dest := filepath.Join(t.TempDir(), "resolv.conf")
    21  
    22  	require.NoError(copySystemDNS(dest))
    23  	require.FileExists(dest)
    24  
    25  	tmpResolv, err := ioutil.ReadFile(dest)
    26  	require.NoError(err)
    27  	require.Equal(data, tmpResolv)
    28  }