зеркало из https://github.com/microsoft/docker.git
Windows: Test infrastructure plumbing
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
Родитель
565535073f
Коммит
da44d0fccb
|
@ -28,6 +28,12 @@ var (
|
|||
// isLocalDaemon is true if the daemon under test is on the same
|
||||
// host as the CLI.
|
||||
isLocalDaemon bool
|
||||
|
||||
// daemonPlatform is held globally so that tests can make intelligent
|
||||
// decisions on how to configure themselves according to the platform
|
||||
// of the daemon. This is initialised in docker_utils by sending
|
||||
// a version call to the daemon and examining the response header.
|
||||
daemonPlatform string
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/httputils"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/stringutils"
|
||||
"github.com/go-check/check"
|
||||
|
@ -463,6 +464,20 @@ func init() {
|
|||
protectedImages[imgTag] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain the daemon platform so that it can be used by tests to make
|
||||
// intelligent decisions about how to configure themselves, and validate
|
||||
// that the target platform is valid.
|
||||
res, b, err := sockRequestRaw("GET", "/version", nil, "application/json")
|
||||
defer b.Close()
|
||||
if err != nil || res.StatusCode != http.StatusOK {
|
||||
panic("Init failed to get version: " + err.Error() + " " + string(res.StatusCode))
|
||||
}
|
||||
svrHeader, _ := httputils.ParseServerHeader(res.Header.Get("Server"))
|
||||
daemonPlatform = svrHeader.OS
|
||||
if daemonPlatform != "linux" && daemonPlatform != "windows" {
|
||||
panic("Cannot run tests against platform: " + daemonPlatform)
|
||||
}
|
||||
}
|
||||
|
||||
func deleteAllImages() error {
|
||||
|
|
Загрузка…
Ссылка в новой задаче