Merge pull request #2101 from influxdb/various_fixes
SHOW DATABASES returns series name "databases"pull/2104/head
commit
0310b0b73c
|
@ -9,6 +9,7 @@
|
|||
### Bugfixes
|
||||
- [#2084](https://github.com/influxdb/influxdb/pull/2084): Allowing leading underscores in identifiers.
|
||||
- [#2080](https://github.com/influxdb/influxdb/pull/2080): Graphite logs in seconds, not milliseconds.
|
||||
- [#2101](https://github.com/influxdb/influxdb/pull/2101): SHOW DATABASES should name returned series "databases".
|
||||
|
||||
## v0.9.0-rc16 [2015-03-24]
|
||||
|
||||
|
|
|
@ -991,6 +991,11 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
|
|||
queryOne: true,
|
||||
expected: `{"results":[{}]}`,
|
||||
},
|
||||
{
|
||||
name: "show databases",
|
||||
query: `SHOW DATABASES`,
|
||||
expected: `{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["mydatabase"],["mydb"]]}]}]}`,
|
||||
},
|
||||
{
|
||||
name: "Check for default retention policy",
|
||||
query: `SHOW RETENTION POLICIES mydatabase`,
|
||||
|
@ -1499,7 +1504,7 @@ func Test_ServerSingleGraphiteIntegration_NoDatabase(t *testing.T) {
|
|||
}
|
||||
|
||||
// Need to wait for the database to be created
|
||||
expected := `{"results":[{"series":[{"columns":["name"],"values":[["graphite"]]}]}]}`
|
||||
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)
|
||||
|
|
|
@ -162,60 +162,6 @@ func TestHandler_ShowMeasurementsNotFound(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHandler_Databases(t *testing.T) {
|
||||
c := test.NewMessagingClient()
|
||||
defer c.Close()
|
||||
srvr := OpenAuthlessServer(c)
|
||||
srvr.CreateDatabase("foo")
|
||||
srvr.CreateDatabase("bar")
|
||||
s := NewHTTPServer(srvr)
|
||||
defer s.Close()
|
||||
|
||||
status, body := MustHTTP("GET", s.URL+`/query`, map[string]string{"q": "SHOW DATABASES"}, nil, "")
|
||||
if status != http.StatusOK {
|
||||
t.Fatalf("unexpected status: %d", status)
|
||||
} else if body != `{"results":[{"series":[{"columns":["name"],"values":[["bar"],["foo"]]}]}]}` {
|
||||
t.Fatalf("unexpected body: %s", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandler_DatabasesPrettyPrinted(t *testing.T) {
|
||||
c := test.NewMessagingClient()
|
||||
defer c.Close()
|
||||
srvr := OpenAuthlessServer(c)
|
||||
srvr.CreateDatabase("foo")
|
||||
srvr.CreateDatabase("bar")
|
||||
s := NewHTTPServer(srvr)
|
||||
defer s.Close()
|
||||
|
||||
status, body := MustHTTP("GET", s.URL+`/query`, map[string]string{"q": "SHOW DATABASES", "pretty": "true"}, nil, "")
|
||||
if status != http.StatusOK {
|
||||
t.Fatalf("unexpected status: %d", status)
|
||||
} else if body != `{
|
||||
"results": [
|
||||
{
|
||||
"series": [
|
||||
{
|
||||
"columns": [
|
||||
"name"
|
||||
],
|
||||
"values": [
|
||||
[
|
||||
"bar"
|
||||
],
|
||||
[
|
||||
"foo"
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}` {
|
||||
t.Fatalf("unexpected body: %s", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandler_CreateDatabase(t *testing.T) {
|
||||
c := test.NewMessagingClient()
|
||||
defer c.Close()
|
||||
|
|
|
@ -2308,7 +2308,7 @@ func (s *Server) executeDropDatabaseStatement(q *influxql.DropDatabaseStatement,
|
|||
}
|
||||
|
||||
func (s *Server) executeShowDatabasesStatement(q *influxql.ShowDatabasesStatement, user *User) *Result {
|
||||
row := &influxql.Row{Columns: []string{"name"}}
|
||||
row := &influxql.Row{Name: "databases", Columns: []string{"name"}}
|
||||
for _, name := range s.Databases() {
|
||||
row.Values = append(row.Values, []interface{}{name})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue