Remove Job from Info API

Two main things
- Create a real struct Info for all of the data with the proper types
- Add test for REST API get info

Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
Hu Keping
2015-04-20 18:14:06 +08:00
parent 24b89b7098
commit f4942ed864
7 changed files with 163 additions and 169 deletions
+38
View File
@@ -0,0 +1,38 @@
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)
}
}
logDone("container REST API - check GET /info")
}