fix: normalize Docker Desktop mount aliases

This commit is contained in:
2026-08-09 00:28:25 +02:00
parent fa151c5ea5
commit fb95be3e62
2 changed files with 26 additions and 0 deletions
+19
View File
@@ -802,6 +802,25 @@ func TestRunningImageCapturesServerBindAndNamedMountIdentity(t *testing.T) {
}
}
func TestDockerDesktopBindAliasesKeepOnePersistenceIdentity(t *testing.T) {
for _, paths := range [][2]string{
{"/private/var/folders/task/models.json", "/host_mnt/private/var/folders/task/models.json"},
{"/Users/operator/thoth/models.json", "/host_mnt/Users/operator/thoth/models.json"},
} {
left := Mount{Type: "bind", SourceSHA256: mountSourceHash(paths[0]), Destination: "/config/models.json"}
right := Mount{Type: "bind", SourceSHA256: mountSourceHash(paths[1]), Destination: "/config/models.json"}
if !sameMounts([]Mount{left}, []Mount{right}) {
t.Fatalf("Docker Desktop aliases were treated as different mounts: %q and %q", paths[0], paths[1])
}
}
left := Mount{Type: "bind", SourceSHA256: mountSourceHash("/srv/thoth/models.json"), Destination: "/config/models.json"}
right := Mount{Type: "bind", SourceSHA256: mountSourceHash("/host_mnt/srv/thoth/models.json"), Destination: "/config/models.json"}
if sameMounts([]Mount{left}, []Mount{right}) {
t.Fatal("an unknown /host_mnt path was collapsed into a distinct Linux bind source")
}
}
func TestCanonicalDigestReferenceRejectsCredentialsAndURLForms(t *testing.T) {
valid := "registry.example.invalid/thothii-core@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
if got, err := canonicalDigestReference(valid); err != nil || got != valid {