Merge pull request #11392 from dinever/fix-docker-version-test

Fix TestCheckDockerVersion on macOS
pull/11405/head
Medya Ghazizadeh 2021-05-13 11:44:31 -07:00 committed by GitHub
commit c97984a4b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -20,6 +20,8 @@ import (
"fmt"
"strings"
"testing"
"k8s.io/minikube/pkg/minikube/driver"
)
type testCase struct {
@ -88,22 +90,22 @@ func TestCheckDockerVersion(t *testing.T) {
// "dev" is set when Docker (Moby) was installed with `make binary && make install`
version: "linux-dev",
expect: "",
expectFixContains: fmt.Sprintf("Install the official release of Docker (Minimum recommended version is %02d.%02d.%d, current version is dev)",
minDockerVersion[0], minDockerVersion[1], minDockerVersion[2]),
expectFixContains: fmt.Sprintf("Install the official release of %s (Minimum recommended version is %02d.%02d.%d, current version is dev)",
driver.FullName(driver.Docker), minDockerVersion[0], minDockerVersion[1], minDockerVersion[2]),
},
{
// "library-import" is set when Docker (Moby) was installed with `go build github.com/docker/docker/cmd/dockerd` (unrecommended, but valid)
version: "linux-library-import",
expect: "",
expectFixContains: fmt.Sprintf("Install the official release of Docker (Minimum recommended version is %02d.%02d.%d, current version is library-import)",
minDockerVersion[0], minDockerVersion[1], minDockerVersion[2]),
expectFixContains: fmt.Sprintf("Install the official release of %s (Minimum recommended version is %02d.%02d.%d, current version is library-import)",
driver.FullName(driver.Docker), minDockerVersion[0], minDockerVersion[1], minDockerVersion[2]),
},
{
// "foo.bar.baz" is a triplet that cannot be parsed as "%02d.%02d.%d"
version: "linux-foo.bar.baz",
expect: "",
expectFixContains: fmt.Sprintf("Install the official release of Docker (Minimum recommended version is %02d.%02d.%d, current version is foo.bar.baz)",
minDockerVersion[0], minDockerVersion[1], minDockerVersion[2]),
expectFixContains: fmt.Sprintf("Install the official release of %s (Minimum recommended version is %02d.%02d.%d, current version is foo.bar.baz)",
driver.FullName(driver.Docker), minDockerVersion[0], minDockerVersion[1], minDockerVersion[2]),
},
}...)