Merge "Added unit test for missing config functions"
This commit is contained in:
commit
a85165e99b
@ -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