Skip to content

Commit

Permalink
golangci-lint --fix
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Oct 18, 2022
1 parent 4cb7d63 commit 36ad000
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 35 deletions.
9 changes: 6 additions & 3 deletions integration/hsic/hsic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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
Expand Down
46 changes: 24 additions & 22 deletions integration/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ import (

const scenarioHashLength = 6

var errNoHeadscaleAvailable = errors.New("no headscale available")
var errNoNamespaceAvailable = errors.New("no namespace available")
var TailscaleVersions = []string{
"head",
"unstable",
"1.32.0",
"1.30.2",
"1.28.0",
"1.26.2",
"1.24.2",
"1.22.2",
"1.20.4",
"1.18.2",
"1.16.2",

// These versions seem to fail when fetching from apt.
// "1.14.6",
// "1.12.4",
// "1.10.2",
// "1.8.7",
}
var (
errNoHeadscaleAvailable = errors.New("no headscale available")
errNoNamespaceAvailable = errors.New("no namespace available")
TailscaleVersions = []string{
"head",
"unstable",
"1.32.0",
"1.30.2",
"1.28.0",
"1.26.2",
"1.24.2",
"1.22.2",
"1.20.4",
"1.18.2",
"1.16.2",

// These versions seem to fail when fetching from apt.
// "1.14.6",
// "1.12.4",
// "1.10.2",
// "1.8.7",
}
)

type Namespace struct {
Clients map[string]*tsic.TailscaleInContainer
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions integration/scenario_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
20 changes: 12 additions & 8 deletions integration/tsic/tsic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -245,7 +250,6 @@ func (t *TailscaleInContainer) Ping(ip netip.Addr) error {

return nil
})

}

func createTailscaleBuildOptions(version string) *dockertest.BuildOptions {
Expand Down

0 comments on commit 36ad000

Please sign in to comment.