Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions artifactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,32 @@ func TestArtifactorySelfSignedCert(t *testing.T) {
assert.NoError(t, err)
readerCloseAndAssert(t, reader)

// Remove the certificates from CLI security dir before testing custom cert dir location
defer clientTestUtils.RemoveAndAssert(t, filepath.Join(certsPath, certificate.KeyFile))
defer clientTestUtils.RemoveAndAssert(t, filepath.Join(certsPath, certificate.CertFile))

// Create a new temp dir for certificates and set the CertsDir env variable
tempCertsDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
setEnvCallBack = clientTestUtils.SetEnvWithCallbackAndAssert(t, coreutils.CertsDir, tempCertsDirPath)
defer setEnvCallBack()

// Check the certificate dir have moved to the new temp dir location
certsPath, err = coreutils.GetJfrogCertsDir()
assert.NoError(t, err)
assert.Equal(t, tempCertsDirPath, certsPath)

// Copy the server certificates to the custom CLI certificate dir and run again. We expect the command to succeed.
err = biutils.CopyFile(certsPath, certificate.KeyFile)
assert.NoError(t, err)
err = biutils.CopyFile(certsPath, certificate.CertFile)
assert.NoError(t, err)
searchCmd = generic.NewSearchCommand()
searchCmd.SetServerDetails(serverDetails).SetSpec(fileSpec)
reader, err = searchCmd.Search()
assert.NoError(t, err)
readerCloseAndAssert(t, reader)

serverDetails.ArtifactoryUrl = artAuth.GetUrl()
cleanArtifactoryTest()
}
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KO
github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU=
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/andreasvikke/jfrog-cli-core/v2 v2.0.100-0.20260910085001-3ce79a0cc908 h1:Six9gtdxoQxNgf81Opr9FEcYV5OPT7LtbjNXWVXS1CE=
github.com/andreasvikke/jfrog-cli-core/v2 v2.0.100-0.20260910085001-3ce79a0cc908/go.mod h1:SwV+DNLBnWLxBeNeZpJk+xxAbqJ8ywq1va56up+AGu4=
github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM=
github.com/andybalholm/brotli v1.2.2/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
Expand Down
Loading