mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-22 07:57:34 +00:00
give ci more tollerance for timeouts
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
432e975a7f
commit
2434d76ade
@ -16,11 +16,6 @@ var (
|
|||||||
Help: "The total amount of registered machine attempts",
|
Help: "The total amount of registered machine attempts",
|
||||||
}, []string{"action", "auth", "status", "user"})
|
}, []string{"action", "auth", "status", "user"})
|
||||||
|
|
||||||
updateRequestsFromNode = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
||||||
Namespace: prometheusNamespace,
|
|
||||||
Name: "update_request_from_node_total",
|
|
||||||
Help: "The number of updates requested by a node/update function",
|
|
||||||
}, []string{"user", "machine", "state"})
|
|
||||||
updateRequestsSentToNode = promauto.NewCounterVec(prometheus.CounterOpts{
|
updateRequestsSentToNode = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||||
Namespace: prometheusNamespace,
|
Namespace: prometheusNamespace,
|
||||||
Name: "update_request_sent_to_node_total",
|
Name: "update_request_sent_to_node_total",
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/ory/dockertest/v3"
|
"github.com/ory/dockertest/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
const dockerExecuteTimeout = time.Second * 10
|
const dockerExecuteTimeout = time.Second * 30
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrDockertestCommandFailed = errors.New("dockertest command failed")
|
ErrDockertestCommandFailed = errors.New("dockertest command failed")
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||||
"github.com/juanfont/headscale/hscontrol/util"
|
"github.com/juanfont/headscale/hscontrol/util"
|
||||||
@ -21,7 +20,6 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
scenarioHashLength = 6
|
scenarioHashLength = 6
|
||||||
maxWait = 60 * time.Second
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -130,7 +128,7 @@ func NewScenario() (*Scenario, error) {
|
|||||||
return nil, fmt.Errorf("could not connect to docker: %w", err)
|
return nil, fmt.Errorf("could not connect to docker: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pool.MaxWait = maxWait
|
pool.MaxWait = dockertestMaxWait()
|
||||||
|
|
||||||
networkName := fmt.Sprintf("hs-%s", hash)
|
networkName := fmt.Sprintf("hs-%s", hash)
|
||||||
if overrideNetworkName := os.Getenv("HEADSCALE_TEST_NETWORK_NAME"); overrideNetworkName != "" {
|
if overrideNetworkName := os.Getenv("HEADSCALE_TEST_NETWORK_NAME"); overrideNetworkName != "" {
|
||||||
|
@ -20,11 +20,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
tsicHashLength = 6
|
tsicHashLength = 6
|
||||||
defaultPingTimeout = 300 * time.Millisecond
|
defaultPingTimeout = 300 * time.Millisecond
|
||||||
defaultPingCount = 10
|
defaultPingCount = 10
|
||||||
dockerContextPath = "../."
|
dockerContextPath = "../."
|
||||||
headscaleCertPath = "/usr/local/share/ca-certificates/headscale.crt"
|
headscaleCertPath = "/usr/local/share/ca-certificates/headscale.crt"
|
||||||
|
dockerExecuteTimeout = 60 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -361,7 +362,7 @@ func (t *TailscaleInContainer) Login(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, _, err := t.Execute(command); err != nil {
|
if _, _, err := t.Execute(command, dockertestutil.ExecuteCommandTimeout(dockerExecuteTimeout)); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"%s failed to join tailscale client (%s): %w",
|
"%s failed to join tailscale client (%s): %w",
|
||||||
t.hostname,
|
t.hostname,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -131,6 +132,38 @@ func isSelfClient(client TailscaleClient, addr string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isCI() bool {
|
||||||
|
if _, ok := os.LookupEnv("CI"); ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := os.LookupEnv("GITHUB_RUN_ID"); ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func dockertestMaxWait() time.Duration {
|
||||||
|
wait := 60 * time.Second //nolint
|
||||||
|
|
||||||
|
if isCI() {
|
||||||
|
wait = 300 * time.Second //nolint
|
||||||
|
}
|
||||||
|
|
||||||
|
return wait
|
||||||
|
}
|
||||||
|
|
||||||
|
// func dockertestCommandTimeout() time.Duration {
|
||||||
|
// timeout := 10 * time.Second //nolint
|
||||||
|
//
|
||||||
|
// if isCI() {
|
||||||
|
// timeout = 60 * time.Second //nolint
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return timeout
|
||||||
|
// }
|
||||||
|
|
||||||
// pingAllNegativeHelper is intended to have 1 or more nodes timeing out from the ping,
|
// pingAllNegativeHelper is intended to have 1 or more nodes timeing out from the ping,
|
||||||
// it counts failures instead of successes.
|
// it counts failures instead of successes.
|
||||||
// func pingAllNegativeHelper(t *testing.T, clients []TailscaleClient, addrs []string) int {
|
// func pingAllNegativeHelper(t *testing.T, clients []TailscaleClient, addrs []string) int {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user