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