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 | |
| parent | 6075b52103c7d42a7c4dc91bde9e64b2f92281de (diff) | |
add dgrep context integration tests
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/dgrep_test.go | 43 | ||||
| -rw-r--r-- | integrationtests/dgrepcontext.txt.expected | 9 | ||||
| -rw-r--r-- | integrationtests/dgrepcontext2.txt.expected | 3 | ||||
| -rw-r--r-- | integrationtests/dtail_test.go | 4 |
4 files changed, 57 insertions, 2 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) +} diff --git a/integrationtests/dgrepcontext.txt.expected b/integrationtests/dgrepcontext.txt.expected new file mode 100644 index 0000000..ad0ae1f --- /dev/null +++ b/integrationtests/dgrepcontext.txt.expected @@ -0,0 +1,9 @@ +INFO|20211002-071939|1|stats.go:56|8|11|7|0.80|471h8m17s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071946|1|stats.go:56|8|11|7|0.67|471h8m24s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071946|1|stats.go:56|8|11|7|0.67|471h8m24s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071947|1|stats.go:56|8|11|7|0.67|471h8m24s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071947|1|stats.go:56|8|11|7|0.67|471h8m25s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071947|1|stats.go:56|8|11|7|0.67|471h8m25s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071948|1|stats.go:56|8|11|7|0.67|471h8m25s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071948|1|stats.go:56|8|11|7|0.67|471h8m26s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=5 +INFO|20211002-071948|1|stats.go:56|8|15|7|0.67|471h8m26s|MAPREDUCE:STATS|currentConnections=1|lifetimeConnections=6 diff --git a/integrationtests/dgrepcontext2.txt.expected b/integrationtests/dgrepcontext2.txt.expected new file mode 100644 index 0000000..38d4feb --- /dev/null +++ b/integrationtests/dgrepcontext2.txt.expected @@ -0,0 +1,3 @@ +INFO|20211002-071143|1|stats.go:56|8|13|7|0.21|471h0m21s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=1 +INFO|20211002-071143|1|stats.go:56|8|13|7|0.21|471h0m21s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=1 +INFO|20211002-071143|1|stats.go:56|8|13|7|0.21|471h0m21s|MAPREDUCE:STATS|currentConnections=0|lifetimeConnections=1 diff --git a/integrationtests/dtail_test.go b/integrationtests/dtail_test.go index 8e932a1..f180b8a 100644 --- a/integrationtests/dtail_test.go +++ b/integrationtests/dtail_test.go @@ -30,7 +30,7 @@ func TestDTailWithServer(t *testing.T) { serverCh, _, _, err := startCommand(ctx, t, "../dserver", "--logger", "stdout", - "--logLevel", "info", + "--logLevel", "trace", "--port", "4242", "--relaxedAuth", ) @@ -42,7 +42,7 @@ func TestDTailWithServer(t *testing.T) { clientCh, _, _, err := startCommand(ctx, t, "../dtail", "--logger", "stdout", - "--logLevel", "devel", + "--logLevel", "trace", "--servers", "localhost:4242", "--files", followFile, "--grep", "Hello", |
