flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject flume git commit: FLUME-2974. Fix some broken SpoolDirSource unit tests
Date Mon, 22 Aug 2016 21:16:36 GMT
Repository: flume
Updated Branches:
  refs/heads/trunk e0deb7281 -> 9eb92dab0


FLUME-2974. Fix some broken SpoolDirSource unit tests

TestReliableSpoolingFileEventReader and TestSpoolingFileLineReader were
broken as part of commit b6dede8c108e0d8e3516767de31e3a847c69cfe0.
This patch fixes them again.

(Bessenyei Balázs Donát via Mike Percy)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/9eb92dab
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/9eb92dab
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/9eb92dab

Branch: refs/heads/trunk
Commit: 9eb92dab0d24813e9a3871f0c7038920797c0466
Parents: e0deb72
Author: Bessenyei Balázs Donát <bessbd@cloudera.com>
Authored: Mon Aug 22 13:29:17 2016 -0700
Committer: Mike Percy <mpercy@apache.org>
Committed: Mon Aug 22 13:39:39 2016 -0700

----------------------------------------------------------------------
 .../flume/client/avro/TestReliableSpoolingFileEventReader.java  | 5 +++--
 .../apache/flume/client/avro/TestSpoolingFileLineReader.java    | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/9eb92dab/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestReliableSpoolingFileEventReader.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestReliableSpoolingFileEventReader.java
b/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestReliableSpoolingFileEventReader.java
index fdc3ce9..59fb1c3 100644
--- a/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestReliableSpoolingFileEventReader.java
+++ b/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestReliableSpoolingFileEventReader.java
@@ -144,7 +144,7 @@ public class TestReliableSpoolingFileEventReader {
         new ReliableSpoolingFileEventReader.Builder().spoolDirectory(WORK_DIR)
                                                      .build();
 
-    final int expectedLines = 0 + 1 + 2 + 3 + 1;
+    final int expectedLines = 1 + 1 + 2 + 3 + 1;
     int seenLines = 0;
     for (int i = 0; i < 10; i++) {
       List<Event> events = reader.readEvents(10);
@@ -166,7 +166,7 @@ public class TestReliableSpoolingFileEventReader {
                                                      .trackerDirPath(trackerDirPath)
                                                      .build();
 
-    final int expectedLines = 0 + 1 + 2 + 3 + 1;
+    final int expectedLines = 1 + 1 + 2 + 3 + 1;
     int seenLines = 0;
     for (int i = 0; i < 10; i++) {
       List<Event> events = reader.readEvents(10);
@@ -525,6 +525,7 @@ public class TestReliableSpoolingFileEventReader {
   }    
   /* Create expected results out of the files created in the setup method. */
   private void createExpectedFromFilesInSetup(Collection<String> expected) {
+    expected.add("");
     for (int i = 0; i < 4; i++) {      
       for (int j = 0; j < i; j++) {        
         expected.add("file" + i + "line" + j);

http://git-wip-us.apache.org/repos/asf/flume/blob/9eb92dab/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestSpoolingFileLineReader.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestSpoolingFileLineReader.java
b/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestSpoolingFileLineReader.java
index ac046a9..bc3aa82 100644
--- a/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestSpoolingFileLineReader.java
+++ b/flume-ng-core/src/test/java/org/apache/flume/client/avro/TestSpoolingFileLineReader.java
@@ -420,7 +420,10 @@ public class TestSpoolingFileLineReader {
                 "file1line5\nfile1line6\nfile1line7\nfile1line8\n",
                 f2, Charsets.UTF_8);
 
-    // Expect to skip over first file
+    // Skip over first file, which is empty, and will return an empty event.
+    Event event = parser.readEvent();
+    assertEquals(0, event.getBody().length);
+
     List<String> out = bodiesAsStrings(parser.readEvents(8));
 
     parser.commit();


Mime
View raw message