mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 21:36:24 +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,
|
Args: cobra.NoArgs,
|
||||||
}
|
}
|
||||||
|
if action == "init" {
|
||||||
cmd.Flags().StringSliceVar(&kinds, "component-configs", kinds,
|
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()))
|
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
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,55 +426,15 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
|
|||||||
cmdProc: newCmdConfigPrintInitDefaults,
|
cmdProc: newCmdConfigPrintInitDefaults,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "JoinConfiguration: No component configs",
|
name: "JoinConfiguration",
|
||||||
expectedKinds: []string{
|
expectedKinds: []string{
|
||||||
constants.JoinConfigurationKind,
|
constants.JoinConfigurationKind,
|
||||||
},
|
},
|
||||||
cmdProc: newCmdConfigPrintJoinDefaults,
|
cmdProc: newCmdConfigPrintJoinDefaults,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "JoinConfiguration: KubeProxyConfiguration",
|
name: "ResetConfiguration",
|
||||||
expectedKinds: []string{
|
expectedKinds: []string{constants.ResetConfigurationKind},
|
||||||
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,
|
cmdProc: newCmdConfigPrintResetDefaults,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -484,9 +444,11 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
|
|||||||
var output bytes.Buffer
|
var output bytes.Buffer
|
||||||
|
|
||||||
command := test.cmdProc(&output)
|
command := test.cmdProc(&output)
|
||||||
|
if test.componentConfigs != "" {
|
||||||
if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil {
|
if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil {
|
||||||
t.Fatalf("failed to set component-configs flag")
|
t.Fatalf("failed to set component-configs flag")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if err := command.RunE(nil, nil); err != nil {
|
if err := command.RunE(nil, nil); err != nil {
|
||||||
t.Fatalf("Error from running the print command: %v", err)
|
t.Fatalf("Error from running the print command: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user