Guillaume J. Charmes 11 éve
szülő
commit
b843998718
2 módosított fájl, 13 hozzáadás és 12 törlés
  1. 6 4
      api_test.go
  2. 7 8
      image.go

+ 6 - 4
api_test.go

@@ -336,9 +336,11 @@ func TestGetContainersJSON(t *testing.T) {
 	}
 
 	r := httptest.NewRecorder()
-	if err := getContainersJSON(srv, APIVERSION, r, req, nil); err != nil {
-		t.Fatal(err)
-	}
+	setTimeout(t, "getContainerJSON timed out", 5*time.Second, func() {
+		if err := getContainersJSON(srv, APIVERSION, r, req, nil); err != nil {
+			t.Fatal(err)
+		}
+	})
 	containers := []APIContainers{}
 	if err := json.Unmarshal(r.Body.Bytes(), &containers); err != nil {
 		t.Fatal(err)
@@ -374,7 +376,7 @@ func TestGetContainersExport(t *testing.T) {
 	}
 
 	r := httptest.NewRecorder()
-	if err = getContainersExport(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
+	if err := getContainersExport(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
 		t.Fatal(err)
 	}
 

+ 7 - 8
image.go

@@ -310,7 +310,7 @@ func (image *Image) applyLayer(layer, target string) error {
 		update := updateTimes[i]
 
 		O_PATH := 010000000 // Not in syscall yet
-		var err error = nil
+		var err error
 		if update.mode&syscall.S_IFLNK == syscall.S_IFLNK {
 			// Update time on the symlink via O_PATH + futimes(), if supported by the kernel
 
@@ -321,7 +321,7 @@ func (image *Image) applyLayer(layer, target string) error {
 				return err
 			} else {
 				syscall.Futimes(fd, update.time)
-				_ = syscall.Close(fd)
+				syscall.Close(fd)
 			}
 		} else {
 			err = syscall.Utimes(update.path, update.time)
@@ -411,8 +411,8 @@ func (image *Image) ensureImageDevice(devices DeviceSet) error {
 	// part of the container changes
 	dockerinitLayer, err := image.getDockerInitLayer()
 	if err != nil {
-		_ = devices.UnmountDevice(image.ID, mountDir)
-		_ = devices.RemoveDevice(image.ID)
+		devices.UnmountDevice(image.ID, mountDir)
+		devices.RemoveDevice(image.ID)
 		return err
 	}
 
@@ -491,8 +491,7 @@ func (image *Image) Unmount(runtime *Runtime, root string, id string) error {
 		return err
 	}
 
-	err = devices.UnmountDevice(id, root)
-	if err != nil {
+	if err = devices.UnmountDevice(id, root); err != nil {
 		return err
 	}
 
@@ -519,9 +518,9 @@ func (image *Image) Changes(runtime *Runtime, root, rw, id string) ([]Change, er
 	}
 
 	changes, err := ChangesDirs(root, rw)
-	_ = devices.UnmountDevice(image.ID, rw)
+	devices.UnmountDevice(image.ID, rw)
 	if !wasActivated {
-		_ = devices.DeactivateDevice(image.ID)
+		devices.DeactivateDevice(image.ID)
 	}
 	if err != nil {
 		return nil, err