diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-10 19:42:48 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-11 11:52:30 +0300 |
| commit | 71f89dc7ec7cf993d1eca98771212afe6310e9c8 (patch) | |
| tree | ca2812fb142b2d98f8a8092992a33d575329997a /integrationtests/dgrep_test.go | |
| parent | f44792c9102488774c9993b080f35c65287a64b1 (diff) | |
refactor
Diffstat (limited to 'integrationtests/dgrep_test.go')
| -rw-r--r-- | integrationtests/dgrep_test.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/integrationtests/dgrep_test.go b/integrationtests/dgrep_test.go index 4d54a2d..15519b3 100644 --- a/integrationtests/dgrep_test.go +++ b/integrationtests/dgrep_test.go @@ -1,6 +1,7 @@ package integrationtests import ( + "context" "os" "testing" ) @@ -9,16 +10,20 @@ func TestDGrep(t *testing.T) { inFile := "mapr_testdata.log" stdoutFile := "dgrep.stdout.tmp" expectedStdoutFile := "dgrep.txt.expected" - args := []string{"-spartan", "--grep", "20211002-071947", inFile} - if _, err := runCommand(t, "../dgrep", args, stdoutFile); err != nil { + _, err := runCommand(context.TODO(), stdoutFile, + "../dgrep", "--spartan", "--grep", "20211002-071947", inFile) + + if err != nil { t.Error(err) return } + if err := compareFiles(t, stdoutFile, expectedStdoutFile); err != nil { t.Error(err) return } + os.Remove(stdoutFile) } @@ -26,15 +31,19 @@ func TestDGrep2(t *testing.T) { inFile := "mapr_testdata.log" stdoutFile := "dgrep2.stdout.tmp" expectedStdoutFile := "dgrep2.txt.expected" - args := []string{"-spartan", "--grep", "20211002-071947", "--invert", inFile} - if _, err := runCommand(t, "../dgrep", args, stdoutFile); err != nil { + _, err := runCommand(context.TODO(), stdoutFile, + "../dgrep", "-spartan", "--grep", "20211002-071947", "--invert", inFile) + + if err != nil { t.Error(err) return } + if err := compareFiles(t, stdoutFile, expectedStdoutFile); err != nil { t.Error(err) return } + os.Remove(stdoutFile) } |
