Index: lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java	(révision 1483226)
+++ lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java	(copie de travail)
@@ -521,7 +521,7 @@
     dir.close();
   }
   
-  // LUCENE-1130: make sure immeidate disk full on creating
+  // LUCENE-1130: make sure immediate disk full on creating
   // an IndexWriter (hit during DW.ThreadState.init()) is
   // OK:
   public void testImmediateDiskFull() throws IOException {
@@ -534,12 +534,16 @@
     doc.add(newField("field", "aaa bbb ccc ddd eee fff ggg hhh iii jjj", customType));
     try {
       writer.addDocument(doc);
+      // bytes might still be buffered at this point, call commit to make sure
+      // they make it to the directory
+      writer.commit();
       fail("did not hit disk full");
     } catch (IOException ioe) {
     }
     // Without fix for LUCENE-1130: this call will hang:
     try {
       writer.addDocument(doc);
+      writer.commit();
       fail("did not hit disk full");
     } catch (IOException ioe) {
     }
Index: lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java
===================================================================
--- lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java	(révision 1483226)
+++ lucene/test-framework/src/java/org/apache/lucene/store/MockIndexOutputWrapper.java	(copie de travail)
@@ -109,6 +109,11 @@
   public void flush() throws IOException {
     dir.maybeThrowDeterministicException();
     delegate.flush();
+    // The OutputStream might have buffered bytes so that they were not visible
+    // to the Directory until a call to flush.
+    if (dir.maxSize != 0 && dir.getRecomputedActualSizeInBytes() > dir.maxSize) {
+      throw new IOException("Disk full");
+    }
   }
 
   @Override
