From 961c04cae992eadb42d286d2f85f8a675bdc68c8 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 29 Jan 2018 14:17:40 -0800 Subject: Upgrading server dependancies (#8154) --- .../olivere/elastic.v5/bulk_delete_request_test.go | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'vendor/gopkg.in/olivere/elastic.v5/bulk_delete_request_test.go') 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() } -- cgit v1.2.3-1-g7c22