mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Adds new tests and increases code coverage.
This commit is contained in:
parent
8fb96afff4
commit
888a488162
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user