Adds new tests and increases code coverage.

This commit is contained in:
Avesh Agarwal 2015-10-06 18:24:08 -04:00
parent 8fb96afff4
commit 888a488162

View File

@ -19,6 +19,7 @@ package app
import (
"testing"
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/pkg/api"
)
@ -59,3 +60,24 @@ func Test_mayTryIptablesProxy(t *testing.T) {
}
}
}
//This test verifies that Proxy Server does not crash that means
//Config and iptinterface are not nil when CleanupAndExit is true.
//To avoid proxy crash: https://github.com/kubernetes/kubernetes/pull/14736
func TestProxyServerWithCleanupAndExit(t *testing.T) {
//creates default config
config := NewProxyConfig()
//sets CleanupAndExit manually
config.CleanupAndExit = true
//creates new proxy server
proxyserver, err := NewProxyServerDefault(config)
//verifies that nothing is nill except error
assert.Nil(t, err)
assert.NotNil(t, proxyserver)
assert.NotNil(t, proxyserver.Config)
assert.NotNil(t, proxyserver.IptInterface)
}