mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
golangci-lint --fix
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
4cb7d63e8b
commit
36ad0003a9
4 changed files with 41 additions and 34 deletions
|
@ -15,8 +15,10 @@ import (
|
|||
"github.com/ory/dockertest/v3"
|
||||
)
|
||||
|
||||
const hsicHashLength = 6
|
||||
const dockerContextPath = "../."
|
||||
const (
|
||||
hsicHashLength = 6
|
||||
dockerContextPath = "../."
|
||||
)
|
||||
|
||||
var errHeadscaleStatusCodeNotOk = errors.New("headscale status code not ok")
|
||||
|
||||
|
@ -32,7 +34,8 @@ type HeadscaleInContainer struct {
|
|||
func New(
|
||||
pool *dockertest.Pool,
|
||||
port int,
|
||||
network *dockertest.Network) (*HeadscaleInContainer, error) {
|
||||
network *dockertest.Network,
|
||||
) (*HeadscaleInContainer, error) {
|
||||
hash, err := headscale.GenerateRandomStringDNSSafe(hsicHashLength)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -19,9 +19,10 @@ import (
|
|||
|
||||
const scenarioHashLength = 6
|
||||
|
||||
var errNoHeadscaleAvailable = errors.New("no headscale available")
|
||||
var errNoNamespaceAvailable = errors.New("no namespace available")
|
||||
var TailscaleVersions = []string{
|
||||
var (
|
||||
errNoHeadscaleAvailable = errors.New("no headscale available")
|
||||
errNoNamespaceAvailable = errors.New("no namespace available")
|
||||
TailscaleVersions = []string{
|
||||
"head",
|
||||
"unstable",
|
||||
"1.32.0",
|
||||
|
@ -40,6 +41,7 @@ var TailscaleVersions = []string{
|
|||
// "1.10.2",
|
||||
// "1.8.7",
|
||||
}
|
||||
)
|
||||
|
||||
type Namespace struct {
|
||||
Clients map[string]*tsic.TailscaleInContainer
|
||||
|
@ -272,7 +274,7 @@ func (s *Scenario) WaitForTailscaleSync() error {
|
|||
|
||||
// CreateHeadscaleEnv is a conventient method returning a set up Headcale
|
||||
// test environment with nodes of all versions, joined to the server with X
|
||||
// namespaces
|
||||
// namespaces.
|
||||
func (s *Scenario) CreateHeadscaleEnv(namespaces map[string]int) error {
|
||||
err := s.StartHeadscale()
|
||||
if err != nil {
|
||||
|
|
|
@ -44,7 +44,6 @@ func TestHeadscale(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("headscale failed to become ready: %s", err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
t.Run("create-namespace", func(t *testing.T) {
|
||||
|
@ -129,7 +128,6 @@ func TestTailscaleNodesJoiningHeadcale(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("headscale failed to become ready: %s", err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
t.Run("create-namespace", func(t *testing.T) {
|
||||
|
|
|
@ -16,11 +16,15 @@ import (
|
|||
"tailscale.com/ipn/ipnstate"
|
||||
)
|
||||
|
||||
const tsicHashLength = 6
|
||||
const dockerContextPath = "../."
|
||||
const (
|
||||
tsicHashLength = 6
|
||||
dockerContextPath = "../."
|
||||
)
|
||||
|
||||
var errTailscalePingFailed = errors.New("ping failed")
|
||||
var errTailscaleNotLoggedIn = errors.New("tailscale not logged in")
|
||||
var (
|
||||
errTailscalePingFailed = errors.New("ping failed")
|
||||
errTailscaleNotLoggedIn = errors.New("tailscale not logged in")
|
||||
)
|
||||
|
||||
type TailscaleInContainer struct {
|
||||
version string
|
||||
|
@ -34,7 +38,8 @@ type TailscaleInContainer struct {
|
|||
func New(
|
||||
pool *dockertest.Pool,
|
||||
version string,
|
||||
network *dockertest.Network) (*TailscaleInContainer, error) {
|
||||
network *dockertest.Network,
|
||||
) (*TailscaleInContainer, error) {
|
||||
hash, err := headscale.GenerateRandomStringDNSSafe(tsicHashLength)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -130,7 +135,7 @@ func (t *TailscaleInContainer) Up(
|
|||
return nil
|
||||
}
|
||||
|
||||
// TODO(kradalby): Make cached/lazy
|
||||
// TODO(kradalby): Make cached/lazy.
|
||||
func (t *TailscaleInContainer) IPs() ([]netip.Addr, error) {
|
||||
ips := make([]netip.Addr, 0)
|
||||
|
||||
|
@ -213,7 +218,7 @@ func (t *TailscaleInContainer) WaitForPeers(expected int) error {
|
|||
})
|
||||
}
|
||||
|
||||
// TODO(kradalby): Make multiping, go routine magic
|
||||
// TODO(kradalby): Make multiping, go routine magic.
|
||||
func (t *TailscaleInContainer) Ping(ip netip.Addr) error {
|
||||
return t.pool.Retry(func() error {
|
||||
command := []string{
|
||||
|
@ -245,7 +250,6 @@ func (t *TailscaleInContainer) Ping(ip netip.Addr) error {
|
|||
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func createTailscaleBuildOptions(version string) *dockertest.BuildOptions {
|
||||
|
|
Loading…
Reference in a new issue