It prints test name and duration for each test. Also performs deleteAllContainers after each test. Signed-off-by: Alexander Morozov <lk4d4@docker.com> Upstream-commit: dc944ea7e48d11a2906e751d3e61daf08faee054 Component: engine
37 lines
690 B
Go
37 lines
690 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestInfoApi(t *testing.T) {
|
|
endpoint := "/info"
|
|
|
|
statusCode, body, err := sockRequest("GET", endpoint, nil)
|
|
if err != nil || statusCode != http.StatusOK {
|
|
t.Fatalf("Expected %d from info request, got %d", http.StatusOK, statusCode)
|
|
}
|
|
|
|
// always shown fields
|
|
stringsToCheck := []string{
|
|
"ID",
|
|
"Containers",
|
|
"Images",
|
|
"ExecutionDriver",
|
|
"LoggingDriver",
|
|
"OperatingSystem",
|
|
"NCPU",
|
|
"MemTotal",
|
|
"KernelVersion",
|
|
"Driver"}
|
|
|
|
out := string(body)
|
|
for _, linePrefix := range stringsToCheck {
|
|
if !strings.Contains(out, linePrefix) {
|
|
t.Errorf("couldn't find string %v in output", linePrefix)
|
|
}
|
|
}
|
|
}
|