소스 검색

Merge pull request #10220 from ping40/pagewriter

pkg/ioutil: n is equal or greater than cw.writeBytes
Gyuho Lee 7 년 전
부모
커밋
252dc1f994
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      pkg/ioutil/pagewriter_test.go

+ 2 - 2
pkg/ioutil/pagewriter_test.go

@@ -37,8 +37,8 @@ func TestPageWriterRandom(t *testing.T) {
 	if cw.writeBytes > n {
 	if cw.writeBytes > n {
 		t.Fatalf("wrote %d bytes to io.Writer, but only wrote %d bytes", cw.writeBytes, n)
 		t.Fatalf("wrote %d bytes to io.Writer, but only wrote %d bytes", cw.writeBytes, n)
 	}
 	}
-	if cw.writeBytes-n > pageBytes {
-		t.Fatalf("got %d bytes pending, expected less than %d bytes", cw.writeBytes-n, pageBytes)
+	if n-cw.writeBytes > pageBytes {
+		t.Fatalf("got %d bytes pending, expected less than %d bytes", n-cw.writeBytes, pageBytes)
 	}
 	}
 	t.Logf("total writes: %d", cw.writes)
 	t.Logf("total writes: %d", cw.writes)
 	t.Logf("total write bytes: %d (of %d)", cw.writeBytes, n)
 	t.Logf("total write bytes: %d (of %d)", cw.writeBytes, n)