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)
| 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'. |
| 114 | func 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 |
| 131 | func Format(format string) func(*icmd.Cmd) func() { |