refactor: Update dependencies and remove unused code

This commit is contained in:
Marvin Zhang
2024-07-13 11:16:17 +08:00
parent 9073f1ca02
commit 96ba586cd2
4 changed files with 46 additions and 30 deletions

View File

@@ -35,7 +35,6 @@ require (
github.com/apex/log v1.9.0 // indirect github.com/apex/log v1.9.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect github.com/bytedance/sonic v1.9.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.0 // indirect github.com/cenkalti/backoff/v4 v4.1.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cloudflare/circl v1.3.7 // indirect github.com/cloudflare/circl v1.3.7 // indirect
github.com/crawlab-team/crawlab/db v0.0.0-20240614095218-7b4ee8399ab0 // indirect github.com/crawlab-team/crawlab/db v0.0.0-20240614095218-7b4ee8399ab0 // indirect
github.com/crawlab-team/crawlab/fs v0.0.0-20240614095218-7b4ee8399ab0 // indirect github.com/crawlab-team/crawlab/fs v0.0.0-20240614095218-7b4ee8399ab0 // indirect
@@ -80,10 +79,10 @@ require (
github.com/jackc/pgconn v1.11.0 // indirect github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgx/v4 v4.15.0 // indirect github.com/jackc/pgx/v4 v4.18.2 // indirect
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect

View File

@@ -26,7 +26,6 @@ require (
github.com/fsnotify/fsnotify v1.7.0 github.com/fsnotify/fsnotify v1.7.0
github.com/gavv/httpexpect/v2 v2.16.0 github.com/gavv/httpexpect/v2 v2.16.0
github.com/gin-gonic/gin v1.10.0 github.com/gin-gonic/gin v1.10.0
github.com/go-git/go-git/v5 v5.12.0
github.com/golang-jwt/jwt/v5 v5.2.1 github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3 github.com/gorilla/websocket v1.5.3
@@ -107,10 +106,10 @@ require (
github.com/jackc/pgconn v1.11.0 // indirect github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgx/v4 v4.15.0 // indirect github.com/jackc/pgx/v4 v4.18.2 // indirect
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect

View File

@@ -702,8 +702,23 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
github.com/imroc/req v0.3.2/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw= github.com/imroc/req v0.3.2/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w=
github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM=
github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag=
github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgtype v1.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw=
github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
github.com/jackc/pgx/v4 v4.18.0/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE=
github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU=
github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
github.com/jackc/puddle v1.2.1 h1:gI8os0wpRXFd4FiAY2dWiqRK037tjj3t7rKFeO4X5iw= github.com/jackc/puddle v1.2.1 h1:gI8os0wpRXFd4FiAY2dWiqRK037tjj3t7rKFeO4X5iw=
github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0=
github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
@@ -875,6 +890,7 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
@@ -882,6 +898,7 @@ golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=

View File

@@ -5,10 +5,10 @@ import (
"fmt" "fmt"
"github.com/crawlab-team/crawlab/vcs" "github.com/crawlab-team/crawlab/vcs"
"github.com/go-git/go-billy/v5/memfs" "github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/storage/memory" "github.com/go-git/go-git/v5/storage/memory"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"io/ioutil"
"os" "os"
"path" "path"
"testing" "testing"
@@ -61,7 +61,7 @@ func TestGitClient_CommitAllAndCheckoutBranch(t *testing.T) {
// commit // commit
filePath := path.Join(T.LocalRepoPath, T.TestFileName) filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766)) err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err) require.Nil(t, err)
err = T.LocalRepo.CommitAll(T.TestCommitMessage) err = T.LocalRepo.CommitAll(T.TestCommitMessage)
require.Nil(t, err) require.Nil(t, err)
@@ -86,7 +86,7 @@ func TestGitClient_Push(t *testing.T) {
// commit // commit
filePath := path.Join(T.LocalRepoPath, T.TestFileName) filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766)) err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err) require.Nil(t, err)
err = T.LocalRepo.CommitAll(T.TestCommitMessage) err = T.LocalRepo.CommitAll(T.TestCommitMessage)
require.Nil(t, err) require.Nil(t, err)
@@ -102,7 +102,7 @@ func TestGitClient_Reset(t *testing.T) {
// file // file
filePath := path.Join(T.LocalRepoPath, T.TestFileName) filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766)) err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err) require.Nil(t, err)
// reset // reset
@@ -118,7 +118,7 @@ func TestGitClient_GetLogs(t *testing.T) {
// file // file
filePath := path.Join(T.LocalRepoPath, T.TestFileName) filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766)) err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err) require.Nil(t, err)
err = T.LocalRepo.CommitAll(T.TestCommitMessage) err = T.LocalRepo.CommitAll(T.TestCommitMessage)
require.Nil(t, err) require.Nil(t, err)
@@ -136,7 +136,7 @@ func TestGitClient_InitWithHttpAuth(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -159,9 +159,9 @@ func TestGitClient_InitWithHttpAuth(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
files, err := ioutil.ReadDir(T.AuthRepoPath) files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0) require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md")) data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err) require.Nil(t, err)
// dispose // dispose
@@ -175,7 +175,7 @@ func TestGitClient_MoveBranch(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -188,6 +188,7 @@ func TestGitClient_MoveBranch(t *testing.T) {
vcs.WithUsername(cred.Username), vcs.WithUsername(cred.Username),
vcs.WithPassword(cred.Password), vcs.WithPassword(cred.Password),
) )
require.Nil(t, err)
// pull // pull
err = c.Pull(vcs.WithBranchNamePull(vcs.GitBranchNameMain)) err = c.Pull(vcs.WithBranchNamePull(vcs.GitBranchNameMain))
@@ -214,7 +215,7 @@ func TestGitClient_PullWithHttpAuth(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -245,9 +246,9 @@ func TestGitClient_PullWithHttpAuth(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
files, err := ioutil.ReadDir(T.AuthRepoPath) files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0) require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md")) data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err) require.Nil(t, err)
// dispose // dispose
@@ -261,7 +262,7 @@ func TestGitClient_CheckoutRemoteBranchWithHttpAuth(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -284,7 +285,7 @@ func TestGitClient_CheckoutRemoteBranchWithHttpAuth(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
_, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "MAIN")) _, err = os.ReadFile(path.Join(T.AuthRepoPath, "MAIN"))
require.Nil(t, err) require.Nil(t, err)
// checkout remote branch // checkout remote branch
@@ -292,7 +293,7 @@ func TestGitClient_CheckoutRemoteBranchWithHttpAuth(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
_, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "RELEASE")) _, err = os.ReadFile(path.Join(T.AuthRepoPath, "RELEASE"))
require.Nil(t, err) require.Nil(t, err)
// checkout remote branch // checkout remote branch
@@ -300,7 +301,7 @@ func TestGitClient_CheckoutRemoteBranchWithHttpAuth(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
_, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "DEVELOP")) _, err = os.ReadFile(path.Join(T.AuthRepoPath, "DEVELOP"))
require.Nil(t, err) require.Nil(t, err)
// dispose // dispose
@@ -314,7 +315,7 @@ func TestGitClient_InitWithSshAuth_PrivateKey(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -342,9 +343,9 @@ func TestGitClient_InitWithSshAuth_PrivateKey(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
files, err := ioutil.ReadDir(T.AuthRepoPath) files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0) require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md")) data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err) require.Nil(t, err)
// dispose // dispose
@@ -358,7 +359,7 @@ func TestGitClient_InitWithSshAuth_PrivateKeyPath(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -383,9 +384,9 @@ func TestGitClient_InitWithSshAuth_PrivateKeyPath(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// validate // validate
files, err := ioutil.ReadDir(T.AuthRepoPath) files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0) require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md")) data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err) require.Nil(t, err)
} }
@@ -449,7 +450,7 @@ func TestGitClient_IsRemoteChanged(t *testing.T) {
// get credentials // get credentials
var cred Credential var cred Credential
data, err := ioutil.ReadFile("credentials.json") data, err := os.ReadFile("credentials.json")
require.Nil(t, err) require.Nil(t, err)
err = json.Unmarshal(data, &cred) err = json.Unmarshal(data, &cred)
require.Nil(t, err) require.Nil(t, err)
@@ -487,7 +488,7 @@ func TestGitClient_IsRemoteChanged(t *testing.T) {
// commit and push // commit and push
testFileName := fmt.Sprintf("test-%d.txt", time.Now().Unix()) testFileName := fmt.Sprintf("test-%d.txt", time.Now().Unix())
filePath := path.Join(c1.GetPath(), testFileName) filePath := path.Join(c1.GetPath(), testFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766)) err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err) require.Nil(t, err)
err = c1.Add(testFileName) err = c1.Add(testFileName)
require.Nil(t, err) require.Nil(t, err)