1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-09-20 17:53:11 +02:00

Corrected unit tests

This commit is contained in:
hopleus 2024-10-17 14:20:13 +03:00
parent 119e35f930
commit c49cf0f80f
3 changed files with 8 additions and 6 deletions

View File

@ -203,6 +203,7 @@ func (s *Suite) TestListPeersWithoutNonAuthorized(c *check.C) {
}
node := types.Node{
// nolint:G115
ID: types.NodeID(uint64(index)),
MachineKey: machineKey.Public(),
NodeKey: nodeKey.Public(),

View File

@ -13,7 +13,7 @@ import (
"strings"
"testing"
"github.com/juanfont/headscale/gen/go/headscale/v1"
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
"github.com/juanfont/headscale/hscontrol/types"
"github.com/juanfont/headscale/integration/hsic"
"github.com/samber/lo"

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"testing"
"time"
@ -1214,7 +1215,7 @@ func TestNodeApproveCommand(t *testing.T) {
"json",
},
)
assert.NoError(t, err)
assertNoErr(t, err)
var node v1.Node
err = executeAndUnmarshal(
@ -1232,7 +1233,7 @@ func TestNodeApproveCommand(t *testing.T) {
},
&node,
)
assert.NoError(t, err)
assertNoErr(t, err)
nodes[index] = &node
}
@ -1251,7 +1252,7 @@ func TestNodeApproveCommand(t *testing.T) {
},
&listAll,
)
assert.NoError(t, err)
assertNoErr(t, err)
assert.Len(t, listAll, 5)
@ -1261,14 +1262,14 @@ func TestNodeApproveCommand(t *testing.T) {
assert.False(t, listAll[3].GetApproved())
assert.False(t, listAll[4].GetApproved())
for idx := 0; idx < 3; idx++ {
for idx := range [3]int{} {
_, err := headscale.Execute(
[]string{
"headscale",
"nodes",
"approve",
"--identifier",
fmt.Sprintf("%d", listAll[idx].GetId()),
strconv.FormatUint(listAll[idx].GetId(), 10),
},
)
assert.NoError(t, err)