diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-01-29 14:17:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 14:17:40 -0800 |
commit | 961c04cae992eadb42d286d2f85f8a675bdc68c8 (patch) | |
tree | 3408f2d06f847e966c53485e2d54c692cdd037c1 /vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go | |
parent | 8d66523ba7d9a77129844be476732ebfd5272d64 (diff) | |
download | chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.tar.gz chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.tar.bz2 chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.zip |
Upgrading server dependancies (#8154)
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go')
-rw-r--r-- | vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go b/vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go index 6ac429d8b..8635e34d1 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go +++ b/vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go @@ -15,23 +15,23 @@ func TestBulkDeleteRequestSerialization(t *testing.T) { }{ // #0 { - Request: NewBulkDeleteRequest().Index("index1").Type("tweet").Id("1"), + Request: NewBulkDeleteRequest().Index("index1").Type("doc").Id("1"), Expected: []string{ - `{"delete":{"_id":"1","_index":"index1","_type":"tweet"}}`, + `{"delete":{"_index":"index1","_type":"doc","_id":"1"}}`, }, }, // #1 { - Request: NewBulkDeleteRequest().Index("index1").Type("tweet").Id("1").Parent("2"), + Request: NewBulkDeleteRequest().Index("index1").Type("doc").Id("1").Parent("2"), Expected: []string{ - `{"delete":{"_id":"1","_index":"index1","_parent":"2","_type":"tweet"}}`, + `{"delete":{"_index":"index1","_type":"doc","_id":"1","parent":"2"}}`, }, }, // #2 { - Request: NewBulkDeleteRequest().Index("index1").Type("tweet").Id("1").Routing("3"), + Request: NewBulkDeleteRequest().Index("index1").Type("doc").Id("1").Routing("3"), Expected: []string{ - `{"delete":{"_id":"1","_index":"index1","_routing":"3","_type":"tweet"}}`, + `{"delete":{"_index":"index1","_type":"doc","_id":"1","routing":"3"}}`, }, }, } @@ -58,11 +58,22 @@ func TestBulkDeleteRequestSerialization(t *testing.T) { var bulkDeleteRequestSerializationResult string func BenchmarkBulkDeleteRequestSerialization(b *testing.B) { - r := NewBulkDeleteRequest().Index(testIndexName).Type("tweet").Id("1") + b.Run("stdlib", func(b *testing.B) { + r := NewBulkDeleteRequest().Index(testIndexName).Type("doc").Id("1") + benchmarkBulkDeleteRequestSerialization(b, r.UseEasyJSON(false)) + }) + b.Run("easyjson", func(b *testing.B) { + r := NewBulkDeleteRequest().Index(testIndexName).Type("doc").Id("1") + benchmarkBulkDeleteRequestSerialization(b, r.UseEasyJSON(true)) + }) +} + +func benchmarkBulkDeleteRequestSerialization(b *testing.B, r *BulkDeleteRequest) { var s string for n := 0; n < b.N; n++ { s = r.String() r.source = nil // Don't let caching spoil the benchmark } bulkDeleteRequestSerializationResult = s // ensure the compiler doesn't optimize + b.ReportAllocs() } |