(conf test.Config, t tig.T)
| 51 | } |
| 52 | |
| 53 | func newNerdCommand(conf test.Config, t tig.T) *nerdCommand { |
| 54 | // Decide what binary we are running |
| 55 | var err error |
| 56 | var binary string |
| 57 | trgt := getTarget() |
| 58 | |
| 59 | binary, err = exec.LookPath(trgt) |
| 60 | if err != nil { |
| 61 | t.Log(fmt.Sprintf("unable to find binary %q: %v", trgt, err)) |
| 62 | t.FailNow() |
| 63 | } |
| 64 | |
| 65 | if isTargetNerdish() { |
| 66 | // Any target but docker is considered a nerdctl variant, either gomodjail, or homegrown cli based on the |
| 67 | // nerdctl codebase as a library. |
| 68 | // Set the default namespace if we do not have one explicitly set already |
| 69 | if conf.Read(Namespace) == "" { |
| 70 | conf.Write(Namespace, defaultNamespace) |
| 71 | } |
| 72 | } else { |
| 73 | if err = exec.Command(binary, "compose", "version").Run(); err != nil { |
| 74 | t.Log(fmt.Sprintf("docker does not support compose: %v", err)) |
| 75 | t.FailNow() |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | // Create the base command, with the right binary, t |
| 80 | ret := &nerdCommand{ |
| 81 | GenericCommand: *(test.NewGenericCommand().(*test.GenericCommand)), |
| 82 | } |
| 83 | |
| 84 | ret.WithBinary(binary) |
| 85 | ret.WithWhitelist([]string{ |
| 86 | "PATH", |
| 87 | "HOME", |
| 88 | "XDG_*", |
| 89 | // Windows needs ProgramData, AppData, etc |
| 90 | "Program*", |
| 91 | "PROGRAM*", |
| 92 | "APPDATA", |
| 93 | }) |
| 94 | return ret |
| 95 | } |
| 96 | |
| 97 | type nerdCommand struct { |
| 98 | test.GenericCommand |
no test coverage detected
searching dependent graphs…