Skip to content

Commit

Permalink
Transfer - Use tmp dir under user home
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Dec 29, 2023
1 parent 0bc72ce commit 8c699b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ 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/yahavi/jfrog-cli-core/v2 v2.0.0-20231229155141-f007e892f9f3

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231220105505-e62769dde9da

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ 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.47.9 h1:3MoGn5M5hOzFZx42B3liuVm2GDmhdLeGfc3DQGsz5ZE=
github.com/jfrog/jfrog-cli-core/v2 v2.47.9/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=
Expand Down Expand Up @@ -301,6 +299,8 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofm
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/yahavi/jfrog-cli-core/v2 v2.0.0-20231229155141-f007e892f9f3 h1:/uAzO+F+tirDnTUNEUDhTNbT0eIlRms5B4R8woa6fnQ=
github.com/yahavi/jfrog-cli-core/v2 v2.0.0-20231229155141-f007e892f9f3/go.mod h1:l5y34dJhQ0W16o7OrCUjTQdGikoZPKTRI1NKGneoJ0g=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
Expand Down
13 changes: 7 additions & 6 deletions transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8c699b8

Please sign in to comment.