Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] API conformance test #977

Closed
2 of 15 tasks
Letty5411 opened this issue Mar 27, 2018 · 1 comment
Closed
2 of 15 tasks

[bug] API conformance test #977

Letty5411 opened this issue Mar 27, 2018 · 1 comment
Labels
areas/test kind/bug This is bug report for project

Comments

@Letty5411
Copy link
Contributor

Letty5411 commented Mar 27, 2018

Ⅰ. Issue Description

Use docker 1.12.6 docker_api_xxx_test.go to test the conformance of pouch API with docker 1.24 api version.

Ⅱ. Describe what happened

  • types/container.go
    ID string json:"ID,omitempty"
    shoulde be Id in json
    fixed in fix: make container ID json name compatible #1002

  • check port valid
    req=&{Method:POST URL:/v1.24/containers/create Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[] Body:{Reader:{"Cmd":["/bin/sh","-c"," echo test"],"Image":"busybox","PortBindings":{"8080/tcp":[{"HostIP":"","HostPort":"aa80"}]}}
    Request like above should not return 201

  • POST /containers/create with nil config, pouch return 400 ,docker return 500

  • POST /containers/create with multiple network, should return 400, now pouch return 201
    req=&{Method:POST URL:/v1.24/containers/create Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[] Body:{Reader:{"Image":"busybox","Netw orkingConfig":{"EndpointsConfig":{"net1":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"","EndpointID":"","Gateway":"","IPAdd ress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"","Time":0,"SkipResolver":false},"n et2":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"","EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gatewa y":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"","Time":0,"SkipResolver":false},"net3":{"IPAMConfig":null,"Links":null ,"Aliases":null,"NetworkID":"","EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","Global IPv6PrefixLen":0,"MacAddress":"","Time":0,"SkipResolver":false}}}}

  • POST /container/create with nil content-type, docker return 500 while pouch return 201
    the same for wrong content-type

  • POST /containers/create with invalid port syntax expect return 500, while return 201
    the invalid syntax is as following:

 687     config := `{
 688                   "Image": "busybox",
 689                   "HostConfig": {
 690                     "NetworkMode": "default",
 691                     "PortBindings": {
 692                       "19039;1230": [
 693                         {}
 694                       ]
 695                     }
 696                   }
 697                 }`
  • POST /containers/cname/start start a running container should return 304, not it returns 500
#curl-unix-socket -X POST -v unix:///var/run/pouchd.sock:/v1.24/containers/b0b912/start
> POST /v1.24/containers/b0b912/start HTTP/1.1
> Socket: /var/run/pouchd.sock
> Content-Length: 0
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Date: Tue, 27 Mar 2018 06:04:22 GMT
< Content-Length: 207
{"message":"failed to create container, id: b0b912787054a83a91838ea76dc77e2f90ffa13916529b3f3c7adf58b2daedac: container \"b0b912787054a83a91838ea76dc77e2f90ffa13916529b3f3c7adf58b2daedac\": already exists"}


#pouch ps |grep b0b912
testing-start                                b0b912   Up 3 hours           3 hours ago      registry.hub.docker.com/library/busybox:latest   runc
  • DELETE URL:/v1.24/containers/ expect return 400, while it returns 500.

  • validate the resource in create, for example, the following create should return error.

# pouch create --cpuset-cpus 1-42 busybox
container ID: e833752f29c17de1320b2bb9bd0d2d2a1024bfb0515d1d2bb642967d5d4bdc9b, name: e83375
  • exec in a paused conainer return 500, expect 409

  • GET URL:/v1.24/containers/logs_test/logs return 200, expect 400

  • GET URL:/v1.24/containers/nonExistentContainer/logs , get a nonexisting container return 200, expect 400.

  • no NetworkResouce types, and the following json:ID should be Id? this is covered in fix: make json ID be Id to be compatible #1066

type NetworkInspectResp struct {

	// Driver means the network's driver.
	Driver string `json:"Driver,omitempty"`

	// EnableIPv6 represents whether to enable IPv6.
	EnableIPV6 bool `json:"EnableIPv6,omitempty"`

	// ID uniquely identifies a network on a single machine
	ID string `json:"ID,omitempty"`
  • any version is OK for pouch API, is it expected?
#curl-unix-socket -v unix:///var/run/pouchd.sock:/v999.9/version
> GET /v999.9/version HTTP/1.1
> Socket: /var/run/pouchd.sock
> Content-Length: 0
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Tue, 27 Mar 2018 14:28:53 GMT
< Content-Length: 187
{"ApiVersion":"1.24","Arch":"amd64","BuildTime":"unknown","GitCommit":"unknown","GoVersion":"go1.9.1","KernelVersion":"4.9.65-006.ali3000.alios7.x86_64","Os":"linux","Version":"0.3-dev"}
  • expect resp content-type is : application/json.
req=&{Method:GET URL:/v1.24/notfound Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[] Body:<nil> ContentLength:0 TransferEncoding:[] Close:false Host: Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr: RequestURI: TLS:<nil> Cancel:<nil> Response:<nil> ctx:<nil>}
resp : &{404 Not Found 404 HTTP/1.1 1 1 map[Content-Length:[19] Content-Type:[text/plain; charset=utf-8] X-Content-Type-Options:[nosniff] Date:[Tue, 27 Mar 2018 02:33:09 GMT]] 0xc420394280 19 [] false false map[] 0xc420100870 <nil>}
  • [ ]

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • pouch version (use pouch version):
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@pouchrobot pouchrobot added areas/test kind/bug This is bug report for project labels Mar 27, 2018
@HusterWan
Copy link
Contributor

@Letty5411 thanks for your awesome works !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/test kind/bug This is bug report for project
Projects
None yet
Development

No branches or pull requests

4 participants