tests: handle multiple docker versions

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-11-20 00:59:09 +01:00
parent a6ef9db84d
commit a69d857b8a
7 changed files with 81 additions and 12 deletions

View File

@ -95,33 +95,37 @@ func buildxConfig(sb integration.Sandbox) string {
}
func isMobyWorker(sb integration.Sandbox) bool {
name, hasFeature := driverName(sb.Name())
name, _, hasFeature := driverName(sb.Name())
return name == "docker" && !hasFeature
}
func isMobyContainerdSnapWorker(sb integration.Sandbox) bool {
name, hasFeature := driverName(sb.Name())
name, _, hasFeature := driverName(sb.Name())
return name == "docker" && hasFeature
}
func isDockerWorker(sb integration.Sandbox) bool {
name, _ := driverName(sb.Name())
name, _, _ := driverName(sb.Name())
return name == "docker"
}
func isDockerContainerWorker(sb integration.Sandbox) bool {
name, _ := driverName(sb.Name())
name, _, _ := driverName(sb.Name())
return name == "docker-container"
}
func driverName(sbName string) (string, bool) {
func driverName(sbName string) (string, bool, bool) {
name := sbName
var hasFeature bool
var hasVersion, hasFeature bool
if b, _, ok := strings.Cut(sbName, "@"); ok {
name = b
hasVersion = true
}
if b, _, ok := strings.Cut(name, "+"); ok {
name = b
hasFeature = true
}
return name, hasFeature
return name, hasVersion, hasFeature
}
func isExperimental() bool {