update vendor dependencies for kubelet client

adding new imported package dependencies in vendor which is required
for Kubelet Pod Resource api client.

Change-Id: If6c74598e12af5f8659df69371e72dd064823f49
(cherry picked from commit 8ee7eb335e)
This commit is contained in:
Abdul Halim
2019-02-07 15:44:15 +00:00
committed by Zenghui Shi
parent 02913fb96f
commit 877f00be30
12542 changed files with 2815677 additions and 296 deletions

View File

@@ -7,6 +7,7 @@ import (
"os"
"syscall"
"testing"
"time"
)
func TestAddrAdd(t *testing.T) {
@@ -191,3 +192,55 @@ func TestAddrAddReplace(t *testing.T) {
t.Fatal("Address not removed properly")
}
}
func expectAddrUpdate(ch <-chan AddrUpdate, add bool, dst net.IP) bool {
for {
timeout := time.After(time.Minute)
select {
case update := <-ch:
if update.NewAddr == add && update.LinkAddress.IP.Equal(dst) {
return true
}
case <-timeout:
return false
}
}
}
func TestAddrSubscribeWithOptions(t *testing.T) {
tearDown := setUpNetlinkTest(t)
defer tearDown()
ch := make(chan AddrUpdate)
done := make(chan struct{})
defer close(done)
var lastError error
defer func() {
if lastError != nil {
t.Fatalf("Fatal error received during subscription: %v", lastError)
}
}()
if err := AddrSubscribeWithOptions(ch, done, AddrSubscribeOptions{
ErrorCallback: func(err error) {
lastError = err
},
}); err != nil {
t.Fatal(err)
}
// get loopback interface
link, err := LinkByName("lo")
if err != nil {
t.Fatal(err)
}
// bring the interface up
if err = LinkSetUp(link); err != nil {
t.Fatal(err)
}
ip := net.IPv4(127, 0, 0, 1)
if !expectAddrUpdate(ch, true, ip) {
t.Fatal("Add update not received as expected")
}
}