feat: add --volume-options flag to storage:mount
The named-entry form of `storage:mount` had no way to set the attachment's `volume_options`, even though the legacy `host:container:opts` colon form parses options into the same field and every downstream consumer (the docker-args trigger and the storage:list/storage:report display path) already renders them. Tooling that declaratively re-applies attachments silently dropped options on every re-apply.
This commit is contained in:
@@ -129,6 +129,48 @@ func TestListAppMountEntriesK3sUsesEntryName(t *testing.T) {
|
||||
Expect(formatStorageListEntry(rows[0])).To(Equal("demo-pvc:/data"))
|
||||
}
|
||||
|
||||
func TestListAppMountEntriesVolumeOptions(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
root := withTempLibRoot(t)
|
||||
|
||||
Expect(SaveEntry(&Entry{
|
||||
Name: "demo-data",
|
||||
Scheduler: SchedulerDockerLocal,
|
||||
HostPath: "/var/lib/dokku/data/storage/demo-data",
|
||||
})).To(Succeed())
|
||||
|
||||
writeAttachmentsFile(t, root, "demo", []*Attachment{
|
||||
{
|
||||
EntryName: "demo-data",
|
||||
ContainerPath: "/data",
|
||||
Phases: []string{PhaseDeploy, PhaseRun},
|
||||
VolumeOptions: "Z",
|
||||
},
|
||||
{
|
||||
EntryName: "demo-data",
|
||||
ContainerPath: "/ro",
|
||||
Phases: []string{PhaseDeploy, PhaseRun},
|
||||
Readonly: true,
|
||||
VolumeOptions: "noexec,nosuid",
|
||||
},
|
||||
})
|
||||
|
||||
rows, err := ListAppMountEntries("demo", PhaseDeploy)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(rows).To(HaveLen(2))
|
||||
|
||||
byPath := map[string]StorageListEntry{}
|
||||
for _, row := range rows {
|
||||
byPath[row.ContainerPath] = row
|
||||
}
|
||||
|
||||
Expect(byPath["/data"].VolumeOptions).To(Equal("Z"))
|
||||
Expect(formatStorageListEntry(byPath["/data"])).To(Equal("/var/lib/dokku/data/storage/demo-data:/data:Z"))
|
||||
|
||||
Expect(byPath["/ro"].VolumeOptions).To(Equal("ro,noexec,nosuid"))
|
||||
Expect(formatStorageListEntry(byPath["/ro"])).To(Equal("/var/lib/dokku/data/storage/demo-data:/ro:ro,noexec,nosuid"))
|
||||
}
|
||||
|
||||
func TestListAppMountEntriesPhaseFilter(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
root := withTempLibRoot(t)
|
||||
|
||||
Reference in New Issue
Block a user