github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/integration/system/info_test.go (about)

     1  package system
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/docker/docker/integration/internal/request"
     8  	"github.com/gotestyourself/gotestyourself/assert"
     9  	is "github.com/gotestyourself/gotestyourself/assert/cmp"
    10  	"golang.org/x/net/context"
    11  )
    12  
    13  func TestInfoAPI(t *testing.T) {
    14  	client := request.NewAPIClient(t)
    15  
    16  	info, err := client.Info(context.Background())
    17  	assert.NilError(t, err)
    18  
    19  	// always shown fields
    20  	stringsToCheck := []string{
    21  		"ID",
    22  		"Containers",
    23  		"ContainersRunning",
    24  		"ContainersPaused",
    25  		"ContainersStopped",
    26  		"Images",
    27  		"LoggingDriver",
    28  		"OperatingSystem",
    29  		"NCPU",
    30  		"OSType",
    31  		"Architecture",
    32  		"MemTotal",
    33  		"KernelVersion",
    34  		"Driver",
    35  		"ServerVersion",
    36  		"SecurityOptions"}
    37  
    38  	out := fmt.Sprintf("%+v", info)
    39  	for _, linePrefix := range stringsToCheck {
    40  		assert.Check(t, is.Contains(out, linePrefix))
    41  	}
    42  }