fix(ooniprobe): use ooniprobe-cli-unattended for unattended runs (#714)
This diff changes the software name used by unattended runs for which we did not override the default software name (`ooniprobe-cli`). It will become `ooniprobe-cli-unattended`. This software name is in line with the one we use for Android, iOS, and desktop unattended runs. While working in this diff, I introduced string constants for the run types and a string constant for the default software name. See https://github.com/ooni/probe/issues/2081.
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/cli/root"
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/nettests"
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/ooni"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -32,7 +33,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
functionalRun := func(runType string, pred func(name string, gr nettests.Group) bool) error {
|
||||
functionalRun := func(runType model.RunType, pred func(name string, gr nettests.Group) bool) error {
|
||||
for name, group := range nettests.All {
|
||||
if !pred(name, group) {
|
||||
continue
|
||||
@@ -52,7 +53,7 @@ func init() {
|
||||
|
||||
genRunWithGroupName := func(targetName string) func(*kingpin.ParseContext) error {
|
||||
return func(*kingpin.ParseContext) error {
|
||||
return functionalRun("manual", func(groupName string, gr nettests.Group) bool {
|
||||
return functionalRun(model.RunTypeManual, func(groupName string, gr nettests.Group) bool {
|
||||
return groupName == targetName
|
||||
})
|
||||
}
|
||||
@@ -68,7 +69,7 @@ func init() {
|
||||
Probe: probe,
|
||||
InputFiles: *inputFile,
|
||||
Inputs: *input,
|
||||
RunType: "manual",
|
||||
RunType: model.RunTypeManual,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -80,14 +81,14 @@ func init() {
|
||||
|
||||
unattendedCmd := cmd.Command("unattended", "")
|
||||
unattendedCmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
return functionalRun("timed", func(name string, gr nettests.Group) bool {
|
||||
return functionalRun(model.RunTypeTimed, func(name string, gr nettests.Group) bool {
|
||||
return gr.UnattendedOK
|
||||
})
|
||||
})
|
||||
|
||||
allCmd := cmd.Command("all", "").Default()
|
||||
allCmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
return functionalRun("manual", func(name string, gr nettests.Group) bool {
|
||||
return functionalRun(model.RunTypeManual, func(name string, gr nettests.Group) bool {
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user