diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java index 4a793e4e23f..e1c0e30fbde 100644 --- a/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java +++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/GrepIteratorTest.java @@ -48,9 +48,13 @@ public class GrepIteratorTest { public void init() { input = new TreeMap<>(); output = new TreeMap<>(); + input.put(new Key("abcdef", "xyz", "xyz", 0), new Value("xyz")); output.put(new Key("abcdef", "xyz", "xyz", 0), new Value("xyz")); + input.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv")); + output.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv")); + input.put(new Key("bdf", "ace", "xyz", 0), new Value("xyz")); input.put(new Key("bdf", "abcdef", "xyz", 0), new Value("xyz")); output.put(new Key("bdf", "abcdef", "xyz", 0), new Value("xyz")); @@ -97,6 +101,20 @@ public void test() throws IOException { GrepIterator.setTerm(is, "def"); gi.init(new SortedMapIterator(input), is.getOptions(), null); gi.seek(new Range(), EMPTY_COL_FAMS, false); + + checkEntries(gi, output); + + input = new TreeMap<>(); + output = new TreeMap<>(); + + input.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv")); + input.put(new Key("abcdef", "cv", "cv", "nomatch", 0), new Value("cv")); + output.put(new Key("abcdef", "cv", "cv", "colvis", 0), new Value("cv")); + + GrepIterator.setTerm(is, "colvis"); + gi.init(new SortedMapIterator(input), is.getOptions(), null); + gi.seek(new Range(), EMPTY_COL_FAMS, false); + checkEntries(gi, output); } } diff --git a/test/src/main/java/org/apache/accumulo/test/shell/ShellIT.java b/test/src/main/java/org/apache/accumulo/test/shell/ShellIT.java index 4f592791f79..650ebac7c33 100644 --- a/test/src/main/java/org/apache/accumulo/test/shell/ShellIT.java +++ b/test/src/main/java/org/apache/accumulo/test/shell/ShellIT.java @@ -464,6 +464,7 @@ public void grepTest() throws IOException { String expected = "r f:q [vis]\tv"; String expectedTimestamp = "r f:q [vis] 0\tv"; exec("grep", false, "No terms specified"); + exec("grep vis", true, expected); exec("grep non_matching_string", true, ""); // historically, showing few did not pertain to ColVis or Timestamp exec("grep r", true, expected);