fix: preserve portable rollback mount identity
This commit is contained in:
@@ -802,22 +802,26 @@ 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])
|
||||
}
|
||||
func TestDockerDesktopBindAliasesPreserveLegacyStateOnlyOnDarwin(t *testing.T) {
|
||||
hostPath := "/private/var/folders/task/models.json"
|
||||
vmPath := "/host_mnt/private/var/folders/task/models.json"
|
||||
hostHash, vmHash := mountSourceHash(hostPath), mountSourceHash(vmPath)
|
||||
if hostHash == vmHash {
|
||||
t.Fatal("the persisted exact source hash changed instead of retaining state-v4 compatibility")
|
||||
}
|
||||
|
||||
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")
|
||||
legacy := Mount{Type: "bind", SourceSHA256: vmHash, Destination: "/config/models.json"}
|
||||
darwinCurrent := Mount{Type: "bind", SourceSHA256: hostHash, SourceAliases: mountSourceAliases("bind", hostPath, "darwin"), Destination: "/config/models.json"}
|
||||
if !sameMounts([]Mount{legacy}, []Mount{darwinCurrent}) {
|
||||
t.Fatal("a legacy Docker Desktop source hash did not match its current Darwin alias")
|
||||
}
|
||||
|
||||
linuxCurrent := Mount{Type: "bind", SourceSHA256: hostHash, SourceAliases: mountSourceAliases("bind", hostPath, "linux"), Destination: "/config/models.json"}
|
||||
if sameMounts([]Mount{legacy}, []Mount{linuxCurrent}) {
|
||||
t.Fatal("distinct Linux /host_mnt and host bind paths were collapsed")
|
||||
}
|
||||
if aliases := mountSourceAliases("volume", hostPath, "darwin"); len(aliases) != 0 {
|
||||
t.Fatalf("named-volume source received Docker Desktop bind aliases: %v", aliases)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user