Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit b6dc8e5

Browse files
committed
[integration-test] 1.fix some test case 2.support automated build docker image 'hyperhq/hypercli-auto-test'
1 parent dcd89cb commit b6dc8e5

File tree

8 files changed

+30
-13
lines changed

8 files changed

+30
-13
lines changed

Dockerfile.centos

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ENTRYPOINT ["hack/generate-hyper-conf.sh"]
4949
# install on-my-zsh
5050
RUN yum install -y zsh
5151
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
52-
RUN sed -i "s/^ZSH_THEME=.*/ZSH_THEME=agnoster/g" /root/.zshrc
52+
RUN sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"gianu\"/g" /root/.zshrc
5353
RUN echo alias hypercli=\"hyper -H \${DOCKER_HOST}\" >> /root/.zshrc
5454

5555
# config git
@@ -66,4 +66,3 @@ RUN git config --global color.ui true; \
6666
git config --global alias.cm '!sh -c "br_name=`git symbolic-ref HEAD|sed s#refs/heads/##`; git commit -em \"[\${br_name}] \""'; \
6767
git config --global alias.lg "log --graph --pretty=format:'[%ci] %Cgreen(%cr) %Cred%h%Creset -%x09%C(yellow)%Creset %C(cyan)[%an]%Creset %x09 %s%Creset' --abbrev-commit --date=short"; \
6868
git config --global push.default current
69-

integration-cli/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ $ ./util.sh test all
244244
$ ./util.sh test all -timout 20m
245245
246246
// run specified test case
247-
$ ./util.sh test -check.f ^TestLoadFromLocalTar$
247+
$ ./util.sh test -check.f ^TestCliLoadFromLocalTar$
248248
249249
// run test cases start with specified prefix
250-
$ ./util.sh test -check.f TestLoadFromLocalTar
250+
$ ./util.sh test -check.f TestCliLoadFromLocalTar
251251
252252
// combined use
253-
$ ./util.sh test -check.f 'TestLoadFromLocalTarEmpty|TestLoadFromLocalPullAndLoad' -timeout 20m
253+
$ ./util.sh test -check.f 'TestCliLoadFromLocalTarEmpty|TestCliLoadFromLocalPullAndLoad' -timeout 20m
254254
```

integration-cli/docker_utils.go

100644100755
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,14 @@ func getInspectBody(c *check.C, version, id string) []byte {
18541854
return body
18551855
}
18561856

1857+
func getInspectBodyWithoutVersion(c *check.C, id string) []byte {
1858+
endpoint := fmt.Sprintf("/containers/%s/json", id)
1859+
status, body, err := sockRequest("GET", endpoint, nil)
1860+
c.Assert(err, check.IsNil)
1861+
c.Assert(status, check.Equals, http.StatusOK)
1862+
return body
1863+
}
1864+
18571865
// Run a long running idle task in a background container using the
18581866
// system-specific default image and command.
18591867
func runSleepingContainer(c *check.C, extraArgs ...string) (string, int) {

integration-cli/hyper_api_create_test.go

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ package main
33
import (
44
"net/http"
55
"strings"
6+
"time"
67

78
"github.com/docker/docker/pkg/integration/checker"
89
"github.com/go-check/check"
910
)
1011

1112
func (s *DockerSuite) TestApiCreateWithNotExistImage(c *check.C) {
13+
printTestCaseName()
14+
defer printTestDuration(time.Now())
15+
1216
name := "test"
1317
config := map[string]interface{}{
1418
"Image": "test456:v1",

integration-cli/hyper_api_exec_test.go renamed to integration-cli/hyper_api_exec_basic_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
// Regression test for #9414
18-
func (s *DockerSuite) TestApiExecCreateNoCmd(c *check.C) {
18+
func (s *DockerSuite) TestApiExecBasicCreateNoCmd(c *check.C) {
1919
printTestCaseName()
2020
defer printTestDuration(time.Now())
2121

@@ -30,7 +30,7 @@ func (s *DockerSuite) TestApiExecCreateNoCmd(c *check.C) {
3030
c.Assert(string(body), checker.Contains, "No exec command specified", comment)
3131
}
3232

33-
func (s *DockerSuite) TestApiExecCreateNoValidContentType(c *check.C) {
33+
func (s *DockerSuite) TestApiExecBasicCreateNoValidContentType(c *check.C) {
3434
printTestCaseName()
3535
defer printTestDuration(time.Now())
3636

@@ -54,7 +54,7 @@ func (s *DockerSuite) TestApiExecCreateNoValidContentType(c *check.C) {
5454
}
5555

5656
//TODO: fix #86
57-
/*func (s *DockerSuite) TestApiExecApiStart(c *check.C) {
57+
/*func (s *DockerSuite) TestApiExecBasicApiStart(c *check.C) {
5858
printTestCaseName()
5959
defer printTestDuration(time.Now())
6060
@@ -73,7 +73,7 @@ func (s *DockerSuite) TestApiExecCreateNoValidContentType(c *check.C) {
7373
startExec(c, id, http.StatusNotFound)
7474
}
7575
76-
func (s *DockerSuite) TestApiExecApiStartMultipleTimesError(c *check.C) {
76+
func (s *DockerSuite) TestApiExecBasicApiStartMultipleTimesError(c *check.C) {
7777
printTestCaseName()
7878
defer printTestDuration(time.Now())
7979

integration-cli/hyper_api_images_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestApiImagesLoad(c *check.C) {
3636
c.Assert(err, check.IsNil)
3737
c.Assert(status, check.Equals, http.StatusOK)
3838

39-
expected := "{\"status\":\"Start to download and load the image archive, please wait...\"}"
39+
expected := "{\"status\":\"Starting to download and load the image archive, please wait...\"}"
4040
c.Assert(strings.TrimSpace(string(resp)), checker.Contains, expected)
4141

4242
expected = "has been loaded.\"}"

integration-cli/hyper_api_inspect_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ package main
33
import (
44
"encoding/json"
55
"strings"
6+
"time"
67

78
"github.com/docker/docker/pkg/integration/checker"
89
"github.com/go-check/check"
910
)
1011

1112
func (s *DockerSuite) TestApiInspectContainerResponse(c *check.C) {
13+
printTestCaseName()
14+
defer printTestDuration(time.Now())
15+
16+
ensureImageExist(c, "busybox")
1217
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
1318

1419
cleanedContainerID := strings.TrimSpace(out)

integration-cli/util.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ EOF
2828
}
2929

3030
#############################################################################
31+
IMAGE_NAME="hyperhq/hypercli-auto-test:latest"
3132
WORKDIR=$(cd `dirname $0`; pwd)
3233
cd ${WORKDIR}
3334

@@ -53,13 +54,13 @@ fi
5354
case $1 in
5455
build)
5556
cd ${WORKDIR}/..
56-
docker build -t hyperhq/hypercli -f Dockerfile.centos .
57+
docker build -t ${IMAGE_NAME} -f Dockerfile.centos .
5758
;;
5859
make)
5960
echo "Start compile hyper client, please wait..."
6061
docker run -it --rm \
6162
-v $(pwd)/../:/go/src/github.com/hyperhq/hypercli \
62-
hyperhq/hypercli ./build.sh
63+
${IMAGE_NAME} ./build.sh
6364
;;
6465
enter)
6566
docker run -it --rm \
@@ -71,7 +72,7 @@ case $1 in
7172
-e URL_WITH_BASIC_AUTH=${URL_WITH_BASIC_AUTH} \
7273
-e MONGODB_URL=${MONGODB_URL} \
7374
-v $(pwd)/../:/go/src/github.com/hyperhq/hypercli \
74-
hyperhq/hypercli bash
75+
${IMAGE_NAME} zsh
7576
;;
7677
test)
7778
export DOCKER_HOST=${HYPER_HOST}

0 commit comments

Comments
 (0)