Skip to content

Commit

Permalink
test(proxy): mock config readers (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Dec 16, 2023
1 parent 821cb65 commit ea3dc52
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 36 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@
"exportloopref",
"extendio",
"fieldalignment",
"GOARCH",
"goconst",
"gocritic",
"gocyclo",
"gofmt",
"goimports",
"golangci",
"gomega",
"gomnd",
"gomock",
"gosec",
"gosimple",
"goveralls",
"govet",
"graffico",
"ineffassign",
Expand All @@ -41,12 +44,14 @@
"Magick",
"mapstructure",
"mitchellh",
"mockgen",
"mohae",
"nakedret",
"nolint",
"nolintlint",
"nosec",
"onsi",
"outdir",
"Pixa",
"prealloc",
"promptui",
Expand All @@ -63,6 +68,7 @@
"unconvert",
"unparam",
"varcheck",
"watchv",
"wgan",
"xutils"
]
Expand Down
6 changes: 6 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ tasks:
cmds:
- goveralls -repotoken {{.COVERALLS_TOKEN}}

# === go generate ==========================================

co-gen-cfg:
cmds:
- go generate src/app/proxy

# === i18n =================================================

clear:
Expand Down
212 changes: 212 additions & 0 deletions src/app/mocks/mocks-config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions src/app/proxy/config-defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package proxy

import (
"github.com/snivilised/cobrass/src/clif"
)

const (
defaultNoFiles = 3
defaultNoFolders = 3
)

var (
DefaultProfilesConfig *MsProfilesConfig
DefaultSamplerConfig *MsSamplerConfig
)

func init() {
// TODO: these defaults are not real defaults; they are just test
// values that don't mean anything. Update to real useable defaults
//
DefaultProfilesConfig = &MsProfilesConfig{
Profiles: ProfilesConfigMap{
"blur": clif.ChangedFlagsMap{
"strip": "true",
"interlace": "plane",
"gaussian-blur": "0.05",
},
"sf": clif.ChangedFlagsMap{
"dry-run": "true",
"strip": "true",
"interlace": "plane",
"sampling-factor": "4:2:0",
},
"adaptive": clif.ChangedFlagsMap{
"strip": "true",
"interlace": "plane",
"gaussian-blur": "0.25",
"adaptive-resize": "60",
},
},
}

DefaultSamplerConfig = &MsSamplerConfig{
Files: defaultNoFiles,
Folders: defaultNoFolders,
Schemes: MsSamplerSchemesConfig{
"blur-sf": MsSchemeConfig{
Profiles: []string{"blur", "sf"},
},
"adaptive-sf": MsSchemeConfig{
Profiles: []string{"adaptive", "sf"},
},
"adaptive-blur": MsSchemeConfig{
Profiles: []string{"adaptive", "blur"},
},
},
}
}
Loading

0 comments on commit ea3dc52

Please sign in to comment.