1
0
mirror of https://github.com/golang/go synced 2024-09-29 14:24:32 -06:00

update test

This commit is contained in:
Mateusz Poliwczak 2022-11-17 09:44:54 +01:00
parent eb872127d6
commit 894f066bbc
2 changed files with 3 additions and 7 deletions

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || aix //go:build unix
package net package net

View File

@ -10,7 +10,6 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"io/fs"
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
@ -2531,7 +2530,7 @@ func TestLookupOrderFilesNoSuchHost(t *testing.T) {
if runtime.GOOS == "openbsd" { if runtime.GOOS == "openbsd" {
// Set error to ErrNotExist, so that the hostLookupOrder // Set error to ErrNotExist, so that the hostLookupOrder
// returns hostLookupFiles for openbsd. // returns hostLookupFiles for openbsd.
resolvConf.err = fs.ErrNotExist resolvConf.err = os.ErrNotExist
} }
if !conf.forceUpdateConf(&resolvConf, time.Now().Add(time.Hour)) { if !conf.forceUpdateConf(&resolvConf, time.Now().Add(time.Hour)) {
@ -2539,12 +2538,9 @@ func TestLookupOrderFilesNoSuchHost(t *testing.T) {
} }
tmpFile := filepath.Join(t.TempDir(), "hosts") tmpFile := filepath.Join(t.TempDir(), "hosts")
f, err := os.OpenFile(tmpFile, os.O_CREATE|os.O_WRONLY, 0660) if err := os.WriteFile(tmpFile, []byte{}, 0660); err != nil {
if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer f.Close()
testHookHostsPath = tmpFile testHookHostsPath = tmpFile
const testName = "test.invalid" const testName = "test.invalid"