headscale/hscontrol/db
Kristoffer Dalby 1e4fc3f179 hscontrol: add tests for deleting users with tagged nodes
Test the tagged-node-survives-user-deletion scenario at two layers:

DB layer (users_test.go):
- success_user_only_has_tagged_nodes: tagged nodes with nil
  user_id do not block user deletion and survive it
- error_user_has_tagged_and_owned_nodes: user-owned nodes
  still block deletion even when tagged nodes coexist

App layer (grpcv1_test.go):
- TestDeleteUser_TaggedNodeSurvives: full registration flow
  with tagged PreAuthKey verifies nil UserID after registration,
  absence from nodesByUser index, user deletion succeeds, and
  tagged node remains in global node list

Also update auth_tags_test.go assertions to expect nil UserID
on tagged nodes, consistent with the new invariant.

Updates #3077
2026-02-20 21:51:00 +01:00
..
sqliteconfig all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
testdata/sqlite db: use PolicyManager for RequestTags migration 2026-01-21 15:10:29 +01:00
api_key.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
api_key_test.go grpc: support expire/delete API keys by ID 2026-01-20 17:13:38 +01:00
db.go hscontrol/db: add migration to clear user_id on tagged nodes 2026-02-20 21:51:00 +01:00
db_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
ephemeral_garbage_collector_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
ip.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
ip_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
node.go node: implement disable key expiry via CLI and API 2026-02-20 21:49:55 +01:00
node_test.go node: implement disable key expiry via CLI and API 2026-02-20 21:49:55 +01:00
policy.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
preauth_keys.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
preauth_keys_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
schema.sql hscontrol/db: add migration to clear user_id on tagged nodes 2026-02-20 21:51:00 +01:00
suite_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
text_serialiser.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
user_update_test.go hscontrol: use Updates() instead of Save() for partial updates 2025-11-11 12:47:48 -06:00
users.go hscontrol: enforce that tagged nodes never have user_id 2026-02-20 21:51:00 +01:00
users_test.go hscontrol: add tests for deleting users with tagged nodes 2026-02-20 21:51:00 +01:00
versioncheck.go db: fix database_versions table creation for PostgreSQL 2026-02-19 08:21:23 +01:00
versioncheck_test.go db: enforce strict version upgrade path 2026-02-19 08:21:23 +01:00