Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2021-08-25 09:47:53 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-08-25 10:29:46 +0300
commitac23f02465369644c7d835a667e2c034fc629c37 (patch)
tree0fc3a82f45272a5b69f07f4b327c741091a20f94
parent135c1398b2531103d3aeebaee66f19ef799f1f52 (diff)
chore: replace ioutil.WriteFile with os
-rw-r--r--internal/redirects/redirects_benchmark_test.go3
-rw-r--r--internal/redirects/redirects_test.go5
2 files changed, 3 insertions, 5 deletions
diff --git a/internal/redirects/redirects_benchmark_test.go b/internal/redirects/redirects_benchmark_test.go
index 87452172..be86eb0c 100644
--- a/internal/redirects/redirects_benchmark_test.go
+++ b/internal/redirects/redirects_benchmark_test.go
@@ -2,7 +2,6 @@ package redirects
import (
"context"
- "io/ioutil"
"net/url"
"path"
"strings"
@@ -24,7 +23,7 @@ func generateRedirectsFile(dirPath string, count int) error {
content += "/entrance.html /exit.html 301\n"
- return ioutil.WriteFile(path.Join(dirPath, ConfigFile), []byte(content), 0600)
+ return os.WriteFile(path.Join(dirPath, ConfigFile), []byte(content), 0600)
}
func benchmarkRedirectsRewrite(b *testing.B, redirectsCount int) {
diff --git a/internal/redirects/redirects_test.go b/internal/redirects/redirects_test.go
index 2fe0034a..118b99a5 100644
--- a/internal/redirects/redirects_test.go
+++ b/internal/redirects/redirects_test.go
@@ -2,7 +2,6 @@ package redirects
import (
"context"
- "io/ioutil"
"net/url"
"os"
"path"
@@ -205,7 +204,7 @@ func TestRedirectsParseRedirects(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if tt.redirectsFile != "" {
- err := ioutil.WriteFile(path.Join(tmpDir, ConfigFile), []byte(tt.redirectsFile), 0600)
+ err := os.WriteFile(path.Join(tmpDir, ConfigFile), []byte(tt.redirectsFile), 0600)
require.NoError(t, err)
}
@@ -225,7 +224,7 @@ func TestRedirectsParseRedirects(t *testing.T) {
func TestMaxRuleCount(t *testing.T) {
root, tmpDir := testhelpers.TmpDir(t, "TooManyRules_tests")
- err := ioutil.WriteFile(path.Join(tmpDir, ConfigFile), []byte(strings.Repeat("/goto.html /target.html 301\n", maxRuleCount-1)+
+ err := os.WriteFile(path.Join(tmpDir, ConfigFile), []byte(strings.Repeat("/goto.html /target.html 301\n", maxRuleCount-1)+
"/1000.html /target1000 301\n"+
"/1001.html /target1001 301\n",
), 0600)