From 86342fe81fccafcb1287f0150da7d744b09fb420 Mon Sep 17 00:00:00 2001 From: Yahav Itzhak Date: Thu, 4 Jan 2024 12:14:14 +0200 Subject: [PATCH] Transfer - Use tmp dir under user home (#2394) --- go.mod | 4 ++-- go.sum | 4 ++-- transfer_test.go | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index c195963c1..6d6e02fcc 100644 --- a/go.mod +++ b/go.mod @@ -130,9 +130,9 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231224075754-92c93a2d086e +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240104095135-8e243b03531d -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240103100500-8e451d1cd6d5 +// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231220105505-e62769dde9da // replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231220102935-c8776c613ad8 diff --git a/go.sum b/go.sum index 83555e7b3..315f201c1 100644 --- a/go.sum +++ b/go.sum @@ -136,8 +136,8 @@ github.com/jfrog/gofrog v1.4.0 h1:s7eysVnmIBfVheMs4LPU43MAlxwPa4K8u2N5h7kwzXA= github.com/jfrog/gofrog v1.4.0/go.mod h1:AQo5Fq0G9nDEF6icH7MYQK0iohR4HuEAXl8jaxRuT6Q= github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY= github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240103100500-8e451d1cd6d5 h1:/9SiDpqQ3zVsnzmxiQmYKNLyNdn6+y+EWK+lABEce9o= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240103100500-8e451d1cd6d5/go.mod h1:l5y34dJhQ0W16o7OrCUjTQdGikoZPKTRI1NKGneoJ0g= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240104095135-8e243b03531d h1:sdJ18v0Fk01Wsd3ej0etMBfAIgweZA8YoYj64pZXp/c= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240104095135-8e243b03531d/go.mod h1:l5y34dJhQ0W16o7OrCUjTQdGikoZPKTRI1NKGneoJ0g= github.com/jfrog/jfrog-client-go v1.35.5 h1:1QlrXdMhGi099Cs3mVKIpeVre2w1DiYhU7WGSEH2gQU= github.com/jfrog/jfrog-client-go v1.35.5/go.mod h1:Leua+MdhCV+M4gl746PcTsHF8dDP7+LLJ/NgHCTl/Fo= github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk= diff --git a/transfer_test.go b/transfer_test.go index 90bed37eb..943476aa5 100644 --- a/transfer_test.go +++ b/transfer_test.go @@ -298,17 +298,18 @@ func TestUnsupportedRunStatusVersion(t *testing.T) { defer cleanUp() // Create run status file with lower version. - transferDir, err := coreutils.GetJfrogTransferDir() - assert.NoError(t, err) + transferDir, actualError := coreutils.GetJfrogTransferDir() + assert.NoError(t, actualError) assert.NoError(t, os.MkdirAll(transferDir, 0777)) statusFilePath := filepath.Join(transferDir, coreutils.JfrogTransferRunStatusFileName) trs := state.TransferRunStatus{Version: 0} - content, err := json.Marshal(trs) - assert.NoError(t, err) + content, actualError := json.Marshal(trs) + assert.NoError(t, actualError) assert.NoError(t, os.WriteFile(statusFilePath, content, 0600)) - err = artifactoryCli.WithoutCredentials().Exec("transfer-files", inttestutils.SourceServerId, inttestutils.TargetServerId, "--include-repos="+tests.RtRepo1+";"+tests.RtRepo2) - assert.Equal(t, err, state.GetOldTransferDirectoryStructureError()) + expectedError := state.GetOldTransferDirectoryStructureError() + actualError = artifactoryCli.WithoutCredentials().Exec("transfer-files", inttestutils.SourceServerId, inttestutils.TargetServerId, "--include-repos="+tests.RtRepo1+";"+tests.RtRepo2) + assert.ErrorAs(t, expectedError, &actualError) } func TestTransferWithRepoSnapshot(t *testing.T) {