linktest

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package linktest provides cross-platform managed-link fixtures for tests.

dot-agents historically created link fixtures with os.Symlink, which fails on Windows without SeCreateSymbolicLinkPrivilege (Developer Mode / admin). The production link model uses junctions (dirs) and hard links (files) on Windows; test fixtures must mirror that so the contract checks (links.IsManagedLink / CollectBrokenUserLinks / doctor repair) see the same shapes they will in the field.

Use Link for a valid managed reference and DanglingLink for a broken one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DanglingLink(t *testing.T, link string) string

DanglingLink creates a broken managed link at link and returns the absolute target path it references, which does not exist (so the link is "dangling"). Callers that assert the resolved target should compare against the returned value rather than a hard-coded path, since the Windows junction mechanism dictates the concrete target location.

POSIX: a symlink to a never-created path under a temp dir. Windows: a junction created against a real temp dir which is then removed, leaving a reparse point whose target is gone — the closest analogue, since a hard link cannot dangle (its target must exist).

func Link(t *testing.T, target, link string)

Link creates a managed link at link pointing to target. target MUST already exist. POSIX: a symlink. Windows: a directory junction when target is a directory, a hard link when target is a file. The parent of link is created if necessary.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL