integration: fix tag tests for tagged nodes with nil user_id

Tagged nodes no longer have user_id set, so ListNodes(user) cannot
find them. Update integration tests to use ListNodes() (all nodes)
when looking up tagged nodes.

Add a findNode helper to locate nodes by predicate from an
unfiltered list, used in ACL tests that have multiple nodes per
scenario.

Updates #3077
This commit is contained in:
Kristoffer Dalby committed 2026-02-20 21:51:00 +01:00
1 parent 1e4fc3f179
commit be4fd9ff2d
3 files changed
+93 -89

No files matched your search

+12
View File
@@ -1004,6 +1004,18 @@ func GetUserByName(headscale ControlServer, username string) (*v1.User, error) {
return nil, fmt.Errorf("user %s not found", username) //nolint:err113
}
// findNode returns the first node in nodes for which match returns true,
// or nil if no node matches.
func findNode(nodes []*v1.Node, match func(*v1.Node) bool) *v1.Node {
for _, n := range nodes {
if match(n) {
return n
}
}
return nil
}
// FindNewClient finds a client that is in the new list but not in the original list.
// This is useful when dynamically adding nodes during tests and needing to identify
// which client was just added.