Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching to a longer test timeout. #690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/concurrent_client_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"testing"
"time"

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

type simpleServer struct {
Expand Down Expand Up @@ -59,7 +59,7 @@ func getTestClient(front string, t *testing.T) *http.Client {
Transport: &http.Transport{
DialContext: tunnel.DialContext,
},
Timeout: wait.ForeverTestTimeout,
Timeout: framework.ForeverTestTimeout,
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/framework/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (*InProcessAgentRunner) Start(t testing.TB, opts AgentOpts) (Agent, error)
}()

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

func (a *externalAgent) waitForLiveness() error {
err := wait.PollImmediate(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
err := wait.PollImmediate(100*time.Millisecond, ForeverTestTimeout, func() (bool, error) {
resp, err := http.Get(fmt.Sprintf("http://%s/healthz", a.healthAddr))
if err != nil {
return false, nil
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/proxy_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (*InProcessProxyServerRunner) Start(t testing.TB, opts ProxyServerOpts) (Pr
}()

healthAddr := net.JoinHostPort(o.HealthBindAddress, strconv.Itoa(o.HealthPort))
if err := wait.PollImmediateWithContext(ctx, 100*time.Millisecond, wait.ForeverTestTimeout, func(context.Context) (bool, error) {
if err := wait.PollImmediateWithContext(ctx, 100*time.Millisecond, ForeverTestTimeout, func(context.Context) (bool, error) {
return checkLiveness(healthAddr), nil
}); err != nil {
close(stopCh)
Expand Down
3 changes: 3 additions & 0 deletions tests/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import (
"net"
"net/http"
"strconv"
"time"
)

var ForeverTestTimeout = time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const


func checkReadiness(addr string) bool {
resp, err := http.Get(fmt.Sprintf("http://%s/readyz", addr))
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions tests/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func TestProxyHandle_RequestDeadlineExceeded_GRPC(t *testing.T) {
select {
case <-tunnel.Done():
t.Log("Tunnel closed successfully")
case <-time.After(wait.ForeverTestTimeout):
case <-time.After(framework.ForeverTestTimeout):
t.Errorf("Timed out waiting for tunnel to close")
}
}()
Expand Down Expand Up @@ -343,7 +343,7 @@ func TestProxyDial_RequestCancelled_GRPC(t *testing.T) {

select {
case <-tunnel.Done():
case <-time.After(wait.ForeverTestTimeout):
case <-time.After(framework.ForeverTestTimeout):
t.Errorf("Timed out waiting for tunnel to close")
}
}()
Expand Down Expand Up @@ -405,7 +405,7 @@ func TestProxyDial_RequestCancelled_Concurrent_GRPC(t *testing.T) {

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

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

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