diff --git a/internal/mapping/mapping.go b/internal/mapping/mapping.go index 7426b50..68ab6aa 100644 --- a/internal/mapping/mapping.go +++ b/internal/mapping/mapping.go @@ -225,6 +225,7 @@ func ToNode(capVer tailcfg.CapabilityVersion, m *domain.Machine, tailnet *domain if m.HasTags() { n.User = tailcfg.UserID(taggedDevicesUser.ID) + n.Tags = m.Tags user = tailcfg.UserProfile{ ID: tailcfg.UserID(taggedDevicesUser.ID), LoginName: "tagged-devices", diff --git a/tests/integration_test.go b/tests/integration_test.go index e24276e..861e147 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -80,3 +80,16 @@ func TestNodeWithSameHostname(t *testing.T) { }, machines) }) } + +func TestNodeShouldSeeAssignedTags(t *testing.T) { + sc.Run(t, func(s *sc.Scenario) { + tailnet := s.CreateTailnet() + key := s.CreateAuthKey(tailnet.Id, true, "tag:server") + + nodeA := s.NewTailscaleNode() + + require.NoError(t, nodeA.Up(key, tsn.WithAdvertiseTags("tag:test"))) + require.NoError(t, nodeA.WaitFor(tsn.HasTag("tag:server"))) + require.NoError(t, nodeA.WaitFor(tsn.HasTag("tag:test"))) + }) +}