mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Instead of just showing the number of containers this patch will
show the number of running, paused and stopped containers as well.
Signed-off-by: Kim Eik <kim@heldig.org>
(cherry picked from commit a9804ab1cb)
		
	
			
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			766 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			766 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"}
 | 
						|
 | 
						|
	out := string(body)
 | 
						|
	for _, linePrefix := range stringsToCheck {
 | 
						|
		c.Assert(out, checker.Contains, linePrefix)
 | 
						|
	}
 | 
						|
}
 |