mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #48237 from xiangpengzhao/fix-proxy-test
Automatic merge from submit-queue Add test for kube-proxy running with "--cleanup-iptables=true" **What this PR does / why we need it**: Add test to prevent such kube-proxy panic to happen again. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #48177 **Special notes for your reviewer**: Forgot to add this in last PR #48183. Should we also add this to v1.7 milestone? /cc @ncdc @dchen1107 **Release note**: ```release-note NONE ```
This commit is contained in:
commit
0c2f816646
@ -122,7 +122,7 @@ type Options struct {
|
|||||||
func AddFlags(options *Options, fs *pflag.FlagSet) {
|
func AddFlags(options *Options, fs *pflag.FlagSet) {
|
||||||
fs.StringVar(&options.ConfigFile, "config", options.ConfigFile, "The path to the configuration file.")
|
fs.StringVar(&options.ConfigFile, "config", options.ConfigFile, "The path to the configuration file.")
|
||||||
fs.StringVar(&options.WriteConfigTo, "write-config-to", options.WriteConfigTo, "If set, write the default configuration values to this file and exit.")
|
fs.StringVar(&options.WriteConfigTo, "write-config-to", options.WriteConfigTo, "If set, write the default configuration values to this file and exit.")
|
||||||
fs.BoolVar(&options.CleanupAndExit, "cleanup-iptables", options.CleanupAndExit, "If true cleanup iptables rules and exit.")
|
fs.BoolVar(&options.CleanupAndExit, "cleanup-iptables", options.CleanupAndExit, "If true, cleanup iptables rules and exit.")
|
||||||
|
|
||||||
// All flags below here are deprecated and will eventually be removed.
|
// All flags below here are deprecated and will eventually be removed.
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ func TestProxyServerWithCleanupAndExit(t *testing.T) {
|
|||||||
assert.Nil(t, err, "unexpected error in NewProxyServer, addr: %s", addr)
|
assert.Nil(t, err, "unexpected error in NewProxyServer, addr: %s", addr)
|
||||||
assert.NotNil(t, proxyserver, "nil proxy server obj, addr: %s", addr)
|
assert.NotNil(t, proxyserver, "nil proxy server obj, addr: %s", addr)
|
||||||
assert.NotNil(t, proxyserver.IptInterface, "nil iptables intf, addr: %s", addr)
|
assert.NotNil(t, proxyserver.IptInterface, "nil iptables intf, addr: %s", addr)
|
||||||
|
assert.True(t, proxyserver.CleanupAndExit, "false CleanupAndExit, addr: %s", addr)
|
||||||
|
|
||||||
// Clean up config for next test case
|
// Clean up config for next test case
|
||||||
configz.Delete("componentconfig")
|
configz.Delete("componentconfig")
|
||||||
|
Loading…
Reference in New Issue
Block a user