diff --git a/context/context_test.go b/context/context_test.go index 678ef103..89e8a96d 100644 --- a/context/context_test.go +++ b/context/context_test.go @@ -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") +}