summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-03 13:32:20 +0300
committerPaul Buetow <paul@buetow.org>2021-10-03 13:39:03 +0300
commitb2dbe133347ef220ff781ffeb1f8137245f5235f (patch)
treed2ff5f5cc0b02159a14f51b1850e4427877ef9a7 /integrationtests
parent07e1470892beacf0722276f94bacbd822b002540 (diff)
when a mapreduce outfile is specified also always write a outfile.query file
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/commons.go3
-rw-r--r--integrationtests/dmap.csv.query.expected1
-rw-r--r--integrationtests/dmap2.csv.query.expected1
-rw-r--r--integrationtests/dmap_test.go16
4 files changed, 19 insertions, 2 deletions
diff --git a/integrationtests/commons.go b/integrationtests/commons.go
index 74eeac5..f789322 100644
--- a/integrationtests/commons.go
+++ b/integrationtests/commons.go
@@ -78,9 +78,12 @@ func compareFilesContents(t *testing.T, fileA, fileB string) error {
return err
}
+ // The mapreduce result can be in a different order each time (Golang maps are not sorted).
+ t.Log(fmt.Sprintf("Checking whether %s has same lines as file %s (ignoring line order)", fileA, fileB))
if err := compareMaps(a, b); err != nil {
return err
}
+ t.Log(fmt.Sprintf("Checking whether %s has same lines as file %s (ignoring line order)", fileB, fileA))
if err := compareMaps(b, a); err != nil {
return err
}
diff --git a/integrationtests/dmap.csv.query.expected b/integrationtests/dmap.csv.query.expected
new file mode 100644
index 0000000..2bb2a52
--- /dev/null
+++ b/integrationtests/dmap.csv.query.expected
@@ -0,0 +1 @@
+from STATS select count($line),last($time),avg($goroutines),min(concurrentConnections),max(lifetimeConnections) group by $hostname outfile dmap.csv.tmp \ No newline at end of file
diff --git a/integrationtests/dmap2.csv.query.expected b/integrationtests/dmap2.csv.query.expected
new file mode 100644
index 0000000..b15de3a
--- /dev/null
+++ b/integrationtests/dmap2.csv.query.expected
@@ -0,0 +1 @@
+from STATS select count($time),$time,max($goroutines),avg($goroutines),min($goroutines) group by $time order by count($time) outfile dmap2.csv.tmp \ No newline at end of file
diff --git a/integrationtests/dmap_test.go b/integrationtests/dmap_test.go
index bfca039..dc508e2 100644
--- a/integrationtests/dmap_test.go
+++ b/integrationtests/dmap_test.go
@@ -11,6 +11,8 @@ func TestDMap(t *testing.T) {
stdoutFile := "dmap.stdout.tmp"
csvFile := "dmap.csv.tmp"
expectedCsvFile := "dmap.csv.expected"
+ queryFile := fmt.Sprintf("%s.query", csvFile)
+ expectedQueryFile := "dmap.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)
@@ -18,14 +20,18 @@ func TestDMap(t *testing.T) {
t.Error(err)
return
}
-
if err := compareFiles(t, csvFile, expectedCsvFile); err != nil {
t.Error(err)
return
}
+ if err := compareFiles(t, queryFile, expectedQueryFile); err != nil {
+ t.Error(err)
+ return
+ }
os.Remove(stdoutFile)
os.Remove(csvFile)
+ os.Remove(queryFile)
}
func TestDMap2(t *testing.T) {
@@ -33,6 +39,8 @@ func TestDMap2(t *testing.T) {
stdoutFile := "dmap2.stdout.tmp"
csvFile := "dmap2.csv.tmp"
expectedCsvFile := "dmap2.csv.expected"
+ queryFile := fmt.Sprintf("%s.query", csvFile)
+ expectedQueryFile := "dmap2.csv.query.expected"
query := fmt.Sprintf("from STATS select count($time),$time,max($goroutines),avg($goroutines),min($goroutines) group by $time order by count($time) outfile %s", csvFile)
@@ -40,12 +48,16 @@ func TestDMap2(t *testing.T) {
t.Error(err)
return
}
-
if err := compareFilesContents(t, csvFile, expectedCsvFile); err != nil {
t.Error(err)
return
}
+ if err := compareFiles(t, queryFile, expectedQueryFile); err != nil {
+ t.Error(err)
+ return
+ }
os.Remove(stdoutFile)
os.Remove(csvFile)
+ os.Remove(queryFile)
}