Added unit test for missing config functions
* Added more unit tests to increase test coverage Change-Id: I30592465cc08528145a8f309fe9b8c403824ccf1
This commit is contained in:
parent
d21c02c87b
commit
404a09356b
@ -37,6 +37,9 @@ func TestGetManagementConfigCmd(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
emptySettings := &environment.AirshipCTLSettings{
|
||||
Config: &config.Config{},
|
||||
}
|
||||
|
||||
cmdTests := []*testutil.CmdTest{
|
||||
{
|
||||
@ -60,6 +63,11 @@ func TestGetManagementConfigCmd(t *testing.T) {
|
||||
CmdLine: config.AirshipDefaultContext,
|
||||
Cmd: cmd.NewGetManagementConfigCommand(settings),
|
||||
},
|
||||
{
|
||||
Name: "get-empty-management-config",
|
||||
CmdLine: "",
|
||||
Cmd: cmd.NewGetManagementConfigCommand(emptySettings),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range cmdTests {
|
||||
|
@ -84,6 +84,11 @@ func TestConfigSetManagementConfigurationInsecure(t *testing.T) {
|
||||
CmdLine: fmt.Sprintf("%s --insecure=true", config.AirshipDefaultContext),
|
||||
Cmd: cmd.NewSetManagementConfigCommand(settings),
|
||||
})
|
||||
testutil.RunTest(t, &testutil.CmdTest{
|
||||
Name: "config-cmd-set-management-config-no-change",
|
||||
CmdLine: fmt.Sprintf("%s --insecure=true", config.AirshipDefaultContext),
|
||||
Cmd: cmd.NewSetManagementConfigCommand(settings),
|
||||
})
|
||||
|
||||
assert.True(t, settings.Config.ManagementConfiguration[config.AirshipDefaultContext].Insecure)
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
Management configuration 'default' not modified. No new settings.
|
@ -0,0 +1 @@
|
||||
No management configurations defined.
|
@ -75,9 +75,9 @@ func TestInitConfig(t *testing.T) {
|
||||
defer os.Unsetenv(config.AirshipKubeConfigEnv)
|
||||
defer os.Unsetenv(config.AirshipPluginPathEnv)
|
||||
|
||||
testSettings.InitAirshipConfigPath()
|
||||
testSettings.InitKubeConfigPath()
|
||||
environment.InitPluginPath()
|
||||
testSettings.Create = true
|
||||
testSettings.InitConfig()
|
||||
|
||||
assert.Equal(t, expectedAirshipConfig, testSettings.AirshipConfigPath)
|
||||
assert.Equal(t, expectedKubeConfig, testSettings.KubeConfigPath)
|
||||
assert.Equal(t, expectedPluginPath, environment.PluginPath())
|
||||
|
Loading…
Reference in New Issue
Block a user