Skip to content

Commit

Permalink
feat(opts): unmarshal options (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Oct 8, 2024
1 parent 22cf80f commit 79a395f
Show file tree
Hide file tree
Showing 14 changed files with 1,238 additions and 686 deletions.
8 changes: 6 additions & 2 deletions internal/laboratory/traverse-fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ func (f *TestTraverseFS) MkDirAll(name string, perm os.FileMode) error {
func(acc []string, s string, _ int) []string {
acc = append(acc, s)
path := strings.Join(acc, "/")
f.MapFS[path] = &fstest.MapFile{
Mode: perm | os.ModeDir,

if _, found := f.MapFS[path]; !found {
f.MapFS[path] = &fstest.MapFile{
Mode: perm | os.ModeDir,
}
}

return acc
}, []string{},
)
Expand Down
2 changes: 1 addition & 1 deletion internal/opts/json/sampling-options.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type (

// InReverse determines the direction of iteration for the sampling
// operation
InReverse bool `json:"sample-in-reverse"`
InReverse bool `json:"in-reverse"`

// NoOf specifies number of items required in each sample (only applies
// when not using Custom iterator options)
Expand Down
2 changes: 1 addition & 1 deletion internal/persist/convert-json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = Describe("Convert Options via JSON", Ordered, func() {
},
}

_ = FS.MkDirAll(to, permDir|os.ModeDir)
_ = FS.MkDirAll(destination, perms.Dir|os.ModeDir)
})

Context("ToJSON", func() {
Expand Down
47 changes: 47 additions & 0 deletions internal/persist/data/test-restore.DEFAULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"JO": {
"Behaviours": {
"SubPath": {
"KeepTrailingSep": true
},
"Sort": {
"IsCaseSensitive": false,
"SortFilesFirst": false
},
"Cascade": {
"Depth": 0,
"NoRecurse": false
}
},
"Sampling": {
"sample-type": 0,
"in-reverse": false,
"NoOf": {
"no-of-files": 0,
"no-of-folders": 0
}
},
"Filter": {
"Node": null,
"Child": null,
"Sample": null
},
"Hibernate": {
"WakeAt": null,
"SleepAt": null,
"Behaviour": {
"hibernate-inclusive-wake": true,
"hibernate-inclusive-sleep": false
}
},
"Concurrency": {
"no-of-workers": 8
}
},
"Active": {
"Root": "json/marshal",
"Hibernation": 1,
"CurrentPath": "/top/a/b/c",
"Depth": 3
}
}
Loading

0 comments on commit 79a395f

Please sign in to comment.