2018-03-01 17:51:11 -05:00
|
|
|
package system // import "github.com/docker/docker/integration/system"
|
2018-02-07 13:23:31 -05:00
|
|
|
|
|
|
|
import (
|
2018-04-19 18:30:59 -04:00
|
|
|
"context"
|
2018-02-07 13:23:31 -05:00
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
2018-04-17 04:22:04 -04:00
|
|
|
"github.com/docker/docker/internal/test/request"
|
2018-03-13 15:28:34 -04:00
|
|
|
"github.com/gotestyourself/gotestyourself/assert"
|
|
|
|
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
2018-02-07 13:23:31 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestInfoAPI(t *testing.T) {
|
|
|
|
client := request.NewAPIClient(t)
|
|
|
|
|
|
|
|
info, err := client.Info(context.Background())
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.NilError(t, err)
|
2018-02-07 13:23:31 -05:00
|
|
|
|
|
|
|
// always shown fields
|
|
|
|
stringsToCheck := []string{
|
|
|
|
"ID",
|
|
|
|
"Containers",
|
|
|
|
"ContainersRunning",
|
|
|
|
"ContainersPaused",
|
|
|
|
"ContainersStopped",
|
|
|
|
"Images",
|
|
|
|
"LoggingDriver",
|
|
|
|
"OperatingSystem",
|
|
|
|
"NCPU",
|
|
|
|
"OSType",
|
|
|
|
"Architecture",
|
|
|
|
"MemTotal",
|
|
|
|
"KernelVersion",
|
|
|
|
"Driver",
|
|
|
|
"ServerVersion",
|
|
|
|
"SecurityOptions"}
|
|
|
|
|
|
|
|
out := fmt.Sprintf("%+v", info)
|
|
|
|
for _, linePrefix := range stringsToCheck {
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, is.Contains(out, linePrefix))
|
2018-02-07 13:23:31 -05:00
|
|
|
}
|
|
|
|
}
|