mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/kube-vip/kube-vip.git
synced 2026-09-20 08:03:47 +08:00
Compare commits
3 Commits
8f3697838f
...
b514ae2733
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b514ae2733 | ||
|
|
26eab74f3e | ||
|
|
44a67bc901 |
@@ -274,6 +274,8 @@ func (instance *Instance) initialize(ctx context.Context, svc *v1.Service, confi
|
||||
DHCPBackoffAttempts: config.DHCPBackoffAttempts,
|
||||
DisableServiceUpdates: config.DisableServiceUpdates,
|
||||
EnableServicesElection: config.EnableServicesElection,
|
||||
// cleanupVIPs reads this from the per-VIP config, so Service VIPs need it too.
|
||||
PreserveVIPOnLeadershipLoss: config.PreserveVIPOnLeadershipLoss,
|
||||
KubernetesLeaderElection: kubevip.KubernetesLeaderElection{
|
||||
EnableLeaderElection: config.EnableLeaderElection,
|
||||
},
|
||||
|
||||
@@ -26,7 +26,8 @@ type testDHCPClient struct {
|
||||
}
|
||||
|
||||
func newTestDHCPClient() *testDHCPClient {
|
||||
return &testDHCPClient{ips: make(chan string, 1), errors: make(chan error)}
|
||||
// Unbuffered so a send only completes once the watcher has taken the address.
|
||||
return &testDHCPClient{ips: make(chan string), errors: make(chan error)}
|
||||
}
|
||||
|
||||
func (c *testDHCPClient) ErrorChannel() chan error { return c.errors }
|
||||
@@ -209,13 +210,15 @@ func TestConfigureServiceWatchesBothDHCPFamilies(t *testing.T) {
|
||||
}
|
||||
wg := &sync.WaitGroup{}
|
||||
|
||||
if err := processor.configureService(context.Background(), serviceInstance, service, wg); err != nil {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
if err := processor.configureService(ctx, serviceInstance, service, wg); err != nil {
|
||||
t.Fatalf("configureService() error = %v", err)
|
||||
}
|
||||
dhcpv4.ips <- "192.0.2.10"
|
||||
dhcpv6.ips <- "2001:db8::10"
|
||||
close(dhcpv4.ips)
|
||||
close(dhcpv6.ips)
|
||||
cancel()
|
||||
wg.Wait()
|
||||
|
||||
if got := serviceInstance.DHCPInterfaceIPv4; got != "192.0.2.10" {
|
||||
|
||||
Reference in New Issue
Block a user