diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2021-12-08 09:52:21 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2021-12-08 09:52:21 +0000 |
| commit | e70adfe0d309d511ae7598683003c92795192fe1 (patch) | |
| tree | 25c8dd5073d8021f1de927a5ee236003cd63457c /integrationtests/dmap_test.go | |
| parent | bdf066311ae1ec552f2f4bff6f269817b8052718 (diff) | |
refactor dmap1 unit test to be more modular
Diffstat (limited to 'integrationtests/dmap_test.go')
| -rw-r--r-- | integrationtests/dmap_test.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/integrationtests/dmap_test.go b/integrationtests/dmap_test.go index 5e5f4d3..ec14cfb 100644 --- a/integrationtests/dmap_test.go +++ b/integrationtests/dmap_test.go @@ -15,28 +15,29 @@ func TestDMap1(t *testing.T) { return } + query := fmt.Sprintf("from STATS select count($line),last($time)," + + "avg($goroutines),min(concurrentConnections),max(lifetimeConnections) " + + "group by $hostname") + t.Log("Testing dmap with input file") - if err := testDmap1(t, false); err != nil { + if err := testDmap1(t, query, "a", false); err != nil { t.Error(err) return } t.Log("Testing dmap with stdin input pipe") - if err := testDmap1(t, true); err != nil { + if err := testDmap1(t, query, "a", true); err != nil { t.Error(err) return } } -func testDmap1(t *testing.T, usePipe bool) error { +func testDmap1(t *testing.T, query, subtestName string, usePipe bool) error { inFile := "mapr_testdata.log" - csvFile := "dmap1.csv.tmp" - expectedCsvFile := "dmap1.csv.expected" + csvFile := fmt.Sprintf("dmap1%s.csv.tmp", subtestName) + expectedCsvFile := fmt.Sprintf("dmap1%s.csv.expected", subtestName) queryFile := fmt.Sprintf("%s.query", csvFile) - expectedQueryFile := "dmap1.csv.query.expected" - - query := fmt.Sprintf("from STATS select count($line),last($time),"+ - "avg($goroutines),min(concurrentConnections),max(lifetimeConnections) "+ - "group by $hostname outfile %s", csvFile) + expectedQueryFile := fmt.Sprintf("dmap1%s.csv.query.expected", subtestName) + query = fmt.Sprintf("%s outfile %s", query, csvFile) ctx, cancel := context.WithCancel(context.Background()) defer cancel() |
