diff --git a/diff_test.go b/diff_test.go index a4bb10fe..e62b8b61 100644 --- a/diff_test.go +++ b/diff_test.go @@ -23,6 +23,7 @@ import ( "path/filepath" "strconv" + "github.com/minio/mc/pkg/console" . "gopkg.in/check.v1" ) @@ -85,3 +86,19 @@ func (s *CmdTestSuite) TestDiffDirs(c *C) { c.Assert(len(diff.message), Equals, 0) } } + +func (s *CmdTestSuite) TestDiffContext(c *C) { + err := app.Run([]string{os.Args[0], "diff", server.URL + "/bucket", server.URL + "/bucket"}) + c.Assert(err, IsNil) + c.Assert(console.IsExited, Equals, false) + + err = app.Run([]string{os.Args[0], "diff", server.URL + "/bucket...", server.URL + "/bucket"}) + c.Assert(err, IsNil) + c.Assert(console.IsExited, Equals, false) + + err = app.Run([]string{os.Args[0], "diff", server.URL + "/invalid", server.URL + "/invalid..."}) + c.Assert(err, IsNil) + c.Assert(console.IsExited, Equals, true) + // reset back + console.IsExited = false +} diff --git a/hostconfig.go b/hostconfig.go index 6a3ef03e..4620c6a1 100644 --- a/hostconfig.go +++ b/hostconfig.go @@ -20,7 +20,6 @@ import ( "path/filepath" "github.com/minio/mc/pkg/client" - "github.com/minio/mc/pkg/console" "github.com/minio/minio/pkg/iodine" ) @@ -62,12 +61,3 @@ func getHostConfig(URL string) (*hostConfig, error) { } return nil, NewIodine(iodine.New(errNoMatchingHost{}, nil)) } - -// mustGetHostConfig retrieves host specific configuration such as access keys, exits upon error -func mustGetHostConfig(URL string) *hostConfig { - hostCfg, err := getHostConfig(URL) - if err != nil { - console.Fatalf("Unable to retrieve host configuration. %s\n", NewIodine(iodine.New(err, nil))) - } - return hostCfg -}