From 7a434d562fbfba6ca9522942df589220cc671049 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Tue, 23 Jun 2015 14:21:03 -0500 Subject: [PATCH 01/10] Call _refresh to ensure index is refreshed before getting the status --- goes_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/goes_test.go b/goes_test.go index 3334d30..944205b 100644 --- a/goes_test.go +++ b/goes_test.go @@ -5,13 +5,14 @@ package goes import ( - . "gopkg.in/check.v1" "net/http" "net/url" "os" "strings" "testing" "time" + + . "gopkg.in/check.v1" ) var ( @@ -787,6 +788,8 @@ func (s *GoesTestSuite) TestIndexStatus(c *C) { // gives ES some time to do its job time.Sleep(1 * time.Second) + _, err = conn.RefreshIndex(indexName) + c.Assert(err, IsNil) response, err := conn.IndexStatus([]string{"testindexstatus"}) c.Assert(err, IsNil) From 538861b257989a5b4a0a089e1ee3f025f8d0920b Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Tue, 23 Jun 2015 17:54:45 -0500 Subject: [PATCH 02/10] Update ES and Go versions in the matrix --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 18e7b30..f02a429 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ go: - 1.1 - 1.2 - 1.3 + - 1.4.2 - tip env: @@ -11,10 +12,14 @@ env: - ES_VERSION=1.0.3 - ES_VERSION=1.1.2 - ES_VERSION=1.2.1 + - ES_VERSION=1.3.4 + - ES_VERSION=1.4.4 + - ES_VERSION=1.5.2 + - ES_VERSION=1.6.0 before_script: - mkdir ${HOME}/elasticsearch - - wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz + - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-{ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & From c4704e7261f5c52f386ba948aea1261625e0be19 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Tue, 23 Jun 2015 17:57:44 -0500 Subject: [PATCH 03/10] Missing dollar sign --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f02a429..a0655f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ env: before_script: - mkdir ${HOME}/elasticsearch - - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-{ES_VERSION}.tar.gz + - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & From bf23e36aa24ebd420b551513798c3cdffc9f38d0 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Tue, 23 Jun 2015 18:21:38 -0500 Subject: [PATCH 04/10] Enable ES groovy sandbox --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a0655f3..931aeb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ before_script: - mkdir ${HOME}/elasticsearch - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch + - echo 'script.groovy.sandbox.enabled: true' >> ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & install: From 51df70436b75df923207270eb192318aefd5ce9b Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Wed, 24 Jun 2015 09:21:06 -0500 Subject: [PATCH 05/10] Wrap command in quotes so it is treated as a single command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 931aeb5..91aecf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_script: - mkdir ${HOME}/elasticsearch - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch - - echo 'script.groovy.sandbox.enabled: true' >> ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml + - "echo 'script.groovy.sandbox.enabled: true' >> ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml" - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & install: From 953759da481b990c98006a64017d3d4cc4096399 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Wed, 24 Jun 2015 10:32:01 -0500 Subject: [PATCH 06/10] Handle variance in refresh count between ES versions --- goes_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/goes_test.go b/goes_test.go index 944205b..868b5fe 100644 --- a/goes_test.go +++ b/goes_test.go @@ -799,9 +799,11 @@ func (s *GoesTestSuite) TestIndexStatus(c *C) { primarySizeInBytes := response.Indices[indexName].Index["primary_size_in_bytes"].(float64) sizeInBytes := response.Indices[indexName].Index["size_in_bytes"].(float64) + refreshTotal := response.Indices[indexName].Refresh["total"].(float64) c.Assert(primarySizeInBytes > 0, Equals, true) c.Assert(sizeInBytes > 0, Equals, true) + c.Assert(refreshTotal > 0, Equals, true) expectedIndices := map[string]IndexStatus{ indexName: { @@ -827,7 +829,7 @@ func (s *GoesTestSuite) TestIndexStatus(c *C) { "total_size_in_bytes": float64(0), }, Refresh: map[string]interface{}{ - "total": float64(1), + "total": refreshTotal, "total_time_in_millis": float64(0), }, Flush: map[string]interface{}{ From 06c82c2420736558ed6f4e97cbc4f550ff6c45a4 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Wed, 24 Jun 2015 13:56:01 -0500 Subject: [PATCH 07/10] Select scripting lang as groovy for older ES versions --- goes_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/goes_test.go b/goes_test.go index 868b5fe..704783e 100644 --- a/goes_test.go +++ b/goes_test.go @@ -1159,6 +1159,7 @@ func (s *GoesTestSuite) TestUpdate(c *C) { // Now that we have an ordinary document indexed, try updating it query := map[string]interface{}{ "script": "ctx._source.counter += count", + "lang": "groovy", "params": map[string]interface{}{ "count": 5, }, @@ -1170,7 +1171,7 @@ func (s *GoesTestSuite) TestUpdate(c *C) { } response, err = conn.Update(d, query, extraArgs) - if err != nil && strings.Contains(err.(*SearchError).Msg, "dynamic scripting disabled") { + if err != nil && strings.Contains(err.(*SearchError).Msg, "dynamic scripting") { c.Skip("Scripting is disabled on server, skipping this test") return } From f41e425728461e05ac28f760a0e264abb9b26418 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Wed, 24 Jun 2015 14:23:04 -0500 Subject: [PATCH 08/10] Make sure groovy is installed for older ES versions --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 91aecf3..3e6c705 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ before_script: - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch - "echo 'script.groovy.sandbox.enabled: true' >> ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml" + - 'if [ "${ES_VERSION}" < "1.3" ]; then ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/plugin --install lang-groovy; fi' - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & install: From 00b9bbc858251e74d2cd4a1c23dc6d4376423a18 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Wed, 24 Jun 2015 16:27:37 -0500 Subject: [PATCH 09/10] Use correct comparison brackets --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3e6c705..b978ba4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_script: - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch - "echo 'script.groovy.sandbox.enabled: true' >> ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml" - - 'if [ "${ES_VERSION}" < "1.3" ]; then ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/plugin --install lang-groovy; fi' + - 'if [[ "${ES_VERSION}" < "1.3" ]]; then ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/plugin --install lang-groovy; fi' - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & install: From 2f906c980ed589a60c4d11d726132e27db77976e Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Wed, 24 Jun 2015 18:44:13 -0500 Subject: [PATCH 10/10] Different groovy plugin versions depending on ES version --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b978ba4..9fd3745 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,9 @@ go: env: matrix: - - ES_VERSION=1.0.3 - - ES_VERSION=1.1.2 - - ES_VERSION=1.2.1 + - ES_VERSION=1.0.3 GROOVY_VER=2.0.0 + - ES_VERSION=1.1.2 GROOVY_VER=2.0.0 + - ES_VERSION=1.2.1 GROOVY_VER=2.2.0 - ES_VERSION=1.3.4 - ES_VERSION=1.4.4 - ES_VERSION=1.5.2 @@ -22,7 +22,7 @@ before_script: - wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz - tar -xzf elasticsearch-${ES_VERSION}.tar.gz -C ${HOME}/elasticsearch - "echo 'script.groovy.sandbox.enabled: true' >> ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/config/elasticsearch.yml" - - 'if [[ "${ES_VERSION}" < "1.3" ]]; then ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/plugin --install lang-groovy; fi' + - 'if [[ "${ES_VERSION}" < "1.3" ]]; then ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/plugin --install elasticsearch/elasticsearch-lang-groovy/${GROOVY_VER}; fi' - ${HOME}/elasticsearch/elasticsearch-${ES_VERSION}/bin/elasticsearch >/dev/null & install: