diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-16 02:06:41 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-16 02:06:41 +0900 |
| commit | 8dd3e1ee5d10c150f58e3b49771d3ca847f6d4cf (patch) | |
| tree | 08c0c6812d34da419cd06323073989fb7b8d0c21 /hst/fs_test.go | |
| parent | 4ffeec3004607b76f73e504da220a1490c598348 (diff) | |
hst/fs: rename method Target to Path
This allows adapter structs to use the same field names as Op structs.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/fs_test.go')
| -rw-r--r-- | hst/fs_test.go | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/hst/fs_test.go b/hst/fs_test.go index c251d070..43825c65 100644 --- a/hst/fs_test.go +++ b/hst/fs_test.go @@ -41,8 +41,8 @@ func TestFilesystemConfigJSON(t *testing.T) { {"bind", hst.FilesystemConfigJSON{ FilesystemConfig: &hst.FSBind{ - Dst: m("/etc"), - Src: m("/mnt/etc"), + Target: m("/etc"), + Source: m("/mnt/etc"), Optional: true, }, }, nil, @@ -51,10 +51,10 @@ func TestFilesystemConfigJSON(t *testing.T) { {"ephemeral", hst.FilesystemConfigJSON{ FilesystemConfig: &hst.FSEphemeral{ - Dst: m("/run/user/65534"), - Write: true, - Size: 1 << 10, - Perm: 0700, + Target: m("/run/user/65534"), + Write: true, + Size: 1 << 10, + Perm: 0700, }, }, nil, `{"type":"ephemeral","dst":"/run/user/65534","write":true,"size":1024,"perm":448}`, @@ -62,10 +62,10 @@ func TestFilesystemConfigJSON(t *testing.T) { {"overlay", hst.FilesystemConfigJSON{ FilesystemConfig: &hst.FSOverlay{ - Dst: m("/nix/store"), - Lower: ms("/mnt-root/nix/.ro-store"), - Upper: m("/mnt-root/nix/.rw-store/upper"), - Work: m("/mnt-root/nix/.rw-store/work"), + Target: m("/nix/store"), + Lower: ms("/mnt-root/nix/.ro-store"), + Upper: m("/mnt-root/nix/.rw-store/upper"), + Work: m("/mnt-root/nix/.rw-store/work"), }, }, nil, `{"type":"overlay","dst":"/nix/store","lower":["/mnt-root/nix/.ro-store"],"upper":"/mnt-root/nix/.rw-store/upper","work":"/mnt-root/nix/.rw-store/work"}`, @@ -159,7 +159,7 @@ func TestFilesystemConfigJSON(t *testing.T) { t.Errorf("Valid: %v, want false", got) } - if got := (&hst.FilesystemConfigJSON{FilesystemConfig: &hst.FSBind{Src: m("/etc")}}).Valid(); !got { + if got := (&hst.FilesystemConfigJSON{FilesystemConfig: &hst.FSBind{Source: m("/etc")}}).Valid(); !got { t.Errorf("Valid: %v, want true", got) } }) @@ -207,7 +207,7 @@ type stubFS struct { } func (s stubFS) Valid() bool { return false } -func (s stubFS) Target() *container.Absolute { panic("unreachable") } +func (s stubFS) Path() *container.Absolute { panic("unreachable") } func (s stubFS) Host() []*container.Absolute { panic("unreachable") } func (s stubFS) Apply(*container.Ops) { panic("unreachable") } func (s stubFS) String() string { return "<invalid " + s.typeName + ">" } @@ -218,13 +218,13 @@ type sCheck struct { } type fsTestCase struct { - name string - fs hst.FilesystemConfig - valid bool - ops container.Ops - target *container.Absolute - host []*container.Absolute - str string + name string + fs hst.FilesystemConfig + valid bool + ops container.Ops + path *container.Absolute + host []*container.Absolute + str string } func checkFs(t *testing.T, testCases []fsTestCase) { @@ -252,9 +252,9 @@ func checkFs(t *testing.T, testCases []fsTestCase) { } }) - t.Run("target", func(t *testing.T) { - if got := tc.fs.Target(); !reflect.DeepEqual(got, tc.target) { - t.Errorf("Target: %q, want %q", got, tc.target) + t.Run("path", func(t *testing.T) { + if got := tc.fs.Path(); !reflect.DeepEqual(got, tc.path) { + t.Errorf("Target: %q, want %q", got, tc.path) } }) |
