From c685df7a6a75c9b09c664d8a2a2fe948afbd227e Mon Sep 17 00:00:00 2001 From: xiangpengzhao Date: Thu, 29 Jun 2017 10:16:12 +0800 Subject: [PATCH] Add test for kube-proxy running with "--cleanup-iptables=true" --- cmd/kube-proxy/app/server.go | 2 +- cmd/kube-proxy/app/server_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 9ad009c2454..37c8667d8d3 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -122,7 +122,7 @@ type Options struct { func AddFlags(options *Options, fs *pflag.FlagSet) { 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.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. diff --git a/cmd/kube-proxy/app/server_test.go b/cmd/kube-proxy/app/server_test.go index 673ae0ae79b..30c0b2025ec 100644 --- a/cmd/kube-proxy/app/server_test.go +++ b/cmd/kube-proxy/app/server_test.go @@ -195,6 +195,7 @@ func TestProxyServerWithCleanupAndExit(t *testing.T) { 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.IptInterface, "nil iptables intf, addr: %s", addr) + assert.True(t, proxyserver.CleanupAndExit, "false CleanupAndExit, addr: %s", addr) // Clean up config for next test case configz.Delete("componentconfig")