commit
78228debbc
|
@ -352,7 +352,7 @@ func runTest_rawDataReturnsInOrder(t *testing.T, testName string, nodes Cluster,
|
|||
expected = fmt.Sprintf(`{"results":[{"series":[{"name":"cpu","columns":["time","count"],"values":[["1970-01-01T00:00:00Z",%d]]}]}]}`, numPoints-1)
|
||||
got, ok, nOK := queryAndWait(t, nodes, database, `SELECT count(value) FROM cpu`, expected, "", 120*time.Second)
|
||||
if !ok {
|
||||
t.Errorf("test %s:rawDataReturnsInOrder failed, SELECT count() query returned unexpected data\nexp: %s\ngot: %s\n%d nodes responded correctly", testName, expected, got, nOK)
|
||||
t.Fatalf("test %s:rawDataReturnsInOrder failed, SELECT count() query returned unexpected data\nexp: %s\ngot: %s\n%d nodes responded correctly", testName, expected, got, nOK)
|
||||
dumpClusterDiags(t, testName, nodes)
|
||||
dumpClusterStats(t, testName, nodes)
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ func runTest_rawDataReturnsInOrder(t *testing.T, testName string, nodes Cluster,
|
|||
expected = fmt.Sprintf(`{"results":[{"series":[{"name":"cpu","columns":["time","value"],"values":[%s]}]}]}`, strings.Join(expectedValues, ","))
|
||||
got, ok, nOK = query(t, nodes, database, `SELECT value FROM cpu`, expected, "")
|
||||
if !ok {
|
||||
t.Errorf("test %s failed, SELECT query returned unexpected data\nexp: %s\ngot: %s\n%d nodes responded correctly", testName, expected, got, nOK)
|
||||
t.Fatalf("test %s failed, SELECT query returned unexpected data\nexp: %s\ngot: %s\n%d nodes responded correctly", testName, expected, got, nOK)
|
||||
dumpClusterDiags(t, testName, nodes)
|
||||
dumpClusterStats(t, testName, nodes)
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ func runTests_Errors(t *testing.T, nodes Cluster) {
|
|||
if tt.query != "" {
|
||||
got, ok, nOK := query(t, nodes, "", tt.query, tt.expected, "")
|
||||
if !ok {
|
||||
t.Errorf("Test '%s' failed, expected: %s, got: %s, %d nodes responded correctly", tt.name, tt.expected, got, nOK)
|
||||
t.Fatalf("Test '%s' failed, expected: %s, got: %s, %d nodes responded correctly", tt.name, tt.expected, got, nOK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1541,9 +1541,9 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
|
|||
got, ok, nOK := queryAndWait(t, qNodes, rewriteDbRp(urlDb, database, retention), qry, rewriteDbRp(tt.expected, database, retention), rewriteDbRp(tt.expectPattern, database, retention), 30*time.Second)
|
||||
if !ok {
|
||||
if tt.expected != "" {
|
||||
t.Errorf("Test #%d: \"%s:%s\" failed\n query: %s\n exp: %s\n got: %s\n%d nodes responded correctly", i, testName, name, qry, rewriteDbRp(tt.expected, database, retention), got, nOK)
|
||||
t.Fatalf("Test #%d: \"%s:%s\" failed\n query: %s\n exp: %s\n got: %s\n%d nodes responded correctly", i, testName, name, qry, rewriteDbRp(tt.expected, database, retention), got, nOK)
|
||||
} else {
|
||||
t.Errorf("Test #%d: \"%s:%s\" failed\n query: %s\n exp: %s\n got: %s\n%d nodes responded correctly", i, testName, name, qry, rewriteDbRp(tt.expectPattern, database, retention), got, nOK)
|
||||
t.Fatalf("Test #%d: \"%s:%s\" failed\n query: %s\n exp: %s\n got: %s\n%d nodes responded correctly", i, testName, name, qry, rewriteDbRp(tt.expectPattern, database, retention), got, nOK)
|
||||
}
|
||||
dumpClusterDiags(t, name, nodes)
|
||||
dumpClusterStats(t, name, nodes)
|
||||
|
@ -1753,13 +1753,13 @@ func TestClientLibrary(t *testing.T) {
|
|||
for _, w := range test.writes {
|
||||
writeResult, err := c.Write(w.bp)
|
||||
if w.err != errToString(err) {
|
||||
t.Errorf("unexpected error. expected: %s, got %v", w.err, err)
|
||||
t.Fatalf("unexpected error. expected: %s, got %v", w.err, err)
|
||||
}
|
||||
jsonResult := mustMarshalJSON(writeResult)
|
||||
if w.expected != jsonResult {
|
||||
t.Logf("write expected result: %s\n", w.expected)
|
||||
t.Logf("write got result: %s\n", jsonResult)
|
||||
t.Error("unexpected results")
|
||||
t.Fatalf("unexpected results")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1768,13 +1768,13 @@ func TestClientLibrary(t *testing.T) {
|
|||
time.Sleep(500 * time.Millisecond)
|
||||
queryResponse, err := c.Query(q.query)
|
||||
if q.err != errToString(err) {
|
||||
t.Errorf("unexpected error. expected: %s, got %v", q.err, err)
|
||||
t.Fatalf("unexpected error. expected: %s, got %v", q.err, err)
|
||||
}
|
||||
jsonResult := mustMarshalJSON(queryResponse)
|
||||
if q.expected != jsonResult {
|
||||
t.Logf("query expected result: %s\n", q.expected)
|
||||
t.Logf("query got result: %s\n", jsonResult)
|
||||
t.Error("unexpected results")
|
||||
t.Fatalf("unexpected results")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1835,7 +1835,7 @@ func Test_ServerSingleGraphiteIntegration_Default(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "graphite", `select * from "graphite"."raw".cpu`, expected, "", graphiteTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1893,7 +1893,7 @@ func Test_ServerSingleGraphiteIntegration_FractionalTime(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "graphite", `select * from "graphite"."raw".cpu`, expected, "", graphiteTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1950,7 +1950,7 @@ func Test_ServerSingleGraphiteIntegration_ZeroDataPoint(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "graphite", `select * from "graphite"."raw".cpu`, expected, "", graphiteTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1991,14 +1991,14 @@ func Test_ServerSingleGraphiteIntegration_NoDatabase(t *testing.T) {
|
|||
expected := `{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["graphite"]]}]}]}`
|
||||
got, ok, _ := queryAndWait(t, nodes, "graphite", `show databases`, expected, "", 2*time.Second)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
|
||||
// Need to wait for the database to get a default retention policy
|
||||
expected = `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["default","0",1,true]]}]}]}`
|
||||
got, ok, _ = queryAndWait(t, nodes, "graphite", `show retention policies graphite`, expected, "", graphiteTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
|
||||
t.Log("Writing data")
|
||||
|
@ -2016,7 +2016,7 @@ func Test_ServerSingleGraphiteIntegration_NoDatabase(t *testing.T) {
|
|||
expected = fmt.Sprintf(`{"results":[{"series":[{"name":"cpu","columns":["time","value"],"values":[["%s",23.456]]}]}]}`, now.Format(time.RFC3339Nano))
|
||||
got, ok, _ = queryAndWait(t, nodes, "graphite", `select * from "graphite"."default".cpu`, expected, "", 2*time.Second)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2070,7 +2070,7 @@ func Test_ServerOpenTSDBIntegration(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "opentsdb", `select * from "opentsdb"."raw".cpu`, expected, "", openTSDBTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2129,7 +2129,7 @@ func Test_ServerOpenTSDBIntegration_WithTags(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "opentsdb", `select * from "opentsdb"."raw".cpu where tag1='val3'`, expected, "", openTSDBTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2186,7 +2186,7 @@ func Test_ServerOpenTSDBIntegration_BadData(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "opentsdb", `select * from "opentsdb"."raw".cpu`, expected, "", openTSDBTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2232,7 +2232,7 @@ func Test_ServerOpenTSDBIntegrationHTTPSingle(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "opentsdb", `select * from "opentsdb"."raw".cpu`, expected, "", openTSDBTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2280,7 +2280,7 @@ func Test_ServerOpenTSDBIntegrationHTTPMulti(t *testing.T) {
|
|||
// query and wait for results
|
||||
got, ok, _ := queryAndWait(t, nodes, "opentsdb", `select * from "opentsdb"."raw".cpu`, expected, "", openTSDBTestTimeout)
|
||||
if !ok {
|
||||
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
t.Fatalf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue