mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Merge pull request #119346 from chendave/clean_testcases
kubeadm: Remove the usage to print the default component configs for `reset` and `join`
This commit is contained in:
commit
3cf3702d1e
@ -133,8 +133,10 @@ func newCmdConfigPrintActionDefaults(out io.Writer, action string, configBytesPr
|
||||
},
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
cmd.Flags().StringSliceVar(&kinds, "component-configs", kinds,
|
||||
fmt.Sprintf("A comma-separated list for component config API objects to print the default values for. Available values: %v. If this flag is not set, no component configs will be printed.", getSupportedComponentConfigKinds()))
|
||||
if action == "init" {
|
||||
cmd.Flags().StringSliceVar(&kinds, "component-configs", kinds,
|
||||
fmt.Sprintf("A comma-separated list for component config API objects to print the default values for. Available values: %v. If this flag is not set, no component configs will be printed.", getSupportedComponentConfigKinds()))
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -426,56 +426,16 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
|
||||
cmdProc: newCmdConfigPrintInitDefaults,
|
||||
},
|
||||
{
|
||||
name: "JoinConfiguration: No component configs",
|
||||
name: "JoinConfiguration",
|
||||
expectedKinds: []string{
|
||||
constants.JoinConfigurationKind,
|
||||
},
|
||||
cmdProc: newCmdConfigPrintJoinDefaults,
|
||||
},
|
||||
{
|
||||
name: "JoinConfiguration: KubeProxyConfiguration",
|
||||
expectedKinds: []string{
|
||||
constants.JoinConfigurationKind,
|
||||
"KubeProxyConfiguration",
|
||||
},
|
||||
componentConfigs: "KubeProxyConfiguration",
|
||||
cmdProc: newCmdConfigPrintJoinDefaults,
|
||||
},
|
||||
{
|
||||
name: "JoinConfiguration: KubeProxyConfiguration and KubeletConfiguration",
|
||||
expectedKinds: []string{
|
||||
constants.JoinConfigurationKind,
|
||||
"KubeProxyConfiguration",
|
||||
"KubeletConfiguration",
|
||||
},
|
||||
componentConfigs: "KubeProxyConfiguration,KubeletConfiguration",
|
||||
cmdProc: newCmdConfigPrintJoinDefaults,
|
||||
},
|
||||
{
|
||||
name: "ResetConfiguration: No component configs",
|
||||
expectedKinds: []string{
|
||||
constants.ResetConfigurationKind,
|
||||
},
|
||||
cmdProc: newCmdConfigPrintResetDefaults,
|
||||
},
|
||||
{
|
||||
name: "JoinConfiguration: KubeProxyConfiguration",
|
||||
expectedKinds: []string{
|
||||
"KubeProxyConfiguration",
|
||||
constants.ResetConfigurationKind,
|
||||
},
|
||||
componentConfigs: "KubeProxyConfiguration",
|
||||
cmdProc: newCmdConfigPrintResetDefaults,
|
||||
},
|
||||
{
|
||||
name: "JoinConfiguration: KubeProxyConfiguration and KubeletConfiguration",
|
||||
expectedKinds: []string{
|
||||
"KubeProxyConfiguration",
|
||||
"KubeletConfiguration",
|
||||
constants.ResetConfigurationKind,
|
||||
},
|
||||
componentConfigs: "KubeProxyConfiguration,KubeletConfiguration",
|
||||
cmdProc: newCmdConfigPrintResetDefaults,
|
||||
name: "ResetConfiguration",
|
||||
expectedKinds: []string{constants.ResetConfigurationKind},
|
||||
cmdProc: newCmdConfigPrintResetDefaults,
|
||||
},
|
||||
}
|
||||
|
||||
@ -484,8 +444,10 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
|
||||
var output bytes.Buffer
|
||||
|
||||
command := test.cmdProc(&output)
|
||||
if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil {
|
||||
t.Fatalf("failed to set component-configs flag")
|
||||
if test.componentConfigs != "" {
|
||||
if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil {
|
||||
t.Fatalf("failed to set component-configs flag")
|
||||
}
|
||||
}
|
||||
if err := command.RunE(nil, nil); err != nil {
|
||||
t.Fatalf("Error from running the print command: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user