Fix #501. Writes with invalid payload should be rejected
parent
4ef7faa8ee
commit
29c55c1854
|
@ -2,6 +2,8 @@
|
|||
|
||||
### Bugfixes
|
||||
|
||||
- [Issue #501](https://github.com/influxdb/influxdb/issues/501). Writes with invalid payload should be rejected
|
||||
|
||||
## v0.6.0 [2014-05-02]
|
||||
|
||||
### Feature
|
||||
|
|
|
@ -56,6 +56,10 @@ func ConvertToDataStoreSeries(s ApiSeries, precision TimePrecision) (*protocol.S
|
|||
var sequence *uint64
|
||||
|
||||
for idx, field := range s.GetColumns() {
|
||||
if idx >= len(point) {
|
||||
return nil, fmt.Errorf("invalid payload")
|
||||
}
|
||||
|
||||
value := point[idx]
|
||||
if field == "time" {
|
||||
switch value.(type) {
|
||||
|
|
|
@ -59,6 +59,19 @@ func (self *SingleServerSuite) TestConflictStatusCode(c *C) {
|
|||
c.Assert(client.CreateDatabase("test_conflict"), ErrorMatches, "Server returned \\(409\\).*")
|
||||
}
|
||||
|
||||
// issue #497
|
||||
func (self *SingleServerSuite) TestInvalidDataWrite(c *C) {
|
||||
client := self.server.GetClient("db1", c)
|
||||
series := &influxdb.Series{
|
||||
Name: "test_invalid_data",
|
||||
Columns: []string{"foo", "bar"},
|
||||
Points: [][]interface{}{
|
||||
[]interface{}{1.0},
|
||||
},
|
||||
}
|
||||
c.Assert(client.WriteSeries([]*influxdb.Series{series}), ErrorMatches, ".*\\(400\\).*invalid.*")
|
||||
}
|
||||
|
||||
func (self *SingleServerSuite) TestLargeDeletes(c *C) {
|
||||
numberOfPoints := 2 * 1024 * 1024
|
||||
data := CreatePoints("test_large_deletes", 1, numberOfPoints)
|
||||
|
|
Loading…
Reference in New Issue