mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-19 15:21:35 +02:00
integration: update CLI tests for ID-based preauthkey commands
Remove --user flag from list commands. Change expire command to use --id flag instead of --user and key.
This commit is contained in:
committed by
Kristoffer Dalby
parent
db6882b5f5
commit
4dd1b49a35
@@ -446,10 +446,9 @@ func TestAuthKeyLogoutAndReloginSameUserExpiredKey(t *testing.T) {
|
|||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"--user",
|
|
||||||
strconv.FormatUint(userMap[userName].GetId(), 10),
|
|
||||||
"expire",
|
"expire",
|
||||||
key.GetKey(),
|
"--id",
|
||||||
|
strconv.FormatUint(key.GetId(), 10),
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -313,8 +313,6 @@ func TestPreAuthKeyCommand(t *testing.T) {
|
|||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"--user",
|
|
||||||
"1",
|
|
||||||
"list",
|
"list",
|
||||||
"--output",
|
"--output",
|
||||||
"json",
|
"json",
|
||||||
@@ -371,15 +369,14 @@ func TestPreAuthKeyCommand(t *testing.T) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test key expiry - use the full key from creation, not the masked one from listing
|
// Test key expiry
|
||||||
_, err = headscale.Execute(
|
_, err = headscale.Execute(
|
||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"--user",
|
|
||||||
"1",
|
|
||||||
"expire",
|
"expire",
|
||||||
keys[0].GetKey(),
|
"--id",
|
||||||
|
strconv.FormatUint(keys[0].GetId(), 10),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -391,8 +388,6 @@ func TestPreAuthKeyCommand(t *testing.T) {
|
|||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"--user",
|
|
||||||
"1",
|
|
||||||
"list",
|
"list",
|
||||||
"--output",
|
"--output",
|
||||||
"json",
|
"json",
|
||||||
@@ -451,8 +446,6 @@ func TestPreAuthKeyCommandWithoutExpiry(t *testing.T) {
|
|||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"--user",
|
|
||||||
"1",
|
|
||||||
"list",
|
"list",
|
||||||
"--output",
|
"--output",
|
||||||
"json",
|
"json",
|
||||||
@@ -460,7 +453,7 @@ func TestPreAuthKeyCommandWithoutExpiry(t *testing.T) {
|
|||||||
&listedPreAuthKeys,
|
&listedPreAuthKeys,
|
||||||
)
|
)
|
||||||
assert.NoError(c, err)
|
assert.NoError(c, err)
|
||||||
}, 10*time.Second, 200*time.Millisecond, "Waiting for preauth keys list without expiry")
|
}, 10*time.Second, 200*time.Millisecond, "Waiting for preauth keys list")
|
||||||
|
|
||||||
// There is one key created by "scenario.CreateHeadscaleEnv"
|
// There is one key created by "scenario.CreateHeadscaleEnv"
|
||||||
assert.Len(t, listedPreAuthKeys, 2)
|
assert.Len(t, listedPreAuthKeys, 2)
|
||||||
@@ -538,8 +531,6 @@ func TestPreAuthKeyCommandReusableEphemeral(t *testing.T) {
|
|||||||
[]string{
|
[]string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"--user",
|
|
||||||
"1",
|
|
||||||
"list",
|
"list",
|
||||||
"--output",
|
"--output",
|
||||||
"json",
|
"json",
|
||||||
|
|||||||
Reference in New Issue
Block a user