github.com/hernad/nomad@v1.6.112/drivers/shared/resolvconf/mount_unix_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  //go:build !windows
     5  
     6  package resolvconf
     7  
     8  import (
     9  	"os"
    10  	"path/filepath"
    11  	"testing"
    12  
    13  	"github.com/docker/docker/libnetwork/resolvconf"
    14  	"github.com/shoenig/test/must"
    15  )
    16  
    17  func Test_copySystemDNS(t *testing.T) {
    18  	data, err := os.ReadFile(resolvconf.Path())
    19  	must.NoError(t, err)
    20  
    21  	resolvConfFile := filepath.Join(t.TempDir(), "resolv.conf")
    22  
    23  	must.NoError(t, copySystemDNS(resolvConfFile))
    24  	must.FileExists(t, resolvConfFile)
    25  
    26  	tmpResolv, readErr := os.ReadFile(resolvConfFile)
    27  	must.NoError(t, readErr)
    28  	must.Eq(t, data, tmpResolv)
    29  }