aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/git_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/git_test.go')
-rw-r--r--integrations/git_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go
index 72e01d3753..9a264c9448 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -7,10 +7,10 @@ package integrations
import (
"encoding/hex"
"fmt"
- "io/ioutil"
"math/rand"
"net/http"
"net/url"
+ "os"
"path"
"path/filepath"
"strconv"
@@ -52,7 +52,7 @@ func testGit(t *testing.T, u *url.URL) {
httpContext.Reponame = "repo-tmp-17"
forkedUserCtx.Reponame = httpContext.Reponame
- dstPath, err := ioutil.TempDir("", httpContext.Reponame)
+ dstPath, err := os.MkdirTemp("", httpContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -102,7 +102,7 @@ func testGit(t *testing.T, u *url.URL) {
sshURL := createSSHUrl(sshContext.GitPath(), u)
//Setup clone folder
- dstPath, err := ioutil.TempDir("", sshContext.Reponame)
+ dstPath, err := os.MkdirTemp("", sshContext.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(dstPath)
@@ -128,7 +128,7 @@ func testGit(t *testing.T, u *url.URL) {
}
func ensureAnonymousClone(t *testing.T, u *url.URL) {
- dstLocalPath, err := ioutil.TempDir("", "repo1")
+ dstLocalPath, err := os.MkdirTemp("", "repo1")
assert.NoError(t, err)
defer util.RemoveAll(dstLocalPath)
t.Run("CloneAnonymous", doGitClone(dstLocalPath, u))
@@ -311,7 +311,7 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin
buffer := make([]byte, bufSize)
- tmpFile, err := ioutil.TempFile(repoPath, prefix)
+ tmpFile, err := os.CreateTemp(repoPath, prefix)
if err != nil {
return "", err
}
@@ -558,7 +558,7 @@ func doPushCreate(ctx APITestContext, u *url.URL) func(t *testing.T) {
u.Path = ctx.GitPath()
// Create a temporary directory
- tmpDir, err := ioutil.TempDir("", ctx.Reponame)
+ tmpDir, err := os.MkdirTemp("", ctx.Reponame)
assert.NoError(t, err)
defer util.RemoveAll(tmpDir)
@@ -636,7 +636,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
t.Run("CreateHeadBranch", doGitCreateBranch(dstPath, headBranch))
t.Run("AddCommit", func(t *testing.T) {
- err := ioutil.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0666)
+ err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0666)
if !assert.NoError(t, err) {
return
}
@@ -710,7 +710,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
}
t.Run("AddCommit2", func(t *testing.T) {
- err := ioutil.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0666)
+ err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0666)
if !assert.NoError(t, err) {
return
}