2015-04-10 17:26:30 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2015-04-22 18:44:54 +00:00
|
|
|
|
2015-11-19 01:15:38 +00:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2015-04-22 18:44:54 +00:00
|
|
|
"github.com/go-check/check"
|
2015-04-10 17:26:30 +00:00
|
|
|
)
|
|
|
|
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-28 01:50:12 +00:00
|
|
|
func (s *DockerSuite) TestInfoAPI(c *check.C) {
|
2015-04-10 17:26:30 +00:00
|
|
|
endpoint := "/info"
|
|
|
|
|
2015-04-20 21:03:56 +00:00
|
|
|
status, body, err := sockRequest("GET", endpoint, nil)
|
2015-11-19 01:15:38 +00:00
|
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
|
|
c.Assert(err, checker.IsNil)
|
2015-04-10 17:26:30 +00:00
|
|
|
|
|
|
|
// always shown fields
|
|
|
|
stringsToCheck := []string{
|
|
|
|
"ID",
|
|
|
|
"Containers",
|
2015-10-27 20:12:33 +00:00
|
|
|
"ContainersRunning",
|
|
|
|
"ContainersPaused",
|
|
|
|
"ContainersStopped",
|
2015-04-10 17:26:30 +00:00
|
|
|
"Images",
|
|
|
|
"LoggingDriver",
|
|
|
|
"OperatingSystem",
|
|
|
|
"NCPU",
|
2015-06-13 07:39:19 +00:00
|
|
|
"OSType",
|
|
|
|
"Architecture",
|
2015-04-10 17:26:30 +00:00
|
|
|
"MemTotal",
|
|
|
|
"KernelVersion",
|
2015-09-21 04:23:54 +00:00
|
|
|
"Driver",
|
2016-03-29 04:10:37 +00:00
|
|
|
"ServerVersion",
|
|
|
|
"SecurityOptions"}
|
2015-04-10 17:26:30 +00:00
|
|
|
|
|
|
|
out := string(body)
|
|
|
|
for _, linePrefix := range stringsToCheck {
|
2015-11-19 01:15:38 +00:00
|
|
|
c.Assert(out, checker.Contains, linePrefix)
|
2015-04-10 17:26:30 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-21 09:43:00 +00:00
|
|
|
|
|
|
|
func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
|
2016-10-31 17:15:43 +00:00
|
|
|
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
2016-10-21 09:43:00 +00:00
|
|
|
endpoint := "/v1.20/info"
|
|
|
|
|
|
|
|
status, body, err := sockRequest("GET", endpoint, nil)
|
|
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
|
|
|
|
out := string(body)
|
|
|
|
c.Assert(out, checker.Contains, "ExecutionDriver")
|
|
|
|
c.Assert(out, checker.Contains, "not supported")
|
|
|
|
}
|