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:
parent
119e35f930
commit
c49cf0f80f
@ -203,6 +203,7 @@ func (s *Suite) TestListPeersWithoutNonAuthorized(c *check.C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node := types.Node{
|
node := types.Node{
|
||||||
|
// nolint:G115
|
||||||
ID: types.NodeID(uint64(index)),
|
ID: types.NodeID(uint64(index)),
|
||||||
MachineKey: machineKey.Public(),
|
MachineKey: machineKey.Public(),
|
||||||
NodeKey: nodeKey.Public(),
|
NodeKey: nodeKey.Public(),
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"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/hscontrol/types"
|
||||||
"github.com/juanfont/headscale/integration/hsic"
|
"github.com/juanfont/headscale/integration/hsic"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -1214,7 +1215,7 @@ func TestNodeApproveCommand(t *testing.T) {
|
|||||||
"json",
|
"json",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert.NoError(t, err)
|
assertNoErr(t, err)
|
||||||
|
|
||||||
var node v1.Node
|
var node v1.Node
|
||||||
err = executeAndUnmarshal(
|
err = executeAndUnmarshal(
|
||||||
@ -1232,7 +1233,7 @@ func TestNodeApproveCommand(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&node,
|
&node,
|
||||||
)
|
)
|
||||||
assert.NoError(t, err)
|
assertNoErr(t, err)
|
||||||
|
|
||||||
nodes[index] = &node
|
nodes[index] = &node
|
||||||
}
|
}
|
||||||
@ -1251,7 +1252,7 @@ func TestNodeApproveCommand(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&listAll,
|
&listAll,
|
||||||
)
|
)
|
||||||
assert.NoError(t, err)
|
assertNoErr(t, err)
|
||||||
|
|
||||||
assert.Len(t, listAll, 5)
|
assert.Len(t, listAll, 5)
|
||||||
|
|
||||||
@ -1261,14 +1262,14 @@ func TestNodeApproveCommand(t *testing.T) {
|
|||||||
assert.False(t, listAll[3].GetApproved())
|
assert.False(t, listAll[3].GetApproved())
|
||||||
assert.False(t, listAll[4].GetApproved())
|
assert.False(t, listAll[4].GetApproved())
|
||||||
|
|
||||||
for idx := 0; idx < 3; idx++ {
|
for idx := range [3]int{} {
|
||||||
_, err := headscale.Execute(
|
_, err := headscale.Execute(
|
||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"nodes",
|
"nodes",
|
||||||
"approve",
|
"approve",
|
||||||
"--identifier",
|
"--identifier",
|
||||||
fmt.Sprintf("%d", listAll[idx].GetId()),
|
strconv.FormatUint(listAll[idx].GetId(), 10),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user