Skip to content

Commit

Permalink
Corrected unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hopleus committed Oct 17, 2024
1 parent 0a8ec1f commit 7b7562c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions hscontrol/db/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func (s *Suite) TestListPeersWithoutNonAuthorized(c *check.C) {
}

node := types.Node{
// nolint:G115
ID: types.NodeID(uint64(index)),
MachineKey: machineKey.Public(),
NodeKey: nodeKey.Public(),
Expand Down
2 changes: 1 addition & 1 deletion integration/auth_approval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions integration/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -1245,7 +1246,7 @@ func TestNodeApproveCommand(t *testing.T) {
"json",
},
)
assert.NoError(t, err)
assertNoErr(t, err)

var node v1.Node
err = executeAndUnmarshal(
Expand All @@ -1263,7 +1264,7 @@ func TestNodeApproveCommand(t *testing.T) {
},
&node,
)
assert.NoError(t, err)
assertNoErr(t, err)

nodes[index] = &node
}
Expand All @@ -1282,7 +1283,7 @@ func TestNodeApproveCommand(t *testing.T) {
},
&listAll,
)
assert.NoError(t, err)
assertNoErr(t, err)

assert.Len(t, listAll, 5)

Expand All @@ -1292,14 +1293,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)
Expand Down

0 comments on commit 7b7562c

Please sign in to comment.