File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed
Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ services:
1818 - AWS_REGION=us-east-1
1919 - AWS_ACCESS_KEY_ID=test
2020 - AWS_SECRET_ACCESS_KEY=test
21- - DISABLE_QUEUE_WORKER=true
21+ - DISABLE_QUEUE_WORKER=false
2222 build :
2323 context : ./
2424 dockerfile : Dockerfile
Original file line number Diff line number Diff line change 109109 end
110110
111111 describe ".perform" do
112- it "attempts to indexes an event" do
112+ it "logs the indexing attempt" do
113+ allow ( Rails . logger ) . to ( receive ( :info ) )
114+
115+ allow ( event . __elasticsearch__ ) . to ( receive ( :index_document ) . and_return ( "result" => "created" ) )
116+
117+ described_class . perform_now ( event )
118+
119+ expect ( Rails . logger )
120+ . to ( have_received ( :info )
121+ . with ( "[Events:EventIndexJob] Indexing event: #{ event . uuid } in OpenSearch" ) )
122+ end
123+
124+ it "attempts to index an event" do
113125 allow ( event . __elasticsearch__ ) . to ( receive ( :index_document ) . and_return ( "result" => "created" ) )
114126
115127 described_class . perform_now ( event )
116128
117129 expect ( event . __elasticsearch__ ) . to ( have_received ( :index_document ) . once )
118130 end
119131
120- it "when indexing successfully creates an event document does not log anything" do
132+ it "when indexing successfully creates an event document logs an info message" do
133+ allow ( Rails . logger ) . to ( receive ( :info ) )
134+
121135 allow ( event . __elasticsearch__ ) . to ( receive ( :index_document ) . and_return ( "result" => "created" ) )
122136
123137 described_class . perform_now ( event )
124138
125- expect ( Rails . logger ) . not_to ( have_received ( :error ) )
139+ expect ( Rails . logger )
140+ . to ( have_received ( :info )
141+ . with ( "[Events:EventIndexJob] Successfully indexed event: #{ event . uuid } in OpenSearch" ) )
126142 end
127143
128- it "when indexing successfully updates an event document does not log anything " do
144+ it "when indexing successfully updates an event document does not log error " do
129145 allow ( event . __elasticsearch__ ) . to ( receive ( :index_document ) . and_return ( "result" => "updated" ) )
130146
131147 described_class . perform_now ( event )
Original file line number Diff line number Diff line change @@ -7,5 +7,6 @@ exec 2>&1
77# Disble starting the queue worker when the environment variable DISABLE_QUEUE_WORKER is set to "true".
88# This value is set in the docker-compose.yml file
99if [ " $DISABLE_QUEUE_WORKER " != " true" ]; then
10+ echo " Starting Shoryuken worker"
1011 exec /sbin/setuser app bundle exec shoryuken -R -C config/shoryuken.yml
1112fi
You can’t perform that action at this time.
0 commit comments