test(jfrog): cover JFrog storage init error path and fix branch lint/coverage hygiene

This commit is contained in:
Pierig Le Saux
2026-04-08 22:45:50 -04:00
committed by André Roth
parent 7a2a82c60e
commit 9502f3833f
+25
View File
@@ -124,3 +124,28 @@ func (s *AptlyContextSuite) TestGetPublishedStorageJFrogMissing(c *C) {
FatalErrorPanicMatches,
&FatalError{ReturnCode: 1, Message: "published JFrog storage missing not configured"})
}
func (s *AptlyContextSuite) TestGetPublishedStorageJFrogInitError(c *C) {
prevConfig := utils.Config
defer func() { utils.Config = prevConfig }()
s.context.configLoaded = true
utils.Config.JFrogPublishRoots = map[string]utils.JFrogPublishRoot{
"broken": {
Repository: "aptly-repo",
Url: "ssh://example.local/artifactory",
},
}
defer func() {
obtained := recover()
c.Assert(obtained, NotNil)
fatalErr, ok := obtained.(*FatalError)
c.Assert(ok, Equals, true)
c.Check(fatalErr.ReturnCode, Equals, 1)
c.Check(fatalErr.Message, Matches, `error creating jfrog manager: .*`)
}()
s.context.GetPublishedStorage("jfrog:broken")
}