mirror of
https://github.com/clearlinux/docker.git
synced 2026-08-26 09:36:04 +00:00
More unit test fixes
- Fix TestGetImagesJSON when there is more than one image in the test repository; - Remove an hardcoded constant use in TestGetImagesByName; - Wait in a loop in TestKillDifferentUser; - Use env instead of /usr/bin/env in TestEnv; - Create a daemon user in contrib/mkimage-unittest.sh.
This commit is contained in:
+10
-3
@@ -142,12 +142,13 @@ func TestGetImagesJSON(t *testing.T) {
|
||||
|
||||
srv := &Server{runtime: runtime}
|
||||
|
||||
initialImages, err := srv.Images(true, "")
|
||||
// all=0
|
||||
|
||||
initialImages, err := srv.Images(false, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// all=0
|
||||
req, err := http.NewRequest("GET", "/images/json?all=0", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -182,6 +183,12 @@ func TestGetImagesJSON(t *testing.T) {
|
||||
r2 := httptest.NewRecorder()
|
||||
|
||||
// all=1
|
||||
|
||||
initialImages, err = srv.Images(true, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req2, err := http.NewRequest("GET", "/images/json?all=true", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -352,7 +359,7 @@ func TestGetImagesByName(t *testing.T) {
|
||||
if err := json.Unmarshal(r.Body.Bytes(), img); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if img.ID != GetTestImage(runtime).ID || img.Comment != "Imported from http://get.docker.io/images/busybox" {
|
||||
if img.ID != unitTestImageId {
|
||||
t.Errorf("Error inspecting image")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user