Commit 599454142aeebeb6253c331bd57bba33e9386bcc

Authored by Andrew Kane
1 parent 4e1317de

Test language plugins on Travis

test/ci/install_elasticsearch.sh
@@ -14,6 +14,16 @@ if [ ! -d "$CACHE_DIR" ]; then @@ -14,6 +14,16 @@ if [ ! -d "$CACHE_DIR" ]; then
14 wget -O elasticsearch-$ELASTICSEARCH_VERSION.tar.gz $URL 14 wget -O elasticsearch-$ELASTICSEARCH_VERSION.tar.gz $URL
15 tar xvfz elasticsearch-$ELASTICSEARCH_VERSION.tar.gz 15 tar xvfz elasticsearch-$ELASTICSEARCH_VERSION.tar.gz
16 mv elasticsearch-$ELASTICSEARCH_VERSION $CACHE_DIR 16 mv elasticsearch-$ELASTICSEARCH_VERSION $CACHE_DIR
  17 +
  18 + cd $CACHE_DIR
  19 +
  20 + bin/elasticsearch-plugin install analysis-kuromoji
  21 + if [[ $ELASTICSEARCH_VERSION != 6.0.* ]]; then
  22 + bin/elasticsearch-plugin install analysis-nori
  23 + fi
  24 + bin/elasticsearch-plugin install analysis-smartcn
  25 + bin/elasticsearch-plugin install analysis-stempel
  26 + bin/elasticsearch-plugin install analysis-ukrainian
17 else 27 else
18 echo "Elasticsearch cached" 28 echo "Elasticsearch cached"
19 fi 29 fi
test/language_test.rb
@@ -2,12 +2,14 @@ require_relative "test_helper" @@ -2,12 +2,14 @@ require_relative "test_helper"
2 2
3 class LanguageTest < Minitest::Test 3 class LanguageTest < Minitest::Test
4 def setup 4 def setup
5 - skip unless ENV["TEST_LANGUAGE"] 5 + skip "Requires plugin" unless ci? || ENV["TEST_LANGUAGE"]
6 6
7 Song.destroy_all 7 Song.destroy_all
8 end 8 end
9 9
10 def test_chinese 10 def test_chinese
  11 + skip if ci?
  12 +
11 # requires https://github.com/medcl/elasticsearch-analysis-ik 13 # requires https://github.com/medcl/elasticsearch-analysis-ik
12 with_options(Song, language: "chinese") do 14 with_options(Song, language: "chinese") do
13 store_names ["中华人民共和国国歌"], Song 15 store_names ["中华人民共和国国歌"], Song
@@ -38,6 +40,8 @@ class LanguageTest &lt; Minitest::Test @@ -38,6 +40,8 @@ class LanguageTest &lt; Minitest::Test
38 end 40 end
39 41
40 def test_korean 42 def test_korean
  43 + skip if ci?
  44 +
41 # requires https://github.com/open-korean-text/elasticsearch-analysis-openkoreantext 45 # requires https://github.com/open-korean-text/elasticsearch-analysis-openkoreantext
42 with_options(Song, language: "korean") do 46 with_options(Song, language: "korean") do
43 store_names ["한국어를 처리하는 예시입니닼ㅋㅋ"], Song 47 store_names ["한국어를 처리하는 예시입니닼ㅋㅋ"], Song
@@ -48,6 +52,8 @@ class LanguageTest &lt; Minitest::Test @@ -48,6 +52,8 @@ class LanguageTest &lt; Minitest::Test
48 end 52 end
49 53
50 def test_korean2 54 def test_korean2
  55 + skip if Searchkick.server_below?("6.4.0")
  56 +
51 # requires https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-nori.html 57 # requires https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-nori.html
52 with_options(Song, language: "korean2") do 58 with_options(Song, language: "korean2") do
53 store_names ["한국어를 처리하는 예시입니닼ㅋㅋ"], Song 59 store_names ["한국어를 처리하는 예시입니닼ㅋㅋ"], Song
@@ -74,6 +80,8 @@ class LanguageTest &lt; Minitest::Test @@ -74,6 +80,8 @@ class LanguageTest &lt; Minitest::Test
74 end 80 end
75 81
76 def test_vietnamese 82 def test_vietnamese
  83 + skip if ci?
  84 +
77 # requires https://github.com/duydo/elasticsearch-analysis-vietnamese 85 # requires https://github.com/duydo/elasticsearch-analysis-vietnamese
78 with_options(Song, language: "vietnamese") do 86 with_options(Song, language: "vietnamese") do
79 store_names ["công nghệ thông tin Việt Nam"], Song 87 store_names ["công nghệ thông tin Việt Nam"], Song
test/test_helper.rb
@@ -141,4 +141,8 @@ class Minitest::Test @@ -141,4 +141,8 @@ class Minitest::Test
141 def default_model 141 def default_model
142 Product 142 Product
143 end 143 end
  144 +
  145 + def ci?
  146 + ENV["CI"]
  147 + end
144 end 148 end