MCPcopy
hub / github.com/moby/moby / validateArgs

Function validateArgs

integration-cli/cli/cli.go:114–128  ·  view source on GitHub ↗

validateArgs is a checker to ensure tests are not running commands which are not supported on platforms. Specifically on Windows this is 'busybox top'.

(args ...string)

Source from the content-addressed store, hash-verified

112// validateArgs is a checker to ensure tests are not running commands which are
113// not supported on platforms. Specifically on Windows this is 'busybox top'.
114func validateArgs(args ...string) error {
115 if testEnv.DaemonInfo.OSType != "windows" {
116 return nil
117 }
118 foundBusybox := -1
119 for key, value := range args {
120 if strings.ToLower(value) == "busybox" {
121 foundBusybox = key
122 }
123 if (foundBusybox != -1) && (key == foundBusybox+1) && (strings.ToLower(value) == "top") {
124 return errors.New("cannot use 'busybox top' in tests on Windows. Use runSleepingContainer()")
125 }
126 }
127 return nil
128}
129
130// Format sets the specified format with --format flag
131func Format(format string) func(*icmd.Cmd) func() {

Callers 1

DockerFunction · 0.85

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…