11#! /usr/bin/env bash
22
3- # uses '|| true' to make sure that even if there is an error,
3+ code=0
4+ set -x
5+
6+ # uses '|| code=$?' to make sure that even if there is an error,
47# the maven build continues and stops the docker image
5- curl -XPUT " localhost:$1 /_ingest/pipeline/rosapi?pretty" -d'
8+ # the exit codes will be appended to the output file for later verification
9+
10+ curl -fsSL -H " Content-Type: application/json" -XPUT " localhost:$1 /_ingest/pipeline/rosapi?pretty" -d'
611{
712 "processors": [
813 {
@@ -52,10 +57,10 @@ curl -XPUT "localhost:$1/_ingest/pipeline/rosapi?pretty" -d'
5257 }
5358 ]
5459}
55- ' || true
60+ ' || (( code ++ ))
5661
5762# Pipeline without categories since it only supports English
58- curl -XPUT " localhost:$1 /_ingest/pipeline/rosapi_jpn?pretty" -d'
63+ curl -fsSL -H " Content-Type: application/json " - XPUT " localhost:$1 /_ingest/pipeline/rosapi_jpn?pretty" -d'
5964{
6065 "processors": [
6166 {
@@ -99,9 +104,9 @@ curl -XPUT "localhost:$1/_ingest/pipeline/rosapi_jpn?pretty" -d'
99104 }
100105 ]
101106}
102- ' || true
107+ ' || (( code ++ ))
103108
104- curl -XPUT " localhost:$1 /test_idx?pretty" -d'
109+ curl -fsSL -H " Content-Type: application/json " - XPUT " localhost:$1 /test_idx?pretty" -d'
105110{
106111 "mappings": {
107112 "rosette": {
@@ -117,30 +122,30 @@ curl -XPUT "localhost:$1/test_idx?pretty" -d'
117122 }
118123 }
119124}
120- ' || true
125+ ' || (( code ++ ))
121126
122- curl -XPUT " localhost:$1 /test_idx/rosette/1?pretty&refresh=true&pipeline=rosapi" -d'
127+ curl -fsSL -H " Content-Type: application/json " - XPUT " localhost:$1 /test_idx/rosette/1?pretty&refresh=true&pipeline=rosapi" -d'
123128{
124129 "text": "Original Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, couldn’t be more pleased with the new all-female Ghostbusters cast, telling The Hollywood Reporter, “The Aykroyd family is delighted by this inheritance of the Ghostbusters torch by these most magnificent women in comedy.”"
125130}
126- ' || true
131+ ' || (( code ++ ))
127132
128- curl -XPUT " localhost:$1 /test_idx/rosette/2?pretty&refresh=true&pipeline=rosapi_jpn" -d'
133+ curl -fsSL -H " Content-Type: application/json " - XPUT " localhost:$1 /test_idx/rosette/2?pretty&refresh=true&pipeline=rosapi_jpn" -d'
129134{
130135 "text": "バングラデシュ政府、ロヒンギャ難民の島への移動を計画
\nバングラデシュ政府、ロヒンギャ難民の島への移動を計画\n\nテンガール・チャール島は約10年前に、メグナ川の堆積土で形成され、高潮の際には数十センチの水に囲まれてしまう。道路や堤防などは築かれておらず、島を記載する地図はあまりない。\n\n約30キロ西には60万人が住むハティア島があり、現在の難民キャンプからの移動には9時間かかる。\n\nある地元政府関係者はAFP通信に対し、テンガール・チャール島について、「島に行けるのは冬のみで、海賊たちの隠れ家になっている」と語った。島を洪水から守るため植樹が行われているが、完了するまでには少なくとも10年がかかるという。同関係者は、「モンスーンの季節には完全に水浸しになってしまう」と話し、「あそこに住まわせるというのは、ひどいアイデアだ」と指摘した。\n\nImage caption 移住が計画されているテンガール・チャール島はハティア(Hatiya)島の近くにある\n\nミャンマーでは、ロヒンギャの人々は国境を接するバングラデシュからの不法移民として扱われており、国籍の取得ができずにいる。\n\n"
131136}
132- ' || true
137+ ' || (( code ++ ))
133138
134- curl -XPUT " localhost:$1 /test_idx/rosette/3?pretty&refresh=true&pipeline=rosapi" -d'
139+ curl -fsSL -H " Content-Type: application/json " - XPUT " localhost:$1 /test_idx/rosette/3?pretty&refresh=true&pipeline=rosapi" -d'
135140{
136141 "text" : "Vladimir Vladimirovich Nabokov was a Russian-American novelist and entomologist. His first nine novels were in Russian, and he achieved international prominence after he began writing English prose.",
137142 "name" : "Vladimir Nabokov"
138143}
139- ' || true
144+ ' || (( code ++ ))
140145
141146sleep 3
142147
143- curl -XPOST " localhost:$1 /test_idx/_search?pretty" -d'
148+ curl -fsSL -H " Content-Type: application/json " - XPOST " localhost:$1 /test_idx/_search?pretty" -d'
144149{
145150 "query": {
146151 "constant_score" : {
@@ -150,4 +155,7 @@ curl -XPOST "localhost:$1/test_idx/_search?pretty" -d'
150155 }
151156 }
152157}
153- ' || true
158+ ' || (( code++ ))
159+
160+ set +x
161+ echo " exit: $code "
0 commit comments