Permalink
Browse files

Fixes for help handler

* Fix `skeema help`, `skeema --help`, etc which were broken by refactor in #44

* Fix `skeema add-environment --help`, which was always broken due to having a
  required positional arg (although other forms like `skeema help
  add-environment` worked previously)

* Add tests to help handlers to ensure no error is returned
  • Loading branch information...
evanelias committed Oct 30, 2018
1 parent 05d2622 commit 1d7a994a6095a89bef7b10d8f7f30cb1a2fc4838

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -15,7 +15,7 @@ schema to the filesystem, and apply online schema changes by modifying files.`
// Globals overridden by GoReleaser's ldflags
var (
version = "1.0.5-dev"
version = "1.0.6-dev"
commit = "unknown"
date = "unknown"
)
@@ -398,6 +398,19 @@ func (s SkeemaIntegrationSuite) TestPushHandler(t *testing.T) {
s.assertExists(t, "bonus", "table2", "")
}
func (s SkeemaIntegrationSuite) TestHelpHandler(t *testing.T) {
// Simple tests just to confirm the commands don't error
fs.WriteTestFile(t, "fake-etc/skeema", "# hello world")
s.handleCommand(t, CodeSuccess, ".", "skeema")
s.handleCommand(t, CodeSuccess, ".", "skeema help")
s.handleCommand(t, CodeSuccess, ".", "skeema --help")
s.handleCommand(t, CodeSuccess, ".", "skeema --help=add-environment")
s.handleCommand(t, CodeSuccess, ".", "skeema help add-environment")
s.handleCommand(t, CodeSuccess, ".", "skeema add-environment --help")
s.handleCommand(t, CodeFatalError, ".", "skeema help doesntexist")
s.handleCommand(t, CodeFatalError, ".", "skeema --help=doesntexist")
}
func (s SkeemaIntegrationSuite) TestIndexOrdering(t *testing.T) {
s.handleCommand(t, CodeSuccess, ".", "skeema init --dir mydb -h %s -P %d", s.d.Instance.Host, s.d.Instance.Port)
@@ -75,7 +75,7 @@ func AddGlobalConfigFiles(cfg *mybase.Config) {
}
if strings.HasSuffix(path, ".my.cnf") {
_ = f.UseSection("skeema", "client", "mysql") // safe to ignore error (doesn't matter if section doesn't exist)
} else {
} else if cfg.CLI.Command.HasArg("environment") { // avoid panic on command without environment arg, such as help command!
_ = f.UseSection(cfg.Get("environment")) // safe to ignore error (doesn't matter if section doesn't exist)
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 1d7a994

Please sign in to comment.