From 77cbd57507fe4db514f57f8c0a5b9cbc45377164 Mon Sep 17 00:00:00 2001 From: Holly Hunt Date: Fri, 17 Nov 2023 16:41:22 +0000 Subject: [PATCH 1/3] added command tests Signed-off-by: Holly Hunt --- pkg/cmd/projectCreate_test.go | 2 +- pkg/cmd/propertiesDelete_test.go | 107 +++++++++++++++++++++++++++++++ pkg/cmd/properties_test.go | 32 +++++++++ pkg/cmd/runsSubmitLocal_test.go | 53 +++++++++++++++ pkg/cmd/runsSubmit_tests.go | 39 +++++++++++ 5 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 pkg/cmd/propertiesDelete_test.go create mode 100644 pkg/cmd/properties_test.go create mode 100644 pkg/cmd/runsSubmitLocal_test.go create mode 100644 pkg/cmd/runsSubmit_tests.go diff --git a/pkg/cmd/projectCreate_test.go b/pkg/cmd/projectCreate_test.go index f78bb0e2..e158fe8c 100644 --- a/pkg/cmd/projectCreate_test.go +++ b/pkg/cmd/projectCreate_test.go @@ -620,7 +620,7 @@ func TestCreateProjectUsingCommandLineNoFeaturesSetWorks(t *testing.T) { // Check that the default folder was created. fs := factory.GetFileSystem() var isExists bool - isExists, err = fs.DirExists("my.pkg") + isExists, _ = fs.DirExists("my.pkg") assert.True(t, isExists) } diff --git a/pkg/cmd/propertiesDelete_test.go b/pkg/cmd/propertiesDelete_test.go new file mode 100644 index 00000000..473fb4a3 --- /dev/null +++ b/pkg/cmd/propertiesDelete_test.go @@ -0,0 +1,107 @@ +/* + * Copyright contributors to the Galasa project + * + * SPDX-License-Identifier: EPL-2.0 + */ +package cmd + +import ( + "testing" + "github.com/galasa-dev/cli/pkg/utils" + "github.com/stretchr/testify/assert" +) + +func TestPropertiesDeleteNoArgsReturnsError(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"properties", "delete"} + + // When... + err := Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + + stdErrConsole := factory.GetStdErrConsole().(*utils.MockConsole) + errText := stdErrConsole.ReadText() + assert.Contains(t, errText, "Error: required flag(s) \"name\", \"namespace\" not set") + + // We expect an exit code of 1 for this command. But it seems that syntax errors caught by cobra still return no error. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) + + assert.NotNil(t, err) +} + +func TestPropertiesDeleteWithoutName(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"properties", "delete", "--namespace", "jitters"} + + // When... + err := Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + + stdErrConsole := factory.GetStdErrConsole().(*utils.MockConsole) + errText := stdErrConsole.ReadText() + assert.Contains(t, errText, "Error: required flag(s) \"name\" not set") + + // We expect an exit code of 1 for this command. But it seems that syntax errors caught by cobra still return no error. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) + + assert.NotNil(t, err) +} + +func TestPropertiesDeleteWithoutNamespace(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"properties", "delete", "--name", "jeepers"} + + // When... + err := Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + + stdErrConsole := factory.GetStdErrConsole().(*utils.MockConsole) + errText := stdErrConsole.ReadText() + assert.Contains(t, errText, "Error: required flag(s) \"namespace\" not set") + + // We expect an exit code of 1 for this command. But it seems that syntax errors caught by cobra still return no error. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) + + assert.NotNil(t, err) +} + +func TestPropertiesDeleteWithNameAndNamespace(t *testing.T) { + // Given... + factory := NewMockFactory() + fs := factory.GetFileSystem() + var args []string = []string{"properties", "delete", "--namespace", "gyro", "--name", "space.ball"} + homeDir, _ := fs.GetUserHomeDirPath() + galasaDir := homeDir + "/.galasa/" + fs.WriteTextFile(galasaDir+"bootstrap.properties", "") + + // When... + err := Execute(factory, args) + + // Then... + assert.Nil(t, err) + + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Equal(t, outText, "") +} \ No newline at end of file diff --git a/pkg/cmd/properties_test.go b/pkg/cmd/properties_test.go new file mode 100644 index 00000000..b81deec0 --- /dev/null +++ b/pkg/cmd/properties_test.go @@ -0,0 +1,32 @@ +/* + * Copyright contributors to the Galasa project + * + * SPDX-License-Identifier: EPL-2.0 + */ +package cmd + +import ( + "testing" + + "github.com/galasa-dev/cli/pkg/utils" + "github.com/stretchr/testify/assert" +) + +func TestPropertiesNoCommandsProducesUsageReport(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"properties"} + + // When... + Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + + // We expect an exit code of 0 for this command. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) +} \ No newline at end of file diff --git a/pkg/cmd/runsSubmitLocal_test.go b/pkg/cmd/runsSubmitLocal_test.go new file mode 100644 index 00000000..b789df07 --- /dev/null +++ b/pkg/cmd/runsSubmitLocal_test.go @@ -0,0 +1,53 @@ +/* + * Copyright contributors to the Galasa project + * + * SPDX-License-Identifier: EPL-2.0 +*/ +package cmd + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestRunsSubmitLocalWithoutObrWithClassErrors(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"runs", "submit", "local", "--class", "osgi.bundle/class.path"} + + // When... + err := Execute(factory, args) + + // Then... + // Should throw an error asking for flags to be set + assert.NotNil(t, err, "err should have been set!") + assert.Contains(t, err.Error(), "required flag(s) \"obr\" not set") +} + +func TestRunsSubmitLocalWithoutClassWithObrErrors(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"runs", "submit", "local", "--obr", "mvn:second.breakfast/elevenses/0.1.0/brunch"} + + // When... + err := Execute(factory, args) + + // Then... + // Should throw an error asking for flags to be set + assert.NotNil(t, err, "err should have been set!") + assert.Contains(t, err.Error(), "required flag(s) \"class\" not set") +} + +func TestMultipleRequiredFlagsNotSetReturnsListInError(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"runs", "submit", "local"} + + // When... + err := Execute(factory, args) + + // Then... + // Should throw an error asking for flags to be set + assert.NotNil(t, err, "err should have been set!") + assert.Contains(t, err.Error(), "required flag(s) \"class\", \"obr\" not set") +} \ No newline at end of file diff --git a/pkg/cmd/runsSubmit_tests.go b/pkg/cmd/runsSubmit_tests.go new file mode 100644 index 00000000..c798f702 --- /dev/null +++ b/pkg/cmd/runsSubmit_tests.go @@ -0,0 +1,39 @@ +/* + * Copyright contributors to the Galasa project + * + * SPDX-License-Identifier: EPL-2.0 +*/ +package cmd + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestRunsSubmitWithoutFlagsErrors(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"runs", "submit", "local"} + + // When... + err := Execute(factory, args) + + // Then... + // Should throw an error asking for flags to be set + assert.NotNil(t, err, "err should have been set!") + assert.Contains(t, err.Error(), "GAL1009E: The submit command requires either test selection flags (eg: --stream, --class, --bundle, --package, --tag, --regex, --test) or --portfolio flag to be specified. Use the --help flag for more details.") +} + +func TestRunsSubmitExecutesWithPortfolio(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"runs", "submit", "local", "--class", "osgi.bundle/class.path"} + + // When... + err := Execute(factory, args) + + // Then... + // Should throw an error asking for flags to be set + assert.NotNil(t, err, "err should have been set!") + assert.Contains(t, err.Error(), "required flag(s) \"obr\" not set") +} \ No newline at end of file From 6391cf6ff93ba461694982acccd67eb0b654d836 Mon Sep 17 00:00:00 2001 From: Holly Hunt Date: Wed, 29 Nov 2023 13:33:22 +0000 Subject: [PATCH 2/3] changes to root cmd to support mapping of entire cmd structure Signed-off-by: Holly Hunt --- pkg/cmd/local_test.go | 28 +++++++++++ pkg/cmd/project_test.go | 28 +++++++++++ pkg/cmd/propertiesDelete_test.go | 1 + pkg/cmd/propertiesGet_test.go | 86 ++++++++++++++++++++++++++++++++ pkg/cmd/properties_test.go | 1 + pkg/cmd/root.go | 45 ++++++++++++++--- 6 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 pkg/cmd/local_test.go create mode 100644 pkg/cmd/project_test.go create mode 100644 pkg/cmd/propertiesGet_test.go diff --git a/pkg/cmd/local_test.go b/pkg/cmd/local_test.go new file mode 100644 index 00000000..5bf54c47 --- /dev/null +++ b/pkg/cmd/local_test.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "testing" + + "github.com/galasa-dev/cli/pkg/utils" + "github.com/stretchr/testify/assert" +) + +func TestLocalNoCommandsProducesUsageReport(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"local"} + + // When... + Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + assert.Contains(t, outText, "galasactl local [command]") + + // We expect an exit code of 0 for this command. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) +} \ No newline at end of file diff --git a/pkg/cmd/project_test.go b/pkg/cmd/project_test.go new file mode 100644 index 00000000..8269028b --- /dev/null +++ b/pkg/cmd/project_test.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "testing" + + "github.com/galasa-dev/cli/pkg/utils" + "github.com/stretchr/testify/assert" +) + +func TestProjectNoCommandsProducesUsageReport(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"project"} + + // When... + Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + assert.Contains(t, outText, "galasactl project [command]") + + // We expect an exit code of 0 for this command. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) +} \ No newline at end of file diff --git a/pkg/cmd/propertiesDelete_test.go b/pkg/cmd/propertiesDelete_test.go index 473fb4a3..c9b9eb10 100644 --- a/pkg/cmd/propertiesDelete_test.go +++ b/pkg/cmd/propertiesDelete_test.go @@ -23,6 +23,7 @@ func TestPropertiesDeleteNoArgsReturnsError(t *testing.T) { stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) outText := stdOutConsole.ReadText() assert.Contains(t, outText, "Usage:") + assert.Contains(t, outText, "galasactl properties delete [flags]") stdErrConsole := factory.GetStdErrConsole().(*utils.MockConsole) errText := stdErrConsole.ReadText() diff --git a/pkg/cmd/propertiesGet_test.go b/pkg/cmd/propertiesGet_test.go new file mode 100644 index 00000000..3bb8b39e --- /dev/null +++ b/pkg/cmd/propertiesGet_test.go @@ -0,0 +1,86 @@ +/* + * Copyright contributors to the Galasa project + * + * SPDX-License-Identifier: EPL-2.0 + */ +package cmd + +import ( + "testing" + + "github.com/galasa-dev/cli/pkg/utils" + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" +) + +func propertiesExectuteTestReplacement(cmd *cobra.Command, args []string) error { + return nil +} + +func TestPropertiesGetNoArgsReturnsError(t *testing.T) { + // Given... + factory := NewMockFactory() + var args []string = []string{"properties", "get"} + + // When... + err := Execute(factory, args) + + // Then... + stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) + outText := stdOutConsole.ReadText() + assert.Contains(t, outText, "Usage:") + assert.Contains(t, outText, "galasactl properties get [flags]") + + stdErrConsole := factory.GetStdErrConsole().(*utils.MockConsole) + errText := stdErrConsole.ReadText() + assert.Contains(t, errText, "Error: required flag(s) \"namespace\" not set") + + // We expect an exit code of 1 for this command. But it seems that syntax errors caught by cobra still return no error. + finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) + o := finalWordHandler.ReportedObject + assert.Nil(t, o) + + assert.NotNil(t, err) +} + +func TestPropertiesGetWithNamespaceReturnsTable(t *testing.T) { + // Given... + factory := NewMockFactory() + fs := factory.GetFileSystem() + homeDir, _ := fs.GetUserHomeDirPath() + galasaDir := homeDir + "/.galasa/" + fs.WriteTextFile(galasaDir+"bootstrap.properties", "") + var args []string = []string{"properties", "get", "--namespace", "framework", "--log", "-"} + + var err error + + var commands map[string]*cobra.Command + var parsedCommandValues map[string]interface{} + + commands, parsedCommandValues, err = CreateCommandTree(factory) + rootCmd := commands["root"] + propsGetCmd := commands["properties get"] + + // TODO: Over-ride the RunE function... + propsGetCmd.RunE = propertiesExectuteTestReplacement + + rootCmd.SetArgs(args) + + // When... + // err := Execute(factory, args) + err = rootCmd.Execute() + + // Then... + assert.Nil(t, err) + + propsGetData := parsedCommandValues["properties get"].(PropertiesGetCmdValues) + assert.Nil(t, propsGetData.propertiesInfix) + assert.Nil(t, propsGetData.propertiesPrefix) + assert.Nil(t, propsGetData.propertiesSuffix) + + propsData := parsedCommandValues["properties"].(PropertiesCmdValues) + assert.Equal(t, "framework", propsData.namespace) + + rootData := parsedCommandValues["root"].(RootCmdValues) + assert.Equal(t, "-", rootData.logFileName) +} diff --git a/pkg/cmd/properties_test.go b/pkg/cmd/properties_test.go index b81deec0..eee96c4d 100644 --- a/pkg/cmd/properties_test.go +++ b/pkg/cmd/properties_test.go @@ -24,6 +24,7 @@ func TestPropertiesNoCommandsProducesUsageReport(t *testing.T) { stdOutConsole := factory.GetStdOutConsole().(*utils.MockConsole) outText := stdOutConsole.ReadText() assert.Contains(t, outText, "Usage:") + assert.Contains(t, outText, "galasactl properties [command]") // We expect an exit code of 0 for this command. finalWordHandler := factory.GetFinalWordHandler().(*MockFinalWordHandler) diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index 1e0efa2d..b4d700a5 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -25,14 +25,51 @@ type RootCmdValues struct { CmdParamGalasaHomePath string } -var rootCmdValues *RootCmdValues +type GalasaCommand interface { + GetCobraCommand() *cobra.Command + GetCommandName() string + GetParsedData() interface{} +} + +type GalasaRootCommand struct { + cobraCommand *cobra.Command + parsedValues *RootCmdValues +} func CreateRootCmd(factory Factory) (*cobra.Command, error) { + commands, _, err := CreateCommandTree(factory) + return commands["root"], err +} + +func CreateCommandTree(factory Factory) (map[string]GalasaCommand, error) { + + var galasaCommands map[string]GalasaCommand + + rootGalasaCmd, err := NewRootGalasaCommand(factory) + + if err != nil { + err = createRootCmdChildren(factory, rootCmd, rootCmdValues) + + if err == nil { + sanitiseCommandHelpDescriptions(rootCmd) + } + } + + commands[rootGalasaCmd.GetCommandName()] = rootGalasaCmd + + return commands, err +} + +func NewRootGalasaCommand(factory Factory) { // Flags parsed by this command put values into this instance of the structure. rootCmdValues = &RootCmdValues{ isCapturingLogs: false, } + rootCmd, err := CreateRootCobraCommand(factory, rootCmdValues) +} + +func CreateRootCobraCommand(factory Factory, rootCmdValues *RootCmdValues) (*cobra.Command, error) { version, err := embedded.GetGalasaCtlVersion() var rootCmd *cobra.Command if err == nil { @@ -66,12 +103,6 @@ func CreateRootCmd(factory Factory) (*cobra.Command, error) { "The default is '${HOME}/.galasa'. "+ "This overrides the GALASA_HOME environment variable which may be set instead.", ) - - err = createRootCmdChildren(factory, rootCmd, rootCmdValues) - - if err == nil { - sanitiseCommandHelpDescriptions(rootCmd) - } } } return rootCmd, err From f6e9064bdf32746022739688dee3daf3183c3aa0 Mon Sep 17 00:00:00 2001 From: Holly Hunt Date: Wed, 29 Nov 2023 15:07:02 +0000 Subject: [PATCH 3/3] rolled changes in root back Signed-off-by: Holly Hunt --- pkg/cmd/propertiesGet_test.go | 62 +++++++++++++++++------------------ pkg/cmd/root.go | 45 ++++--------------------- 2 files changed, 38 insertions(+), 69 deletions(-) diff --git a/pkg/cmd/propertiesGet_test.go b/pkg/cmd/propertiesGet_test.go index 3bb8b39e..438467cf 100644 --- a/pkg/cmd/propertiesGet_test.go +++ b/pkg/cmd/propertiesGet_test.go @@ -43,44 +43,44 @@ func TestPropertiesGetNoArgsReturnsError(t *testing.T) { assert.NotNil(t, err) } -func TestPropertiesGetWithNamespaceReturnsTable(t *testing.T) { - // Given... - factory := NewMockFactory() - fs := factory.GetFileSystem() - homeDir, _ := fs.GetUserHomeDirPath() - galasaDir := homeDir + "/.galasa/" - fs.WriteTextFile(galasaDir+"bootstrap.properties", "") - var args []string = []string{"properties", "get", "--namespace", "framework", "--log", "-"} +// func TestPropertiesGetWithNamespaceReturnsTable(t *testing.T) { +// // Given... +// factory := NewMockFactory() +// fs := factory.GetFileSystem() +// homeDir, _ := fs.GetUserHomeDirPath() +// galasaDir := homeDir + "/.galasa/" +// fs.WriteTextFile(galasaDir+"bootstrap.properties", "") +// var args []string = []string{"properties", "get", "--namespace", "framework", "--log", "-"} - var err error +// var err error - var commands map[string]*cobra.Command - var parsedCommandValues map[string]interface{} +// var commands map[string]*cobra.Command +// var parsedCommandValues map[string]interface{} - commands, parsedCommandValues, err = CreateCommandTree(factory) - rootCmd := commands["root"] - propsGetCmd := commands["properties get"] +// commands, parsedCommandValues, err = CreateCommandTree(factory) +// rootCmd := commands["root"] +// propsGetCmd := commands["properties get"] - // TODO: Over-ride the RunE function... - propsGetCmd.RunE = propertiesExectuteTestReplacement +// // TODO: Over-ride the RunE function... +// propsGetCmd.RunE = propertiesExectuteTestReplacement - rootCmd.SetArgs(args) +// rootCmd.SetArgs(args) - // When... - // err := Execute(factory, args) - err = rootCmd.Execute() +// // When... +// // err := Execute(factory, args) +// err = rootCmd.Execute() - // Then... - assert.Nil(t, err) +// // Then... +// assert.Nil(t, err) - propsGetData := parsedCommandValues["properties get"].(PropertiesGetCmdValues) - assert.Nil(t, propsGetData.propertiesInfix) - assert.Nil(t, propsGetData.propertiesPrefix) - assert.Nil(t, propsGetData.propertiesSuffix) +// propsGetData := parsedCommandValues["properties get"].(PropertiesGetCmdValues) +// assert.Nil(t, propsGetData.propertiesInfix) +// assert.Nil(t, propsGetData.propertiesPrefix) +// assert.Nil(t, propsGetData.propertiesSuffix) - propsData := parsedCommandValues["properties"].(PropertiesCmdValues) - assert.Equal(t, "framework", propsData.namespace) +// propsData := parsedCommandValues["properties"].(PropertiesCmdValues) +// assert.Equal(t, "framework", propsData.namespace) - rootData := parsedCommandValues["root"].(RootCmdValues) - assert.Equal(t, "-", rootData.logFileName) -} +// rootData := parsedCommandValues["root"].(RootCmdValues) +// assert.Equal(t, "-", rootData.logFileName) +// } diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index b4d700a5..1e0efa2d 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -25,51 +25,14 @@ type RootCmdValues struct { CmdParamGalasaHomePath string } -type GalasaCommand interface { - GetCobraCommand() *cobra.Command - GetCommandName() string - GetParsedData() interface{} -} - -type GalasaRootCommand struct { - cobraCommand *cobra.Command - parsedValues *RootCmdValues -} +var rootCmdValues *RootCmdValues func CreateRootCmd(factory Factory) (*cobra.Command, error) { - commands, _, err := CreateCommandTree(factory) - return commands["root"], err -} - -func CreateCommandTree(factory Factory) (map[string]GalasaCommand, error) { - - var galasaCommands map[string]GalasaCommand - - rootGalasaCmd, err := NewRootGalasaCommand(factory) - - if err != nil { - err = createRootCmdChildren(factory, rootCmd, rootCmdValues) - - if err == nil { - sanitiseCommandHelpDescriptions(rootCmd) - } - } - - commands[rootGalasaCmd.GetCommandName()] = rootGalasaCmd - - return commands, err -} - -func NewRootGalasaCommand(factory Factory) { // Flags parsed by this command put values into this instance of the structure. rootCmdValues = &RootCmdValues{ isCapturingLogs: false, } - rootCmd, err := CreateRootCobraCommand(factory, rootCmdValues) -} - -func CreateRootCobraCommand(factory Factory, rootCmdValues *RootCmdValues) (*cobra.Command, error) { version, err := embedded.GetGalasaCtlVersion() var rootCmd *cobra.Command if err == nil { @@ -103,6 +66,12 @@ func CreateRootCobraCommand(factory Factory, rootCmdValues *RootCmdValues) (*cob "The default is '${HOME}/.galasa'. "+ "This overrides the GALASA_HOME environment variable which may be set instead.", ) + + err = createRootCmdChildren(factory, rootCmd, rootCmdValues) + + if err == nil { + sanitiseCommandHelpDescriptions(rootCmd) + } } } return rootCmd, err