mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #81885 from mattjmcnaughton/mattjmcnaughton/fix-staticcheck-kubelet-test-integration
Fix `test/integration/kubelet` staticcheck failures
This commit is contained in:
commit
285dd49444
@ -115,7 +115,6 @@ test/integration/etcd
|
||||
test/integration/examples
|
||||
test/integration/framework
|
||||
test/integration/garbagecollector
|
||||
test/integration/kubelet
|
||||
test/integration/master
|
||||
test/integration/replicationcontroller
|
||||
test/integration/scale
|
||||
|
@ -61,6 +61,7 @@ func TestWatchBasedManager(t *testing.T) {
|
||||
// create 1000 secrets in parallel
|
||||
t.Log(time.Now(), "creating 1000 secrets")
|
||||
wg := sync.WaitGroup{}
|
||||
errCh := make(chan error, 1)
|
||||
for i := 0; i < 10; i++ {
|
||||
wg.Add(1)
|
||||
go func(i int) {
|
||||
@ -68,17 +69,27 @@ func TestWatchBasedManager(t *testing.T) {
|
||||
for j := 0; j < 100; j++ {
|
||||
name := fmt.Sprintf("s%d", i*100+j)
|
||||
if _, err := client.CoreV1().Secrets(testNamespace).Create(&v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: name}}); err != nil {
|
||||
t.Fatal(err)
|
||||
select {
|
||||
case errCh <- err:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Print(".")
|
||||
}(i)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
select {
|
||||
case err := <-errCh:
|
||||
t.Fatal(err)
|
||||
default:
|
||||
}
|
||||
t.Log(time.Now(), "finished creating 1000 secrets")
|
||||
|
||||
// fetch all secrets
|
||||
wg = sync.WaitGroup{}
|
||||
errCh = make(chan error, 1)
|
||||
for i := 0; i < 10; i++ {
|
||||
wg.Add(1)
|
||||
go func(i int) {
|
||||
@ -99,7 +110,10 @@ func TestWatchBasedManager(t *testing.T) {
|
||||
return true, nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("failed on %s: %v", name, err)
|
||||
select {
|
||||
case errCh <- fmt.Errorf("failed on :%s: %v", name, err):
|
||||
default:
|
||||
}
|
||||
}
|
||||
if d := time.Since(start); d > time.Second {
|
||||
t.Logf("%s took %v", name, d)
|
||||
@ -107,5 +121,11 @@ func TestWatchBasedManager(t *testing.T) {
|
||||
}
|
||||
}(i)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
select {
|
||||
case err = <-errCh:
|
||||
t.Fatal(err)
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user