diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-09-02 07:26:10 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-09-09 14:13:10 +0300 |
commit | 5ba8177bf2acbd44676065185797ca69a6ef56bb (patch) | |
tree | f7621116f16b4e53740a0b214e98f696d77df423 /test | |
parent | 6b9b03db88911c9939d5fc1d92d4b15912cc7665 (diff) |
refactor: avoid os.Is.. in favor of errors.Is
Diffstat (limited to 'test')
-rw-r--r-- | test/acceptance/acceptance_test.go | 4 | ||||
-rw-r--r-- | test/acceptance/helpers_test.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/test/acceptance/acceptance_test.go b/test/acceptance/acceptance_test.go index 9d0c0cd2..b36bd63d 100644 --- a/test/acceptance/acceptance_test.go +++ b/test/acceptance/acceptance_test.go @@ -1,8 +1,10 @@ package acceptance_test import ( + "errors" "flag" "fmt" + "io/fs" "log" "os" "testing" @@ -58,7 +60,7 @@ func TestMain(m *testing.M) { os.Exit(0) } - if _, err := os.Stat(*pagesBinary); os.IsNotExist(err) { + if _, err := os.Stat(*pagesBinary); errors.Is(err, fs.ErrNotExist) { log.Fatalf("Couldn't find gitlab-pages binary at %s\n", *pagesBinary) } diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index 33a19127..d9f2f14c 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -6,8 +6,10 @@ import ( "crypto/tls" "crypto/x509" "encoding/json" + "errors" "fmt" "io" + "io/fs" "net" "net/http" "net/http/httptest" @@ -554,7 +556,7 @@ func (o *stubOpts) getAPICalled() bool { func lookupFromFile(t *testing.T, domain string, w http.ResponseWriter) { fixture, err := os.Open("../../shared/lookups/" + domain + ".json") - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { w.WriteHeader(http.StatusNoContent) t.Logf("GitLab domain %s source stub served 204", domain) |