feat: add storage entry and attachment types
Introduces the Entry and Attachment types that the storage plugin will use as the source of truth for named storage volumes, replacing the colon-delimited mount strings stored under docker-options. Entries persist as JSON under config/storage/entries and validate against scheduler-specific rules; attachments persist via the property list and capture how an app uses an entry. The legacy migration name synthesizer is also added so existing colon-form mounts can converge on a deterministic legacy- entry name. Existing storage commands are unchanged in this commit.
This commit is contained in:
33
plugins/storage/attachment_test.go
Normal file
33
plugins/storage/attachment_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestAttachmentValidate(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
|
||||
good := &Attachment{
|
||||
EntryName: "demo-data",
|
||||
ContainerPath: "/data",
|
||||
Phases: []string{PhaseDeploy, PhaseRun},
|
||||
}
|
||||
Expect(good.Validate()).To(Succeed())
|
||||
|
||||
noEntry := &Attachment{ContainerPath: "/data", Phases: []string{PhaseDeploy}}
|
||||
Expect(noEntry.Validate()).To(HaveOccurred())
|
||||
|
||||
noPath := &Attachment{EntryName: "demo-data", Phases: []string{PhaseDeploy}}
|
||||
Expect(noPath.Validate()).To(HaveOccurred())
|
||||
|
||||
relative := &Attachment{EntryName: "demo-data", ContainerPath: "data", Phases: []string{PhaseDeploy}}
|
||||
Expect(relative.Validate()).To(HaveOccurred())
|
||||
|
||||
noPhases := &Attachment{EntryName: "demo-data", ContainerPath: "/data"}
|
||||
Expect(noPhases.Validate()).To(HaveOccurred())
|
||||
|
||||
badPhase := &Attachment{EntryName: "demo-data", ContainerPath: "/data", Phases: []string{"build"}}
|
||||
Expect(badPhase.Validate()).To(HaveOccurred())
|
||||
}
|
||||
Reference in New Issue
Block a user