Skip to content

Commit f620421

Browse files
committed
Switching to a longer test timeout.
Github actions seem significantly under resourced. As a result we get a high level of flakes where CPU starved goroutines are not completing inside of 30 seconds.
1 parent a515c83 commit f620421

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

tests/concurrent_client_request_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"testing"
2828
"time"
2929

30-
"k8s.io/apimachinery/pkg/util/wait"
30+
"sigs.k8s.io/apiserver-network-proxy/tests/framework"
3131
)
3232

3333
type simpleServer struct {
@@ -59,7 +59,7 @@ func getTestClient(front string, t *testing.T) *http.Client {
5959
Transport: &http.Transport{
6060
DialContext: tunnel.DialContext,
6161
},
62-
Timeout: wait.ForeverTestTimeout,
62+
Timeout: framework.ForeverTestTimeout,
6363
}
6464
}
6565

tests/framework/agent.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (*InProcessAgentRunner) Start(t testing.TB, opts AgentOpts) (Agent, error)
7878
}()
7979

8080
healthAddr := net.JoinHostPort(o.HealthServerHost, strconv.Itoa(o.HealthServerPort))
81-
if err := wait.PollImmediateWithContext(ctx, 100*time.Millisecond, wait.ForeverTestTimeout, func(context.Context) (bool, error) {
81+
if err := wait.PollImmediateWithContext(ctx, 100*time.Millisecond, ForeverTestTimeout, func(context.Context) (bool, error) {
8282
return checkLiveness(healthAddr), nil
8383
}); err != nil {
8484
close(stopCh)
@@ -215,7 +215,7 @@ func (a *externalAgent) Metrics() metricstest.AgentTester {
215215
}
216216

217217
func (a *externalAgent) waitForLiveness() error {
218-
err := wait.PollImmediate(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
218+
err := wait.PollImmediate(100*time.Millisecond, ForeverTestTimeout, func() (bool, error) {
219219
resp, err := http.Get(fmt.Sprintf("http://%s/healthz", a.healthAddr))
220220
if err != nil {
221221
return false, nil

tests/framework/proxy_server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (*InProcessProxyServerRunner) Start(t testing.TB, opts ProxyServerOpts) (Pr
7373
}()
7474

7575
healthAddr := net.JoinHostPort(o.HealthBindAddress, strconv.Itoa(o.HealthPort))
76-
if err := wait.PollImmediateWithContext(ctx, 100*time.Millisecond, wait.ForeverTestTimeout, func(context.Context) (bool, error) {
76+
if err := wait.PollImmediateWithContext(ctx, 100*time.Millisecond, ForeverTestTimeout, func(context.Context) (bool, error) {
7777
return checkLiveness(healthAddr), nil
7878
}); err != nil {
7979
close(stopCh)

tests/framework/util.go

+3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import (
2121
"net"
2222
"net/http"
2323
"strconv"
24+
"time"
2425
)
2526

27+
var ForeverTestTimeout = time.Minute
28+
2629
func checkReadiness(addr string) bool {
2730
resp, err := http.Get(fmt.Sprintf("http://%s/readyz", addr))
2831
if err != nil {

tests/proxy_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func TestProxyHandle_RequestDeadlineExceeded_GRPC(t *testing.T) {
293293
select {
294294
case <-tunnel.Done():
295295
t.Log("Tunnel closed successfully")
296-
case <-time.After(wait.ForeverTestTimeout):
296+
case <-time.After(framework.ForeverTestTimeout):
297297
t.Errorf("Timed out waiting for tunnel to close")
298298
}
299299
}()
@@ -343,7 +343,7 @@ func TestProxyDial_RequestCancelled_GRPC(t *testing.T) {
343343

344344
select {
345345
case <-tunnel.Done():
346-
case <-time.After(wait.ForeverTestTimeout):
346+
case <-time.After(framework.ForeverTestTimeout):
347347
t.Errorf("Timed out waiting for tunnel to close")
348348
}
349349
}()
@@ -405,7 +405,7 @@ func TestProxyDial_RequestCancelled_Concurrent_GRPC(t *testing.T) {
405405

406406
select {
407407
case <-tunnel.Done():
408-
case <-time.After(wait.ForeverTestTimeout):
408+
case <-time.After(framework.ForeverTestTimeout):
409409
t.Errorf("Timed out waiting for tunnel to close")
410410
}
411411
}
@@ -427,7 +427,7 @@ func TestProxyDial_RequestCancelled_Concurrent_GRPC(t *testing.T) {
427427

428428
// Wait for the closed connections to propogate
429429
var endpointConnsErr, goLeaksErr error
430-
wait.PollImmediate(time.Second, wait.ForeverTestTimeout, func() (done bool, err error) {
430+
wait.PollImmediate(time.Second, framework.ForeverTestTimeout, func() (done bool, err error) {
431431
endpointConnsErr = a.Metrics().ExpectAgentEndpointConnections(0)
432432
goLeaksErr = goleak.Find(ignoredGoRoutines...)
433433
return endpointConnsErr == nil && goLeaksErr == nil, nil
@@ -489,7 +489,7 @@ func TestProxyDial_AgentTimeout_GRPC(t *testing.T) {
489489

490490
select {
491491
case <-tunnel.Done():
492-
case <-time.After(wait.ForeverTestTimeout):
492+
case <-time.After(framework.ForeverTestTimeout):
493493
t.Errorf("Timed out waiting for tunnel to close")
494494
}
495495
}()
@@ -965,7 +965,7 @@ func waitForConnectedServerCount(t testing.TB, expectedServerCount int, a framew
965965
// agents (backends). This assumes the ProxyServer is using a single ProxyStrategy.
966966
func waitForConnectedAgentCount(t testing.TB, expectedAgentCount int, ps framework.ProxyServer) {
967967
t.Helper()
968-
err := wait.PollImmediate(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
968+
err := wait.PollImmediate(100*time.Millisecond, framework.ForeverTestTimeout, func() (bool, error) {
969969
count, err := ps.ConnectedBackends()
970970
if err != nil {
971971
return false, err

0 commit comments

Comments
 (0)