mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-12 14:37:08 +08:00
tests: refactor worker handling in sandbox
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@ -71,7 +71,27 @@ func dockerCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func isDockerWorker(sb integration.Sandbox) bool {
|
||||
sbDriver, _, _ := strings.Cut(sb.Name(), "+")
|
||||
return sbDriver == "docker"
|
||||
func isMobyWorker(sb integration.Sandbox) bool {
|
||||
name, hasFeature := driverName(sb.Name())
|
||||
return name == "docker" && !hasFeature
|
||||
}
|
||||
|
||||
func isDockerWorker(sb integration.Sandbox) bool {
|
||||
name, _ := driverName(sb.Name())
|
||||
return name == "docker"
|
||||
}
|
||||
|
||||
func isDockerContainerWorker(sb integration.Sandbox) bool {
|
||||
name, _ := driverName(sb.Name())
|
||||
return name == "docker-container"
|
||||
}
|
||||
|
||||
func driverName(sbName string) (string, bool) {
|
||||
name := sbName
|
||||
var hasFeature bool
|
||||
if b, _, ok := strings.Cut(name, "+"); ok {
|
||||
name = b
|
||||
hasFeature = true
|
||||
}
|
||||
return name, hasFeature
|
||||
}
|
||||
|
Reference in New Issue
Block a user