mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 19:28:16 +00:00
Make healthcheck an interface
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/service"
|
||||
"k8s.io/kubernetes/pkg/proxy"
|
||||
@@ -493,6 +494,10 @@ func (f *fakePortOpener) OpenLocalPort(lp *localPort) (closeable, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type fakeHealthChecker struct{}
|
||||
|
||||
func (fakeHealthChecker) UpdateEndpoints(serviceName types.NamespacedName, endpointUIDs sets.String) {}
|
||||
|
||||
func NewFakeProxier(ipt utiliptables.Interface) *Proxier {
|
||||
// TODO: Call NewProxier after refactoring out the goroutine
|
||||
// invocation into a Run() method.
|
||||
@@ -507,6 +512,7 @@ func NewFakeProxier(ipt utiliptables.Interface) *Proxier {
|
||||
hostname: "test-hostname",
|
||||
portsMap: make(map[localPort]closeable),
|
||||
portMapper: &fakePortOpener{[]*localPort{}},
|
||||
healthChecker: fakeHealthChecker{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2050,7 +2056,7 @@ func Test_updateEndpoints(t *testing.T) {
|
||||
}}
|
||||
|
||||
for tci, tc := range testCases {
|
||||
newMap, stale := updateEndpoints(tc.newEndpoints, tc.oldEndpoints, "host", func(types.NamespacedName, []hostPortInfo) {})
|
||||
newMap, stale := updateEndpoints(tc.newEndpoints, tc.oldEndpoints, "host", fakeHealthChecker{})
|
||||
if len(newMap) != len(tc.expectedResult) {
|
||||
t.Errorf("[%d] expected %d results, got %d: %v", tci, len(tc.expectedResult), len(newMap), newMap)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user