mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
190654aa2e
This pull request added a `SecurityOptions` field in the `GET /info` output to show if there is `apparmor`, `seccomp`, or `selinux` suport. The API changes are updated in the documentation and the update in `GET /info` is covered by the test case in `TestInfoApi`. This pull request fixes #20909. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
41 lines
787 B
Go
41 lines
787 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
|
"github.com/go-check/check"
|
|
)
|
|
|
|
func (s *DockerSuite) TestInfoApi(c *check.C) {
|
|
endpoint := "/info"
|
|
|
|
status, body, err := sockRequest("GET", endpoint, nil)
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
// always shown fields
|
|
stringsToCheck := []string{
|
|
"ID",
|
|
"Containers",
|
|
"ContainersRunning",
|
|
"ContainersPaused",
|
|
"ContainersStopped",
|
|
"Images",
|
|
"ExecutionDriver",
|
|
"LoggingDriver",
|
|
"OperatingSystem",
|
|
"NCPU",
|
|
"OSType",
|
|
"Architecture",
|
|
"MemTotal",
|
|
"KernelVersion",
|
|
"Driver",
|
|
"ServerVersion",
|
|
"SecurityOptions"}
|
|
|
|
out := string(body)
|
|
for _, linePrefix := range stringsToCheck {
|
|
c.Assert(out, checker.Contains, linePrefix)
|
|
}
|
|
}
|