Skip to content

Commit 08131d1

Browse files
committed
v3_5_experimental: add test scenerios
1 parent 4008b9e commit 08131d1

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

config/v3_5_experimental/types/config_test.go

+49-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,54 @@ func TestConfigValidation(t *testing.T) {
183183
out: errors.ErrPathConflictsSystemd,
184184
at: path.New("json", "storage", "links", 0, "path"),
185185
},
186-
// test 6: non-conflicting scenarios
186+
187+
// test 6: file path conflicts with another file path, should error
188+
{
189+
in: Config{
190+
Storage: Storage{
191+
Files: []File{
192+
{Node: Node{Path: "/foo/bar"}},
193+
{Node: Node{Path: "/foo/bar/baz"}},
194+
},
195+
},
196+
},
197+
out: errors.ErrPathConflictsParentDir,
198+
at: path.New("json", "storage", "files", 1, "path"),
199+
},
200+
201+
// test 7: file path conflicts with link path, should error
202+
{
203+
in: Config{
204+
Storage: Storage{
205+
Files: []File{
206+
{Node: Node{Path: "/foo/bar"}},
207+
},
208+
Links: []Link{
209+
{Node: Node{Path: "/foo/bar/baz"}},
210+
},
211+
},
212+
},
213+
out: errors.ErrPathConflictsParentDir,
214+
at: path.New("json", "storage", "links", 0, "path"),
215+
},
216+
217+
// test 8: file path conflicts with directory path, should error
218+
{
219+
in: Config{
220+
Storage: Storage{
221+
Files: []File{
222+
{Node: Node{Path: "/foo/bar"}},
223+
},
224+
Directories: []Directory{
225+
{Node: Node{Path: "/foo/bar/baz"}},
226+
},
227+
},
228+
},
229+
out: errors.ErrPathConflictsParentDir,
230+
at: path.New("json", "storage", "directories", 0, "path"),
231+
},
232+
233+
// test 9: non-conflicting scenarios
187234
{
188235
in: Config{
189236
Storage: Storage{
@@ -249,6 +296,7 @@ func TestConfigValidation(t *testing.T) {
249296
},
250297
},
251298
}
299+
252300
for i, test := range tests {
253301
r := test.in.Validate(path.New("json"))
254302
expected := report.Report{}

0 commit comments

Comments
 (0)