[hyper-provider] update hypercli in vendor

This commit is contained in:
Jimmy Xu
2017-12-22 00:30:03 +08:00
parent 1b3d6eae82
commit a6a6267863
200 changed files with 451 additions and 675 deletions

View File

@@ -1,8 +1,8 @@
package main
import (
"os"
"fmt"
"os"
"testing"
"github.com/docker/docker/pkg/reexec"
@@ -13,7 +13,7 @@ func Test(t *testing.T) {
reexec.Init() // This is required for external graphdriver tests
if !isLocalDaemon {
fmt.Printf("INFO: Testing against a remote daemon(%v)\n",os.Getenv("DOCKER_HOST"))
fmt.Printf("INFO: Testing against a remote daemon(%v)\n", os.Getenv("DOCKER_HOST"))
} else {
fmt.Println("INFO: Testing against a local daemon")
}

View File

@@ -40,9 +40,9 @@ func newDockerHubPullSuite() *DockerHubPullSuite {
// SetUpSuite starts the suite daemon.
func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
/*
testRequires(c, DaemonIsLinux)
err := s.d.Start()
c.Assert(err, checker.IsNil, check.Commentf("starting push/pull test daemon: %v", err))
testRequires(c, DaemonIsLinux)
err := s.d.Start()
c.Assert(err, checker.IsNil, check.Commentf("starting push/pull test daemon: %v", err))
*/
}

View File

@@ -31,11 +31,11 @@ import (
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringutils"
HyperCli "github.com/docker/engine-api/client"
"github.com/docker/engine-api/types"
"github.com/docker/go-connections/sockets"
"github.com/docker/go-connections/tlsconfig"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/signature"
"github.com/hyperhq/hyper-api/types"
"github.com/hyperhq/hypercli/cliconfig"
)
@@ -642,7 +642,7 @@ func newRequestClient(method, endpoint string, data io.Reader, ct string) (*http
region = cliconfig.DefaultHyperRegion
}
//calculate sign4 for apirouter
req = HyperCli.Sign4(os.Getenv("ACCESS_KEY"), os.Getenv("SECRET_KEY"), req, region)
req = signature.Sign4(os.Getenv("ACCESS_KEY"), os.Getenv("SECRET_KEY"), req, region)
//for debug
if endpoint == debugEndpoint {
@@ -1771,7 +1771,7 @@ func appendBaseEnv(env []string) []string {
preserveList := []string{
// preserve remote test host
"DOCKER_HOST",
"HYPER_CONFIG",
// windows: requires preserving SystemRoot, otherwise dial tcp fails
// with "GetAddrInfoW: A non-recoverable error occurred during a database lookup."
"SystemRoot",

View File

@@ -1,18 +1,19 @@
package main
import (
"time"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
"strings"
"time"
)
func (s *DockerSuite) TestCliLoadFromUrlLargeImageArchiveFile(c *check.C) {
printTestCaseName(); defer printTestDuration(time.Now())
printTestCaseName()
defer printTestDuration(time.Now())
testRequires(c, DaemonIsLinux)
imageName := "consol/centos-xfce-vnc";
imageUrl := "http://image-tarball.s3.amazonaws.com/test/public/consol_centos-xfce-vnc.tar"; //1.53GB
imageName := "consol/centos-xfce-vnc"
imageUrl := "http://image-tarball.s3.amazonaws.com/test/public/consol_centos-xfce-vnc.tar" //1.53GB
output, exitCode, err := dockerCmdWithError("load", "-i", imageUrl)
c.Assert(output, checker.Contains, "Starting to download and load the image archive, please wait...\n")

View File

@@ -1,10 +1,10 @@
package main
import (
"time"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
"strings"
"time"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
@@ -13,14 +13,14 @@ import (
)
func (s *DockerSuite) TestCliLoadFromUrlLegacyImageArchiveFileWithQuota(c *check.C) {
printTestCaseName(); defer printTestDuration(time.Now())
printTestCaseName()
defer printTestDuration(time.Now())
testRequires(c, DaemonIsLinux)
imageName := "ubuntu";
imageName := "ubuntu"
legacyImageUrl := "http://image-tarball.s3.amazonaws.com/test/public/old/ubuntu_1.8.tar.gz"
imageUrl := "http://image-tarball.s3.amazonaws.com/test/public/ubuntu.tar.gz"
/////////////////////////////////////////////////////////////////////
checkImageQuota(c, 2)
//load legacy image(saved by docker 1.8)
@@ -34,7 +34,6 @@ func (s *DockerSuite) TestCliLoadFromUrlLegacyImageArchiveFileWithQuota(c *check
c.Assert(output, checker.Contains, imageName)
c.Assert(len(strings.Split(output, "\n")), checker.Equals, 3)
/////////////////////////////////////////////////////////////////////
checkImageQuota(c, 1)
//load new format image(saved by docker 1.10)
@@ -48,7 +47,6 @@ func (s *DockerSuite) TestCliLoadFromUrlLegacyImageArchiveFileWithQuota(c *check
c.Assert(output, checker.Contains, imageName)
c.Assert(len(strings.Split(output, "\n")), checker.Equals, 3)
/////////////////////////////////////////////////////////////////////
checkImageQuota(c, 1)
//delete single layer
@@ -71,7 +69,6 @@ func (s *DockerSuite) TestCliLoadFromUrlLegacyImageArchiveFileWithQuota(c *check
c.Assert(output, checker.Contains, "<none>")
c.Assert(len(strings.Split(output, "\n")), checker.Equals, 6)
/////////////////////////////////////////////////////////////////////
checkImageQuota(c, 1)
//delete all rest layer
@@ -91,7 +88,6 @@ func (s *DockerSuite) TestCliLoadFromUrlLegacyImageArchiveFileWithQuota(c *check
c.Assert(len(strings.Split(output, "\n")), checker.Equals, 2)
}
//func (s *DockerSuite) TestCliLoadFromUrlLegacyCheckImageQuota(c *check.C) {
// printTestCaseName(); defer printTestDuration(time.Now())
// testRequires(c, DaemonIsLinux)
@@ -113,14 +109,13 @@ func checkImageQuota(c *check.C, expected int) {
Images int `bson:"images"`
}
type Resourceinfo struct {
Total Total `bson:"total"`
Total Total `bson:"total"`
Balance Balance `bson:"balance"`
}
type Tenant struct {
Resourceinfo Resourceinfo `bson:"resourceinfo"`
}
///////////////////////////////////////////
//init connection to mongodb
session, err := mgo.Dial(os.Getenv("MONGODB_URL"))
@@ -144,7 +139,6 @@ func checkImageQuota(c *check.C, expected int) {
c.Assert(resultCred.TenantId, checker.NotNil)
tenantId := resultCred.TenantId
///////////////////////////////////////////
// query image quota by tenant
collection = db.C("tenant")

View File

@@ -63,4 +63,4 @@ func (s *DockerSuite) TestCliLoadFromLocalTarSize600MB(c *check.C) {
//check image
images, _ = dockerCmd(c, "images", "jenkins:latest")
c.Assert(images, checker.Contains, "jenkins")
}
}

View File

@@ -1,12 +1,12 @@
package main
import (
"time"
"os"
"os/exec"
"time"
"github.com/go-check/check"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
)
func (s *DockerSuite) TestCliRegionBasic(c *check.C) {
@@ -16,7 +16,7 @@ func (s *DockerSuite) TestCliRegionBasic(c *check.C) {
var (
defaultRegion = os.Getenv("REGION")
anotherRegion = ""
err error
err error
)
switch defaultRegion {
case "":

View File

@@ -7,8 +7,8 @@ import (
"strings"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestApiImagesFilter(c *check.C) {

View File

@@ -3,8 +3,8 @@ package main
import (
"net/http"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestApiVolumeInit(c *check.C) {

View File

@@ -27,8 +27,8 @@ func (s *DockerSuite) TestApiImagesLoad(c *check.C) {
defer printTestDuration(time.Now())
postData := map[string]interface{}{
"fromSrc": "http://image-tarball.s3.amazonaws.com/test/public/helloworld.tar.gz",
"quiet": false,
"fromSrc": "http://image-tarball.s3.amazonaws.com/test/public/helloworld.tar.gz",
"quiet": false,
}
//debugEndpoint = "/images/load"

View File

@@ -5,8 +5,8 @@ import (
"net/http"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestApiSnapshotsCreate(c *check.C) {
@@ -16,7 +16,7 @@ func (s *DockerSuite) TestApiSnapshotsCreate(c *check.C) {
c.Assert(err, check.IsNil)
c.Assert(status, check.Equals, http.StatusCreated, check.Commentf(string(b)))
var snap types.Snapshot
var snap types.Snapshot
err = json.Unmarshal(b, &snap)
c.Assert(err, checker.IsNil)
}

View File

@@ -11,8 +11,8 @@ import (
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/pkg/version"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors rx_packets tx_bytes tx_dropped tx_errors tx_packets", " ")
@@ -42,7 +42,6 @@ func (s *DockerSuite) TestApiStatsNoStreamGetCpu(c *check.C) {
c.Assert(cpuPercent, check.Not(checker.Equals), 0.0, check.Commentf("docker stats with no-stream get cpu usage failed: was %v", cpuPercent))
}
func (s *DockerSuite) TestApiStatsNetworkStats(c *check.C) {
testRequires(c, SameHostDaemon)
testRequires(c, DaemonIsLinux)

View File

@@ -2,19 +2,19 @@ package main
import (
"encoding/json"
"fmt"
"net/http"
"time"
"fmt"
"time"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestApiGetVersion(c *check.C) {
printTestCaseName()
defer printTestDuration(time.Now())
printTestCaseName()
defer printTestDuration(time.Now())
status, body, err := sockRequest("GET", "/version", nil)
c.Assert(status, checker.Equals, http.StatusOK)
c.Assert(err, checker.IsNil)
@@ -27,17 +27,17 @@ func (s *DockerSuite) TestApiGetVersion(c *check.C) {
}
func (s *DockerSuite) TestApiSimpleCreate(c *check.C) {
config := map[string]interface{}{
"Image": "busybox",
"Cmd": []string{"/bin/sh"},
}
status, b, err := sockRequest("POST", "/containers/create", config)
c.Assert(err, checker.IsNil)
type createResp struct {
ID string
Warning string
}
//var container createResp
fmt.Println(string(b))
c.Assert(status, checker.Equals, http.StatusCreated)
config := map[string]interface{}{
"Image": "busybox",
"Cmd": []string{"/bin/sh"},
}
status, b, err := sockRequest("POST", "/containers/create", config)
c.Assert(err, checker.IsNil)
type createResp struct {
ID string
Warning string
}
//var container createResp
fmt.Println(string(b))
c.Assert(status, checker.Equals, http.StatusCreated)
}

View File

@@ -5,8 +5,8 @@ import (
"net/http"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestApiVolumesList(c *check.C) {
@@ -25,7 +25,7 @@ func (s *DockerSuite) TestApiVolumesList(c *check.C) {
func (s *DockerSuite) TestApiVolumesCreate(c *check.C) {
config := types.VolumeCreateRequest{
Name: "test",
Name: "test",
Driver: "hyper",
}
status, b, err := sockRequest("POST", "/volumes/create", config)
@@ -64,7 +64,7 @@ func (s *DockerSuite) TestApiVolumesRemove(c *check.C) {
func (s *DockerSuite) TestApiVolumesInspect(c *check.C) {
config := types.VolumeCreateRequest{
Name: "test",
Name: "test",
Driver: "hyper",
}
status, b, err := sockRequest("POST", "/volumes/create", config)

View File

@@ -1,10 +1,10 @@
package main
import (
"path/filepath"
"os"
"path/filepath"
"time"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
"github.com/hyperhq/hypercli/cliconfig"
@@ -16,7 +16,7 @@ func (s *DockerSuite) TestCliConfigAndRewrite(c *check.C) {
printTestCaseName()
defer printTestDuration(time.Now())
cmd := exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", "xx", "--secretkey", "xxxx", "tcp://127.0.0.1:6443")
cmd := exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", "xx", "--secretkey", "xxxx", "tcp://127.0.0.1:6443")
out, _, _, err := runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
@@ -27,8 +27,7 @@ func (s *DockerSuite) TestCliConfigAndRewrite(c *check.C) {
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].AccessKey, checker.Equals, "xx", check.Commentf("Should get xx, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].AccessKey))
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey, checker.Equals, "xxxx", check.Commentf("Should get xxxx, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey))
cmd = exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", "yy", "--secretkey", "yyyy", "tcp://127.0.0.1:6443")
cmd = exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", "yy", "--secretkey", "yyyy", "tcp://127.0.0.1:6443")
out, _, _, err = runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
@@ -39,12 +38,12 @@ func (s *DockerSuite) TestCliConfigAndRewrite(c *check.C) {
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey, checker.Equals, "yyyy", check.Commentf("Should get yyyy, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey))
//patch
cmd = exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"), os.Getenv("DOCKER_HOST"))
cmd = exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"), os.Getenv("DOCKER_HOST"))
out, _, _, err = runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
cmd = exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"))
cmd = exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"))
out, _, _, err = runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
@@ -54,8 +53,7 @@ func (s *DockerSuite) TestCliConfigMultiHostBasic(c *check.C) {
printTestCaseName()
defer printTestDuration(time.Now())
cmd := exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", "xx", "--secretkey", "xxxx", "tcp://127.0.0.1:6443")
cmd := exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", "xx", "--secretkey", "xxxx", "tcp://127.0.0.1:6443")
out, _, _, err := runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
@@ -66,7 +64,7 @@ func (s *DockerSuite) TestCliConfigMultiHostBasic(c *check.C) {
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].AccessKey, checker.Equals, "xx", check.Commentf("Should get xx, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].AccessKey))
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey, checker.Equals, "xxxx", check.Commentf("Should get xxxx, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6443"].SecretKey))
cmd = exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", "yy", "--secretkey", "yyyy", "tcp://127.0.0.1:6444")
cmd = exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", "yy", "--secretkey", "yyyy", "tcp://127.0.0.1:6444")
out, _, _, err = runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
@@ -77,12 +75,12 @@ func (s *DockerSuite) TestCliConfigMultiHostBasic(c *check.C) {
c.Assert(conf.CloudConfig["tcp://127.0.0.1:6444"].SecretKey, checker.Equals, "yyyy", check.Commentf("Should get yyyy, but get %s\n", conf.CloudConfig["tcp://127.0.0.1:6444"].SecretKey))
//patch
cmd = exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"), os.Getenv("DOCKER_HOST"))
cmd = exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"), os.Getenv("DOCKER_HOST"))
out, _, _, err = runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")
cmd = exec.Command(dockerBinary, "config", "--default-region" , os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"))
cmd = exec.Command(dockerBinary, "config", "--default-region", os.Getenv("REGION"), "--accesskey", os.Getenv("ACCESS_KEY"), "--secretkey", os.Getenv("SECRET_KEY"))
out, _, _, err = runCommandWithStdoutStderr(cmd)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "WARNING: Your login credentials has been saved in "+homedir.Get()+"/.hyper/config.json")

View File

@@ -176,7 +176,7 @@ func (s *DockerTrustSuite) TestCliCreateTrustedCreate(c *check.C) {
repoName := s.setupTrustedImage(c, "trusted-create")
// Try create
createCmd := exec.Command(dockerBinary, "create", repoName)
createCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", repoName)
s.trustedCmd(createCmd)
out, _, err := runCommandWithOutput(createCmd)
c.Assert(err, check.IsNil)
@@ -185,7 +185,7 @@ func (s *DockerTrustSuite) TestCliCreateTrustedCreate(c *check.C) {
dockerCmd(c, "rmi", repoName)
// Try untrusted create to ensure we pushed the tag to the registry
createCmd = exec.Command(dockerBinary, "create", "--disable-content-trust=true", repoName)
createCmd = exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", "--disable-content-trust=true", repoName)
s.trustedCmd(createCmd)
out, _, err = runCommandWithOutput(createCmd)
c.Assert(err, check.IsNil)
@@ -203,7 +203,7 @@ func (s *DockerTrustSuite) TestCliCreateUntrustedCreate(c *check.C) {
dockerCmd(c, "rmi", withTagName)
// Try trusted create on untrusted tag
createCmd := exec.Command(dockerBinary, "create", withTagName)
createCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", withTagName)
s.trustedCmd(createCmd)
out, _, err := runCommandWithOutput(createCmd)
c.Assert(err, check.Not(check.IsNil))
@@ -216,7 +216,7 @@ func (s *DockerTrustSuite) TestCliCreateTrustedIsolatedCreate(c *check.C) {
repoName := s.setupTrustedImage(c, "trusted-isolated-create")
// Try create
createCmd := exec.Command(dockerBinary, "--config", "/tmp/docker-isolated-create", "create", repoName)
createCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "--config", "/tmp/docker-isolated-create", "create", repoName)
s.trustedCmd(createCmd)
out, _, err := runCommandWithOutput(createCmd)
c.Assert(err, check.IsNil)
@@ -235,7 +235,7 @@ func (s *DockerTrustSuite) TestCliCreateWhenCertExpired(c *check.C) {
runAtDifferentDate(elevenYearsFromNow, func() {
// Try create
createCmd := exec.Command(dockerBinary, "create", repoName)
createCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", repoName)
s.trustedCmd(createCmd)
out, _, err := runCommandWithOutput(createCmd)
c.Assert(err, check.Not(check.IsNil))
@@ -244,7 +244,7 @@ func (s *DockerTrustSuite) TestCliCreateWhenCertExpired(c *check.C) {
runAtDifferentDate(elevenYearsFromNow, func() {
// Try create
createCmd := exec.Command(dockerBinary, "create", "--disable-content-trust", repoName)
createCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", "--disable-content-trust", repoName)
s.trustedCmd(createCmd)
out, _, err := runCommandWithOutput(createCmd)
c.Assert(err, check.Not(check.IsNil))
@@ -262,7 +262,7 @@ func (s *DockerTrustSuite) TestCliCreateTrustedCreateFromBadTrustServer(c *check
// tag the image and upload it to the private registry
dockerCmd(c, "tag", "busybox", repoName)
pushCmd := exec.Command(dockerBinary, "push", repoName)
pushCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "push", repoName)
s.trustedCmd(pushCmd)
out, _, err := runCommandWithOutput(pushCmd)
c.Assert(err, check.IsNil)
@@ -271,7 +271,7 @@ func (s *DockerTrustSuite) TestCliCreateTrustedCreateFromBadTrustServer(c *check
dockerCmd(c, "rmi", repoName)
// Try create
createCmd := exec.Command(dockerBinary, "create", repoName)
createCmd := exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", repoName)
s.trustedCmd(createCmd)
out, _, err = runCommandWithOutput(createCmd)
c.Assert(err, check.IsNil)
@@ -289,14 +289,14 @@ func (s *DockerTrustSuite) TestCliCreateTrustedCreateFromBadTrustServer(c *check
dockerCmd(c, "--config", evilLocalConfigDir, "tag", "busybox", repoName)
// Push up to the new server
pushCmd = exec.Command(dockerBinary, "--config", evilLocalConfigDir, "push", repoName)
pushCmd = exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "--config", evilLocalConfigDir, "push", repoName)
s.trustedCmd(pushCmd)
out, _, err = runCommandWithOutput(pushCmd)
c.Assert(err, check.IsNil)
c.Assert(string(out), checker.Contains, "Signing and pushing trust metadata", check.Commentf("Missing expected output on trusted push:\n%s", out))
// Now, try creating with the original client from this new trust server. This should fail.
createCmd = exec.Command(dockerBinary, "create", repoName)
createCmd = exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "create", repoName)
s.trustedCmd(createCmd)
out, _, err = runCommandWithOutput(createCmd)
c.Assert(err, check.Not(check.IsNil))

View File

@@ -45,7 +45,7 @@ func (s *DockerSuite) TestCliExecInteractiveStdinClose(c *check.C) {
}
}
func (s *DockerSuite) TestCliExecTTY(c *check.C) {
func (s *DockerSuite) TestCliExecTTYBasic(c *check.C) {
printTestCaseName()
defer printTestDuration(time.Now())

View File

@@ -4,8 +4,8 @@ import (
"time"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestCliInspectNamedMountPointBasic(c *check.C) {

View File

@@ -8,8 +8,8 @@ import (
"time"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types/container"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types/container"
)
func checkValidGraphDriver(c *check.C, name string) {

View File

@@ -1,6 +1,7 @@
package main
import (
"os"
"os/exec"
"strings"
"time"
@@ -35,7 +36,7 @@ func (s *DockerSuite) TestCliSnapshotInspect(c *check.C) {
testRequires(c, DaemonIsLinux)
c.Assert(
exec.Command(dockerBinary, "snapshot", "inspect", "doesntexist").Run(),
exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "snapshot", "inspect", "doesntexist").Run(),
check.Not(check.IsNil),
check.Commentf("snapshot inspect should error on non-existent volume"),
)
@@ -149,12 +150,12 @@ func (s *DockerSuite) TestCliSnapshotNoArgs(c *check.C) {
c.Assert(out, checker.Contains, usage)
// invalid arg should error and show the command on stderr
_, stderr, _, err := runCommandWithStdoutStderr(exec.Command(dockerBinary, "snapshot", "somearg"))
_, stderr, _, err := runCommandWithStdoutStderr(exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "snapshot", "somearg"))
c.Assert(err, check.NotNil, check.Commentf(stderr))
c.Assert(stderr, checker.Contains, usage)
// invalid flag should error and show the flag error and cmd usage
_, stderr, _, err = runCommandWithStdoutStderr(exec.Command(dockerBinary, "snapshot", "--no-such-flag"))
_, stderr, _, err = runCommandWithStdoutStderr(exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "snapshot", "--no-such-flag"))
c.Assert(err, check.NotNil, check.Commentf(stderr))
c.Assert(stderr, checker.Contains, usage)
c.Assert(stderr, checker.Contains, "flag provided but not defined: --no-such-flag")

View File

@@ -1,6 +1,7 @@
package main
import (
"os"
"os/exec"
"strings"
"time"
@@ -14,7 +15,7 @@ func (s *DockerSuite) TestCliVolumeCreate(c *check.C) {
defer printTestDuration(time.Now())
dockerCmd(c, "volume", "create")
_, err := runCommand(exec.Command(dockerBinary, "volume", "create", "-d", "nosuchdriver"))
_, err := runCommand(exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "volume", "create", "-d", "nosuchdriver"))
c.Assert(err, check.Not(check.IsNil))
out, _ := dockerCmd(c, "volume", "create", "--name=test")
@@ -27,7 +28,7 @@ func (s *DockerSuite) TestCliVolumeInspect(c *check.C) {
defer printTestDuration(time.Now())
c.Assert(
exec.Command(dockerBinary, "volume", "inspect", "doesntexist").Run(),
exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "volume", "inspect", "doesntexist").Run(),
check.Not(check.IsNil),
check.Commentf("volume inspect should error on non-existent volume"),
)
@@ -153,7 +154,7 @@ func (s *DockerSuite) TestCliVolumeRmBasic(c *check.C) {
volumeID := "testing"
dockerCmd(c, "run", "-v", volumeID+":"+prefix+"/foo", "--name=test", "busybox", "sh", "-c", "echo hello > /foo/bar")
out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "volume", "rm", "testing"))
out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "volume", "rm", "testing"))
c.Assert(
err,
check.Not(check.IsNil),
@@ -193,12 +194,12 @@ func (s *DockerSuite) TestCliVolumeNoArgs(c *check.C) {
c.Assert(out, checker.Contains, usage)
// invalid arg should error and show the command usage on stderr
_, stderr, _, err := runCommandWithStdoutStderr(exec.Command(dockerBinary, "volume", "somearg"))
_, stderr, _, err := runCommandWithStdoutStderr(exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "volume", "somearg"))
c.Assert(err, check.NotNil, check.Commentf(stderr))
c.Assert(stderr, checker.Contains, usage)
// invalid flag should error and show the flag error and cmd usage
_, stderr, _, err = runCommandWithStdoutStderr(exec.Command(dockerBinary, "volume", "--no-such-flag"))
_, stderr, _, err = runCommandWithStdoutStderr(exec.Command(dockerBinary, "--region", os.Getenv("DOCKER_HOST"), "volume", "--no-such-flag"))
c.Assert(err, check.NotNil, check.Commentf(stderr))
c.Assert(stderr, checker.Contains, usage)
c.Assert(stderr, checker.Contains, "flag provided but not defined: --no-such-flag")

View File

@@ -15,7 +15,6 @@ import (
const attachWait = 5 * time.Second
//FIXME: attach initialize unproperly? and return empty string?
func (s *DockerSuite) TestAttachMultipleAndRestart(c *check.C) {
testRequires(c, DaemonIsLinux)
@@ -155,4 +154,4 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
// Expect container to still be running after stdin is closed
running := inspectField(c, id, "State.Running")
c.Assert(running, check.Equals, "true")
}
}

View File

@@ -6,7 +6,7 @@ import (
//"bufio"
"os/exec"
//"strings"
"time"
"time"
//"fmt"
"github.com/docker/docker/pkg/integration/checker"
@@ -84,6 +84,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) {
c.Assert(string(bytes[:nBytes]), checker.Contains, "/ #")
}
/*
//FIXME:#issue77
// TestAttachDetach checks that attach in tty mode can be detached using the long container ID
@@ -194,4 +195,4 @@ func (s *DockerSuite) TestAttachDetachTruncatedID(c *check.C) {
}
}
*/
*/

View File

@@ -12,7 +12,6 @@ import (
"github.com/go-check/check"
)
// regression gh14320
func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *check.C) {
status, body, err := sockRequest("POST", "/containers/doesnotexist/attach", nil)

View File

@@ -10,8 +10,8 @@ import (
"time"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {

View File

@@ -96,7 +96,6 @@ func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
}
}
// NEED TO BE FIXED
func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
// Windows does not support stats

View File

@@ -9,10 +9,10 @@ import (
"strings"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/filters"
"github.com/docker/engine-api/types/network"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
"github.com/hyperhq/hyper-api/types/filters"
"github.com/hyperhq/hyper-api/types/network"
)
func (s *DockerSuite) TestApiNetworkGetDefaults(c *check.C) {

View File

@@ -13,8 +13,8 @@ import (
"github.com/docker/distribution/manifest/schema2"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/pkg/stringutils"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
var (

View File

@@ -16,14 +16,14 @@ import (
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/docker/runconfig"
"github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/versions/v1p20"
"github.com/docker/libnetwork/driverapi"
remoteapi "github.com/docker/libnetwork/drivers/remote/api"
"github.com/docker/libnetwork/ipamapi"
remoteipam "github.com/docker/libnetwork/ipams/remote/api"
"github.com/docker/libnetwork/netlabel"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
"github.com/hyperhq/hyper-api/types/versions/v1p20"
"github.com/vishvananda/netlink"
)

View File

@@ -8,8 +8,8 @@ import (
"strings"
"github.com/docker/docker/pkg/integration/checker"
"github.com/docker/engine-api/types"
"github.com/go-check/check"
"github.com/hyperhq/hyper-api/types"
)
func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) {