From d78490a9337523b43366a0c3ceb515ce1781f048 Mon Sep 17 00:00:00 2001 From: nikita15p <37657012+nikita15p@users.noreply.github.com> Date: Mon, 22 May 2023 00:51:06 +0530 Subject: [PATCH] [FLUME-3473] fixed testMinimumRequiredSpaceTooSmallforPut test by changing buffer size dynamic --- .../test/java/org/apache/flume/channel/file/TestLog.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestLog.java b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestLog.java index e85274da56..6a787b65c6 100644 --- a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestLog.java +++ b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestLog.java @@ -29,6 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -228,12 +229,14 @@ public void doTestMinimumRequiredSpaceTooSmallForPut() throws IOException, .build(); log.replay(); File filler = new File(checkpointDir, "filler"); - byte[] buffer = new byte[64 * 1024]; FileOutputStream out = new FileOutputStream(filler); + BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(out); while (checkpointDir.getUsableSpace() > minimumRequiredSpace) { - out.write(buffer); + String data = "this is dynamic data byte"; + byte[] dataBytes = data.getBytes(); + bufferedOutputStream.write(dataBytes); } - out.close(); + bufferedOutputStream.flush(); try { FlumeEvent eventIn = TestUtils.newPersistableEvent(); long transactionID = ++this.transactionID;