Merge pull request #5 from bobrik/breaking-1.0

Tests pass on 1.0
This commit is contained in:
Jérôme Renard 2014-03-15 18:39:32 +01:00
commit 38d1993591
2 changed files with 4 additions and 25 deletions

View File

@ -130,7 +130,6 @@ func (s *GoesTestSuite) TestCreateIndex(c *C) {
resp, err := conn.CreateIndex(indexName, mapping) resp, err := conn.CreateIndex(indexName, mapping)
c.Assert(err, IsNil) c.Assert(err, IsNil)
c.Assert(resp.Ok, Equals, true)
c.Assert(resp.Acknowledged, Equals, true) c.Assert(resp.Acknowledged, Equals, true)
} }
@ -155,7 +154,6 @@ func (s *GoesTestSuite) TestDeleteIndexExistingIndex(c *C) {
c.Assert(err, IsNil) c.Assert(err, IsNil)
expectedResponse := Response{} expectedResponse := Response{}
expectedResponse.Ok = true
expectedResponse.Acknowledged = true expectedResponse.Acknowledged = true
c.Assert(resp, DeepEquals, expectedResponse) c.Assert(resp, DeepEquals, expectedResponse)
} }
@ -167,9 +165,8 @@ func (s *GoesTestSuite) TestRefreshIndex(c *C) {
_, err := conn.CreateIndex(indexName, map[string]interface{}{}) _, err := conn.CreateIndex(indexName, map[string]interface{}{})
c.Assert(err, IsNil) c.Assert(err, IsNil)
resp, err := conn.RefreshIndex(indexName) _, err = conn.RefreshIndex(indexName)
c.Assert(err, IsNil) c.Assert(err, IsNil)
c.Assert(resp.Ok, Equals, true)
_, err = conn.DeleteIndex(indexName) _, err = conn.DeleteIndex(indexName)
c.Assert(err, IsNil) c.Assert(err, IsNil)
@ -210,7 +207,6 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
response, err := conn.BulkSend(indexName, tweets) response, err := conn.BulkSend(indexName, tweets)
i := Item{ i := Item{
Ok: true,
Id: "123", Id: "123",
Type: docType, Type: docType,
Version: 1, Version: 1,
@ -267,7 +263,6 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
response, err = conn.BulkSend(indexName, docToDelete) response, err = conn.BulkSend(indexName, docToDelete)
i = Item{ i = Item{
Ok: true,
Id: "123", Id: "123",
Type: docType, Type: docType,
Version: 2, Version: 2,
@ -339,7 +334,6 @@ func (s *GoesTestSuite) TestIndexIdDefined(c *C) {
c.Assert(err, IsNil) c.Assert(err, IsNil)
expectedResponse := Response{ expectedResponse := Response{
Ok: true,
Index: indexName, Index: indexName,
Id: docId, Id: docId,
Type: docType, Type: docType,
@ -373,7 +367,6 @@ func (s *GoesTestSuite) TestIndexIdNotDefined(c *C) {
response, err := conn.Index(d, url.Values{}) response, err := conn.Index(d, url.Values{})
c.Assert(err, IsNil) c.Assert(err, IsNil)
c.Assert(response.Ok, Equals, true)
c.Assert(response.Index, Equals, indexName) c.Assert(response.Index, Equals, indexName)
c.Assert(response.Type, Equals, docType) c.Assert(response.Type, Equals, docType)
c.Assert(response.Version, Equals, 1) c.Assert(response.Version, Equals, 1)
@ -409,7 +402,6 @@ func (s *GoesTestSuite) TestDelete(c *C) {
c.Assert(err, IsNil) c.Assert(err, IsNil)
expectedResponse := Response{ expectedResponse := Response{
Ok: true,
Found: true, Found: true,
Index: indexName, Index: indexName,
Type: docType, Type: docType,
@ -423,7 +415,6 @@ func (s *GoesTestSuite) TestDelete(c *C) {
c.Assert(err, IsNil) c.Assert(err, IsNil)
expectedResponse = Response{ expectedResponse = Response{
Ok: true,
Found: false, Found: false,
Index: indexName, Index: indexName,
Type: docType, Type: docType,
@ -468,7 +459,7 @@ func (s *GoesTestSuite) TestGet(c *C) {
Type: docType, Type: docType,
Id: docId, Id: docId,
Version: 1, Version: 1,
Exists: true, Found: true,
Source: source, Source: source,
} }
@ -484,9 +475,9 @@ func (s *GoesTestSuite) TestGet(c *C) {
Type: docType, Type: docType,
Id: docId, Id: docId,
Version: 1, Version: 1,
Exists: true, Found: true,
Fields: map[string]interface{}{ Fields: map[string]interface{}{
"f1": "foo", "f1": []interface{}{"foo"},
}, },
} }
@ -575,17 +566,13 @@ func (s *GoesTestSuite) TestIndexStatus(c *C) {
response, err := conn.IndexStatus([]string{"_all"}) response, err := conn.IndexStatus([]string{"_all"})
c.Assert(err, IsNil) c.Assert(err, IsNil)
c.Assert(response.Ok, Equals, true)
expectedShards := Shard{Total: 2, Successful: 1, Failed: 0} expectedShards := Shard{Total: 2, Successful: 1, Failed: 0}
c.Assert(response.Shards, Equals, expectedShards) c.Assert(response.Shards, Equals, expectedShards)
expectedIndices := map[string]IndexStatus{ expectedIndices := map[string]IndexStatus{
indexName: IndexStatus{ indexName: IndexStatus{
Index: map[string]interface{}{ Index: map[string]interface{}{
"primary_size": "99b",
"primary_size_in_bytes": float64(99), "primary_size_in_bytes": float64(99),
"size": "99b",
"size_in_bytes": float64(99), "size_in_bytes": float64(99),
}, },
Translog: map[string]uint64{ Translog: map[string]uint64{
@ -599,23 +586,18 @@ func (s *GoesTestSuite) TestIndexStatus(c *C) {
Merges: map[string]interface{}{ Merges: map[string]interface{}{
"current": float64(0), "current": float64(0),
"current_docs": float64(0), "current_docs": float64(0),
"current_size": "0b",
"current_size_in_bytes": float64(0), "current_size_in_bytes": float64(0),
"total": float64(0), "total": float64(0),
"total_time": "0s",
"total_time_in_millis": float64(0), "total_time_in_millis": float64(0),
"total_docs": float64(0), "total_docs": float64(0),
"total_size": "0b",
"total_size_in_bytes": float64(0), "total_size_in_bytes": float64(0),
}, },
Refresh: map[string]interface{}{ Refresh: map[string]interface{}{
"total": float64(1), "total": float64(1),
"total_time": "0s",
"total_time_in_millis": float64(0), "total_time_in_millis": float64(0),
}, },
Flush: map[string]interface{}{ Flush: map[string]interface{}{
"total": float64(0), "total": float64(0),
"total_time": "0s",
"total_time_in_millis": float64(0), "total_time_in_millis": float64(0),
}, },
}, },

View File

@ -52,7 +52,6 @@ type Request struct {
// Represents a Response from elasticsearch // Represents a Response from elasticsearch
type Response struct { type Response struct {
Ok bool
Acknowledged bool Acknowledged bool
Error string Error string
Status uint64 Status uint64
@ -73,7 +72,6 @@ type Response struct {
Items []map[string]Item `json:"items,omitempty"` Items []map[string]Item `json:"items,omitempty"`
// Used by the GET API // Used by the GET API
Exists bool
Source map[string]interface{} `json:"_source"` Source map[string]interface{} `json:"_source"`
Fields map[string]interface{} `json:"fields"` Fields map[string]interface{} `json:"fields"`
@ -96,7 +94,6 @@ type Document struct {
// Represents the "items" field in a _bulk response // Represents the "items" field in a _bulk response
type Item struct { type Item struct {
Ok bool `json:"ok"`
Type string `json:"_type"` Type string `json:"_type"`
Id string `json:"_id"` Id string `json:"_id"`
Index string `json:"_index"` Index string `json:"_index"`