mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
chore(e2e): increase ucind cluster init timeouts, decrease max backoff delay for TCP connection to retry faster
This commit is contained in:
@@ -125,7 +125,7 @@ func (p *Provisioner) initCluster(ctx context.Context, machines []Machine) error
|
|||||||
}
|
}
|
||||||
defer initClient.Close()
|
defer initClient.Close()
|
||||||
|
|
||||||
if err := initClient.WaitMachineReady(ctx, 30*time.Second); err != nil {
|
if err := initClient.WaitMachineReady(ctx, 90*time.Second); err != nil {
|
||||||
return fmt.Errorf("wait for machine %q to be ready: %w", initMachine.Name, err)
|
return fmt.Errorf("wait for machine %q to be ready: %w", initMachine.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ func (p *Provisioner) initCluster(ctx context.Context, machines []Machine) error
|
|||||||
|
|
||||||
fmt.Printf("Cluster %q initialised with machine %q\n", initMachine.ClusterName, initResp.Machine.Name)
|
fmt.Printf("Cluster %q initialised with machine %q\n", initMachine.ClusterName, initResp.Machine.Name)
|
||||||
fmt.Printf("Waiting for cluster to be ready...")
|
fmt.Printf("Waiting for cluster to be ready...")
|
||||||
if err = initClient.WaitClusterReady(ctx, 30*time.Second); err != nil {
|
if err = initClient.WaitClusterReady(ctx, 90*time.Second); err != nil {
|
||||||
return fmt.Errorf("wait for cluster to be ready: %w", err)
|
return fmt.Errorf("wait for cluster to be ready: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Println(" done.")
|
fmt.Println(" done.")
|
||||||
@@ -160,7 +160,7 @@ func (p *Provisioner) initCluster(ctx context.Context, machines []Machine) error
|
|||||||
//goland:noinspection GoDeferInLoop
|
//goland:noinspection GoDeferInLoop
|
||||||
defer cli.Close()
|
defer cli.Close()
|
||||||
|
|
||||||
if err := cli.WaitMachineReady(ctx, 30*time.Second); err != nil {
|
if err := cli.WaitMachineReady(ctx, 90*time.Second); err != nil {
|
||||||
return fmt.Errorf("wait for machine %q to be ready: %w", m.Name, err)
|
return fmt.Errorf("wait for machine %q to be ready: %w", m.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/psviderski/uncloud/internal/grpcversion"
|
"github.com/psviderski/uncloud/internal/grpcversion"
|
||||||
"golang.org/x/net/proxy"
|
"golang.org/x/net/proxy"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/backoff"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -21,10 +23,19 @@ func NewTCPConnector(apiAddr netip.AddrPort) *TCPConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *TCPConnector) Connect(_ context.Context) (*grpc.ClientConn, error) {
|
func (c *TCPConnector) Connect(_ context.Context) (*grpc.ClientConn, error) {
|
||||||
|
// Use a faster connection backoff than the default (which grows up to 120s). TCP connections are typically to
|
||||||
|
// local Docker containers (ucind) or LAN machines where long backoff delays are unnecessary.
|
||||||
|
backoffConfig := backoff.DefaultConfig
|
||||||
|
backoffConfig.MaxDelay = 5 * time.Second
|
||||||
|
|
||||||
conn, err := grpc.NewClient(
|
conn, err := grpc.NewClient(
|
||||||
c.apiAddr.String(),
|
c.apiAddr.String(),
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
grpc.WithDefaultServiceConfig(defaultServiceConfig),
|
grpc.WithDefaultServiceConfig(defaultServiceConfig),
|
||||||
|
grpc.WithConnectParams(grpc.ConnectParams{
|
||||||
|
Backoff: backoffConfig,
|
||||||
|
MinConnectTimeout: 5 * time.Second,
|
||||||
|
}),
|
||||||
grpc.WithUnaryInterceptor(grpcversion.ClientUnaryInterceptor),
|
grpc.WithUnaryInterceptor(grpcversion.ClientUnaryInterceptor),
|
||||||
grpc.WithStreamInterceptor(grpcversion.ClientStreamInterceptor),
|
grpc.WithStreamInterceptor(grpcversion.ClientStreamInterceptor),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ trap cleanup INT TERM EXIT
|
|||||||
|
|
||||||
dind dockerd &
|
dind dockerd &
|
||||||
echo "Waiting for Docker in Docker to be ready..."
|
echo "Waiting for Docker in Docker to be ready..."
|
||||||
timeout 5s sh -c "until docker info &> /dev/null; do sleep 0.1; done"
|
timeout 60s sh -c "until docker info &> /dev/null; do sleep 0.5; done"
|
||||||
echo "Docker in Docker is ready."
|
echo "Docker in Docker is ready."
|
||||||
|
|
||||||
echo "Loading corrosion image from /images/corrosion.tar..."
|
echo "Loading corrosion image from /images/corrosion.tar..."
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ func createTestCluster(
|
|||||||
})
|
})
|
||||||
|
|
||||||
if waitReady {
|
if waitReady {
|
||||||
require.NoError(t, p.WaitClusterReady(ctx, c, 60*time.Second))
|
require.NoError(t, p.WaitClusterReady(ctx, c, 90*time.Second))
|
||||||
}
|
}
|
||||||
|
|
||||||
return c, p
|
return c, p
|
||||||
|
|||||||
Reference in New Issue
Block a user