diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-14 20:10:55 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-14 20:11:23 +0300 |
| commit | 06ece112c0dd20c0c211c538216fe64ebe4045c9 (patch) | |
| tree | 98f290d8642b59087a03938b04052e056912b44d /integrationtests/dgrep_test.go | |
| parent | 6075b52103c7d42a7c4dc91bde9e64b2f92281de (diff) | |
add dgrep context integration tests
Diffstat (limited to 'integrationtests/dgrep_test.go')
| -rw-r--r-- | integrationtests/dgrep_test.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/integrationtests/dgrep_test.go b/integrationtests/dgrep_test.go index 57b5d86..b63ac45 100644 --- a/integrationtests/dgrep_test.go +++ b/integrationtests/dgrep_test.go @@ -47,3 +47,46 @@ func TestDGrep2(t *testing.T) { os.Remove(stdoutFile) } + +func TestDGrepContext(t *testing.T) { + inFile := "mapr_testdata.log" + stdoutFile := "dgrepcontext.stdout.tmp" + expectedStdoutFile := "dgrepcontext.txt.expected" + + _, err := runCommand(context.TODO(), t, stdoutFile, + "../dgrep", "--spartan", "--grep", "20211002-071947", + "-after", "3", "-before", "3", inFile) + + if err != nil { + t.Error(err) + return + } + + if err := compareFiles(t, stdoutFile, expectedStdoutFile); err != nil { + t.Error(err) + return + } + + os.Remove(stdoutFile) +} + +func TestDGrepContext2(t *testing.T) { + inFile := "mapr_testdata.log" + stdoutFile := "dgrepcontext2.stdout.tmp" + expectedStdoutFile := "dgrepcontext2.txt.expected" + + _, err := runCommand(context.TODO(), t, stdoutFile, + "../dgrep", "--spartan", "--grep", "20211002", "-max", "3", inFile) + + if err != nil { + t.Error(err) + return + } + + if err := compareFiles(t, stdoutFile, expectedStdoutFile); err != nil { + t.Error(err) + return + } + + os.Remove(stdoutFile) +} |
