health_check 2.5.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.travis.yml +162 -111
  4. data/CHANGELOG +36 -0
  5. data/README.rdoc +109 -43
  6. data/Rakefile +1 -1
  7. data/Vagrantfile +32 -0
  8. data/config/routes.rb +1 -1
  9. data/health_check.gemspec +7 -6
  10. data/lib/health_check.rb +51 -6
  11. data/lib/health_check/elasticsearch_health_check.rb +15 -0
  12. data/lib/health_check/health_check_controller.rb +32 -25
  13. data/lib/health_check/health_check_routes.rb +1 -1
  14. data/lib/health_check/middleware_health_check.rb +6 -1
  15. data/lib/health_check/rabbitmq_health_check.rb +16 -0
  16. data/lib/health_check/redis_health_check.rb +20 -7
  17. data/lib/health_check/s3_health_check.rb +9 -14
  18. data/lib/health_check/utils.rb +55 -33
  19. data/lib/health_check/version.rb +1 -1
  20. data/test/fake_smtp_server +143 -24
  21. data/test/init_variables +19 -1
  22. data/test/migrate/nine/9_create_countries.rb +1 -1
  23. data/test/migrate/twelve/011_create_roles.roles.rb +1 -1
  24. data/test/migrate/twelve/012_create_users.rb +2 -2
  25. data/test/migrate/twelve/9_create_countries.rb +1 -1
  26. data/test/provision_vagrant +103 -0
  27. data/test/rails_5.0.gemfile +10 -7
  28. data/test/rails_5.1.gemfile +34 -0
  29. data/test/rails_5.2.gemfile +34 -0
  30. data/test/rails_6.0.gemfile +30 -0
  31. data/test/rails_6.1.gemfile +29 -0
  32. data/test/rails_6.2.gemfile +30 -0
  33. data/test/rails_edge.gemfile +14 -9
  34. data/test/setup_railsapp +175 -95
  35. data/test/test_with_railsapp +152 -46
  36. data/test/testurl +9 -0
  37. metadata +45 -22
  38. data/test/rails_4.0.gemfile +0 -33
  39. data/test/rails_4.1.gemfile +0 -33
  40. data/test/rails_4.2.gemfile +0 -30
@@ -2,15 +2,49 @@
2
2
 
3
3
  route_prefix=medical_check
4
4
 
5
- err_report() {
6
- echo "$0: Error on line $1 - aborted"
7
- exit 1
5
+ # Any failure causes exit
6
+ set -eE -o functrace
7
+
8
+ report_failure() {
9
+ local lineno=$2
10
+ local fn=$3
11
+ local exitstatus=$4
12
+ local msg=$5
13
+ local lineno_fns=${1% 0}
14
+ if [[ $lineno_fns != "0" ]] ; then
15
+ lineno="${lineno} ${lineno_fns}"
16
+ fi
17
+ if [[ $exitstatus == 0 ]] ; then
18
+ echo "${BASH_SOURCE[1]}: Finished!"
19
+ else
20
+ echo "${BASH_SOURCE[1]}:${fn}[${lineno}] Failed with status ${exitstatus}: $msg"
21
+ fi
8
22
  }
9
23
 
10
- trap 'err_report $LINENO' ERR
24
+ trap 'report_failure "${BASH_LINENO[*]}" "$LINENO" "${FUNCNAME[*]:-script}" "$?" "$BASH_COMMAND"' ERR
25
+
11
26
 
12
27
  # Any failure causes exit
13
- set -e
28
+ set -eE -o functrace
29
+
30
+ report_failure() {
31
+ local lineno=$2
32
+ local fn=$3
33
+ local exitstatus=$4
34
+ local msg=$5
35
+ local lineno_fns=${1% 0}
36
+ if [[ $lineno_fns != "0" ]] ; then
37
+ lineno="${lineno} ${lineno_fns}"
38
+ fi
39
+ if [[ $exitstatus == 0 ]] ; then
40
+ echo "${BASH_SOURCE[1]}: Finished!"
41
+ else
42
+ echo "${BASH_SOURCE[1]}:${fn}[${lineno}] Failed with status ${exitstatus}: $msg"
43
+ fi
44
+ }
45
+
46
+ trap 'report_failure "${BASH_LINENO[*]}" "$LINENO" "${FUNCNAME[*]:-script}" "$?" "$BASH_COMMAND"' ERR
47
+
14
48
  export DISABLE_SPRING=1
15
49
 
16
50
  cleanup_db()
@@ -91,18 +125,25 @@ start_server()
91
125
  bundle_prefix='bundle exec'
92
126
  fi
93
127
  server_arg=${RAILS_SERVER:-webrick}
128
+ case "$actual_rails_version" in
129
+ *' '[12345].*)
130
+ ;;
131
+ *)
132
+ server_arg="-u $server_arg"
133
+ ;;
134
+ esac
94
135
  echo "start_server called using: `env | egrep '^RAILS|^RACK|^PATH='` $bundle_prefix $server_arg"
95
136
  case "$server_arg" in
96
- puma)
137
+ *puma)
97
138
  $bundle_prefix puma -b tcp://127.0.0.1:$port &
98
139
  ;;
99
- passenger)
140
+ *passenger)
100
141
  $bundle_prefix passenger start -p $port &
101
142
  ;;
102
- thin)
143
+ *thin)
103
144
  $bundle_prefix thin start -p $port &
104
145
  ;;
105
- unicorn)
146
+ *unicorn)
106
147
  $bundle_prefix unicorn_rails -l 127.0.0.1:$port &
107
148
  ;;
108
149
  *)
@@ -212,7 +253,7 @@ common_tests()
212
253
  test_no=$1
213
254
 
214
255
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
215
- echo "${test_no}: CHECKING routes exist..."
256
+ echo "${test_no}[line $LINENO]: CHECKING routes exist..."
216
257
  $rake routes | tee /tmp/t$$
217
258
  echo
218
259
  case `egrep ${route_prefix} /tmp/t$$ || true` in
@@ -225,7 +266,7 @@ common_tests()
225
266
 
226
267
  test_no=`expr 1 + $test_no`
227
268
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
228
- echo "${test_no}: TESTING can get a static file ..."
269
+ echo "${test_no}[line $LINENO]: TESTING can get a static file ..."
229
270
  case "$RAILS_ENV=`egrep '^\s*config.serve_static_[asetfil]* *= *false' config/environments/${RAILS_ENV}.rb`" in
230
271
  production*static*false*)
231
272
  echo " SKIPPED (disabled in production)"
@@ -238,40 +279,77 @@ common_tests()
238
279
  echo
239
280
  fi
240
281
 
282
+ rm -f tmp/health_check_success.txt tmp/health_check_failure.txt
283
+
241
284
  test_no=`expr 1 + $test_no`
242
285
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
243
- echo "${test_no}: TESTING can get an example controller ..."
244
- $testurl ${host}/example 200 text/html 'example page'
286
+ echo "${test_no}[line $LINENO]: TESTING can get an example controller ..."
287
+ $testurl ${host}/example 200 text/plain 'example page'
245
288
  echo
246
289
  fi
247
290
 
248
291
  test_no=`expr 1 + $test_no`
249
292
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
250
- echo "${test_no}: TESTING direct call to catchall method on example controller ..."
251
- $testurl ${host}/example/catchall 200 text/html 'catch all route'
293
+ echo "${test_no}[line $LINENO]: TESTING direct call to catchall method on example controller ..."
294
+ $testurl ${host}/example/catchall 200 text/plain 'catch all route'
252
295
  echo
253
296
  fi
254
297
 
298
+ if [ -f tmp/health_check_success.txt ] ; then
299
+ echo "FAIL tmp/health_check_success.txt exists on line $LINENO"
300
+ else
301
+ echo "PASS tmp/health_check_success.txt is missing as expected on line $LINENO"
302
+ fi
303
+ if [ -f tmp/health_check_failure.txt ] ; then
304
+ echo "FAIL tmp/health_check_failure.txt exists on line $LINENO"
305
+ else
306
+ echo "PASS tmp/health_check_failure.txt is missing as expected on line $LINENO"
307
+ fi
308
+
255
309
  test_no=`expr 1 + $test_no`
256
310
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
257
- echo "${test_no}: TESTING ${route_prefix}/migration should pass with no database migrations ..."
311
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/migration should pass with no database migrations ..."
258
312
  ls db/migrate
313
+ rm -f tmp/health_check_success.txt tmp/health_check_failure.txt
259
314
  $testurl ${host}/${route_prefix}/migration 200 text/plain $success
315
+ if [ -f tmp/health_check_success.txt ] ; then
316
+ echo "PASS tmp/health_check_success.txt exists as expected on line $LINENO"
317
+ cat tmp/health_check_success.txt
318
+ else
319
+ echo "FAIL tmp/health_check_success.txt is missing on line $LINENO"
320
+ fi
321
+ if [ -f tmp/health_check_failure.txt ] ; then
322
+ echo "FAIL tmp/health_check_failure.txt exists on line $LINENO"
323
+ else
324
+ echo "PASS tmp/health_check_failure.txt is missing as expected on line $LINENO"
325
+ fi
260
326
  echo
261
327
  fi
262
328
 
263
329
  test_no=`expr 1 + $test_no`
264
330
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
265
- echo "${test_no}: TESTING ${route_prefix}/migration should fail without initial database migration ..."
331
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/migration should fail without initial database migration ..."
266
332
  cp $base_dir/test/migrate/nine/* db/migrate
267
333
  ls db/migrate
334
+ rm -f tmp/health_check_success.txt tmp/health_check_failure.txt
268
335
  $testurl ${host}/${route_prefix}/migration 550 text/plain failed
336
+ if [ -f tmp/health_check_success.txt ] ; then
337
+ echo "FAIL tmp/health_check_success.txt exists on line $LINENO"
338
+ else
339
+ echo "PASS tmp/health_check_success.txt is missing as expected on line $LINENO"
340
+ fi
341
+ if [ -f tmp/health_check_failure.txt ] ; then
342
+ echo "PASS tmp/health_check_failure.txt exists as expected on line $LINENO"
343
+ cat tmp/health_check_failure.txt
344
+ else
345
+ echo "FAIL tmp/health_check_failure.txt is missing on line $LINENO"
346
+ fi
269
347
  echo
270
348
  fi
271
349
 
272
350
  test_no=`expr 1 + $test_no`
273
351
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
274
- echo "${test_no}: TESTING ${route_prefix}/database should pass without initial database migration (since it ignores the difference) ..."
352
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/database should pass without initial database migration (since it ignores the difference) ..."
275
353
  $testurl ${host}/${route_prefix}/database 200 text/plain $success
276
354
  echo
277
355
  fi
@@ -280,14 +358,14 @@ common_tests()
280
358
 
281
359
  test_no=`expr 1 + $test_no`
282
360
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
283
- echo "${test_no}: TESTING ${route_prefix}/site should pass ..."
361
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/site should pass ..."
284
362
  $testurl ${host}/${route_prefix}/site 200 text/plain $success
285
363
  echo
286
364
  fi
287
365
 
288
366
  test_no=`expr 1 + $test_no`
289
367
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
290
- echo "${test_no}: TESTING ${route_prefix}/migration should pass after initial database migration ..."
368
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/migration should pass after initial database migration ..."
291
369
  $rake db:migrate
292
370
  $testurl ${host}/${route_prefix}/migration 200 text/plain $success
293
371
  echo
@@ -303,18 +381,33 @@ common_tests()
303
381
 
304
382
  test_no=`expr 1 + $test_no`
305
383
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
306
- echo "${test_no}: TESTING ${route_prefix}/database should fail if the database has been corrupted ..."
384
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/database should fail if the database has been corrupted ..."
307
385
 
308
- $testurl ${host}/${route_prefix}/database 550 text/plain failed
386
+ $testurl ${host}/${route_prefix}/database 550 text/plain failed:
309
387
  echo
310
388
  fi
311
389
 
390
+ export HIDE_ERROR_RESPONSE=true
391
+ stop_server
392
+ start_server
393
+
312
394
  test_no=`expr 1 + $test_no`
313
395
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
314
- echo "${test_no}: TESTING ${route_prefix}/site should pass ..."
396
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/database should have response body 'health_check failed' but no error details if include_error_in_response_body is false"
397
+ $testurl ${host}/${route_prefix}/database 550 text/plain 'health_check failed' failed:
398
+ echo
399
+ fi
400
+
401
+ unset HIDE_ERROR_RESPONSE
402
+ stop_server
403
+ start_server
404
+
405
+ test_no=`expr 1 + $test_no`
406
+ if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
407
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/site should pass ..."
315
408
  $testurl ${host}/${route_prefix}/site 200 text/plain $success
316
409
  if $has_middleware; then
317
- echo "${test_no}: TESTING ${route_prefix}/middleware_site should pass ..."
410
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/middleware_site should pass ..."
318
411
  $testurl ${host}/${route_prefix}/middleware_site 200 text/plain $success
319
412
  fi
320
413
  echo
@@ -325,7 +418,7 @@ common_tests()
325
418
 
326
419
  test_no=`expr 1 + $test_no`
327
420
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
328
- echo "${test_no}: TESTING ${route_prefix}/migration should fail without all migrations ..."
421
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/migration should fail without all migrations ..."
329
422
  cp $base_dir/test/migrate/twelve/* db/migrate
330
423
 
331
424
  ls db/migrate
@@ -335,7 +428,7 @@ common_tests()
335
428
 
336
429
  test_no=`expr 1 + $test_no`
337
430
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
338
- echo "${test_no}: TESTING ${route_prefix}/migration should pass after both database migrations ..."
431
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/migration should pass after both database migrations ..."
339
432
  $rake db:migrate
340
433
  $testurl ${host}/${route_prefix}/migration 200 text/plain $success
341
434
  echo
@@ -343,7 +436,7 @@ common_tests()
343
436
 
344
437
  test_no=`expr 1 + $test_no`
345
438
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
346
- echo "${test_no}: TESTING ${route_prefix}/migration should pass after both database migrations ..."
439
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/migration should pass after both database migrations ..."
347
440
  $rake db:migrate
348
441
  $testurl ${host}/${route_prefix}/migration 200 text/plain $success
349
442
  echo
@@ -351,14 +444,14 @@ common_tests()
351
444
 
352
445
  test_no=`expr 1 + $test_no`
353
446
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
354
- echo "${test_no}: TESTING ${route_prefix}/email should fail without smtp available ..."
447
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/email should fail without smtp available ..."
355
448
  $testurl ${host}/${route_prefix}/email 550 text/plain failed
356
449
  echo
357
450
  fi
358
451
 
359
452
  test_no=`expr 1 + $test_no`
360
453
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
361
- echo "${test_no}: TESTING ${route_prefix}/email should pass with smtp available ..."
454
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/email should pass with smtp available ..."
362
455
  $fake_smtp_server &
363
456
  fake_smtp_pid=$!
364
457
  sleep 5
@@ -368,14 +461,14 @@ common_tests()
368
461
 
369
462
  test_no=`expr 1 + $test_no`
370
463
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
371
- echo "${test_no}: TESTING ${route_prefix} (all) should fail without smtp available ..."
464
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix} (all) should fail without smtp available ..."
372
465
  $testurl ${host}/${route_prefix} 550 text/plain failed
373
466
  echo
374
467
  fi
375
468
 
376
469
  test_no=`expr 1 + $test_no`
377
470
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
378
- echo "${test_no}: TESTING ${route_prefix}/all should fail without smtp available ..."
471
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/all should fail without smtp available ..."
379
472
  $testurl ${host}/${route_prefix} 550 text/plain failed
380
473
  echo
381
474
  fi
@@ -383,7 +476,7 @@ common_tests()
383
476
  kill -9 $fake_smtp_pid || echo fake_smtp_server had finished as expected
384
477
  test_no=`expr 1 + $test_no`
385
478
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
386
- echo "${test_no}: TESTING ${route_prefix} (all) should pass with smtp available ..."
479
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix} (all) should pass with smtp available ..."
387
480
  $fake_smtp_server &
388
481
  fake_smtp_pid=$!
389
482
  sleep 5
@@ -394,7 +487,7 @@ common_tests()
394
487
  kill -9 $fake_smtp_pid || echo fake_smtp_server had finished as expected
395
488
  test_no=`expr 1 + $test_no`
396
489
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
397
- echo "${test_no}: TESTING ${route_prefix}/all should pass with smtp available ..."
490
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/all should pass with smtp available ..."
398
491
  $fake_smtp_server &
399
492
  fake_smtp_pid=$!
400
493
  sleep 5
@@ -404,21 +497,28 @@ common_tests()
404
497
 
405
498
  test_no=`expr 1 + $test_no`
406
499
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
407
- echo "${test_no}: TESTING ${route_prefix}/custom should pass ..."
500
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/pass should pass ..."
501
+ $testurl ${host}/${route_prefix}/pass 200 text/plain $success
502
+ echo
503
+ fi
504
+
505
+ test_no=`expr 1 + $test_no`
506
+ if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
507
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/custom should pass ..."
408
508
  $testurl ${host}/${route_prefix}/custom 200 text/plain $success
409
509
  echo
410
510
  fi
411
511
 
412
512
  test_no=`expr 1 + $test_no`
413
513
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
414
- echo "${test_no}: TESTING ${route_prefix}/custom.html should pass (returning plain text) ..."
514
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/custom.html should pass (returning plain text) ..."
415
515
  $testurl ${host}/${route_prefix}/custom.html 200 text/plain $success
416
516
  echo
417
517
  fi
418
518
 
419
519
  test_no=`expr 1 + $test_no`
420
520
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
421
- echo "${test_no}: TESTING ${route_prefix}/custom.json should pass ..."
521
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/custom.json should pass ..."
422
522
  $testurl ${host}/${route_prefix}/custom.json 200 application/json '"healthy":true'
423
523
  $testurl ${host}/${route_prefix}/custom.json 200 application/json "\"message\":\"$success\""
424
524
  echo
@@ -426,7 +526,7 @@ common_tests()
426
526
 
427
527
  test_no=`expr 1 + $test_no`
428
528
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
429
- echo "${test_no}: TESTING ${route_prefix}/custom.xml should pass ..."
529
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/custom.xml should pass ..."
430
530
  $testurl ${host}/${route_prefix}/custom.xml 200 application/xml '<healthy type="boolean">true</healthy>'
431
531
  $testurl ${host}/${route_prefix}/custom.xml 200 application/xml "<message>$success</message>"
432
532
  echo
@@ -435,21 +535,27 @@ common_tests()
435
535
  test_no=`expr 1 + $test_no`
436
536
  rm -f $custom_file
437
537
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
438
- echo "${test_no}: TESTING ${route_prefix}/custom should fail when custom returns string ..."
538
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/custom should fail when custom returns string ..."
439
539
  $testurl ${host}/${route_prefix}/custom 550 text/plain failed
440
540
  echo
441
541
  fi
442
542
 
543
+ if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
544
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/pass should pass even if other custom test returns string ..."
545
+ $testurl ${host}/${route_prefix}/pass 200 text/plain $success
546
+ echo
547
+ fi
548
+
443
549
  test_no=`expr 1 + $test_no`
444
550
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
445
- echo "${test_no}: TESTING ${route_prefix} (all) should fail when custom check fails ..."
551
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix} (all) should fail when custom check fails ..."
446
552
  $testurl ${host}/${route_prefix} 550 text/plain "$custom_file is missing!"
447
553
  echo
448
554
  fi
449
555
 
450
556
  test_no=`expr 1 + $test_no`
451
557
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
452
- echo "${test_no}: TESTING ${route_prefix}.json (all) should fail when custom check fails ..."
558
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}.json (all) should fail when custom check fails ..."
453
559
  $testurl ${host}/${route_prefix}.json 555 application/json '"healthy":false'
454
560
  $testurl ${host}/${route_prefix}.json 555 application/json "$custom_file is missing!"
455
561
  echo
@@ -457,7 +563,7 @@ common_tests()
457
563
 
458
564
  test_no=`expr 1 + $test_no`
459
565
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
460
- echo "${test_no}: TESTING ${route_prefix}.xml (all) should fail when custom check fails ..."
566
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}.xml (all) should fail when custom check fails ..."
461
567
  $testurl ${host}/${route_prefix}.xml 555 application/xml '<healthy type="boolean">false</healthy>'
462
568
  echo
463
569
  fi
@@ -465,10 +571,10 @@ common_tests()
465
571
  test_no=`expr 1 + $test_no`
466
572
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
467
573
  if $has_middleware; then
468
- echo "${test_no}: TESTING ${route_prefix}/middleware_site should pass ..."
574
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/middleware_site should pass ..."
469
575
  $testurl ${host}/${route_prefix}/middleware_site 200 text/plain $success
470
576
  else
471
- echo "${test_no}: TESTING ${route_prefix}/middleware_site should fail ..."
577
+ echo "${test_no}[line $LINENO]: TESTING ${route_prefix}/middleware_site should fail ..."
472
578
  $testurl ${host}/${route_prefix}/middleware_site 550 text/plain failed
473
579
  fi
474
580
  echo
@@ -476,7 +582,7 @@ common_tests()
476
582
 
477
583
  test_no=`expr 1 + $test_no`
478
584
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
479
- echo "${test_no}: TESTING log files to check for deprecation warnings ..."
585
+ echo "${test_no}[line $LINENO]: TESTING log files to check for deprecation warnings ..."
480
586
  if egrep ' is deprecated|DEPRECATION WARNING' $railsapp/log/[tp][er][so][td]*.log
481
587
  then
482
588
  echo Found deprecation warnings - failed test
@@ -636,7 +742,7 @@ case "$run_test" in
636
742
 
637
743
  echo
638
744
  echo 'TESTING catchall route active ...'
639
- $testurl ${host}/another/url 200 text/html 'catch all route'
745
+ $testurl ${host}/another/url 200 text/plain 'catch all route'
640
746
  echo
641
747
 
642
748
  common_tests 200
@@ -648,4 +754,4 @@ rm -f $catchall_file
648
754
  finish PASSED 0
649
755
  exit 0
650
756
 
651
- # vi: sw=4 ai sm:
757
+ # vi: sw=4 ai sm:
data/test/testurl CHANGED
@@ -62,4 +62,13 @@ if ARGV[3] and ARGV[3] != ''
62
62
  end
63
63
  end
64
64
 
65
+ if ARGV[4] and ARGV[4] != ''
66
+ if !page_content.to_s.include? ARGV[4]
67
+ puts "PASS (did not find #{ARGV[4]})"
68
+ else
69
+ puts "FAIL (found #{ARGV[4]}) - page contents:" , page_content.to_s, 'END-OF-CONTENTS'
70
+ exit 3
71
+ end
72
+ end
73
+
65
74
  exit 0
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Heggie
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: smarter_bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,18 +70,18 @@ dependencies:
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '1.2'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '1.2'
69
83
  description: " \tSimple health check of Rails app for uptime monitoring with Pingdom,
70
- NewRelic, EngineYard or uptime.openacs.org etc.\n"
84
+ NewRelic, EngineYard etc.\n"
71
85
  email:
72
86
  - ian@heggie.biz
73
87
  executables: []
@@ -83,14 +97,17 @@ files:
83
97
  - MIT-LICENSE
84
98
  - README.rdoc
85
99
  - Rakefile
100
+ - Vagrantfile
86
101
  - config/routes.rb
87
102
  - health_check.gemspec
88
103
  - init.rb
89
104
  - lib/health_check.rb
90
105
  - lib/health_check/base_health_check.rb
106
+ - lib/health_check/elasticsearch_health_check.rb
91
107
  - lib/health_check/health_check_controller.rb
92
108
  - lib/health_check/health_check_routes.rb
93
109
  - lib/health_check/middleware_health_check.rb
110
+ - lib/health_check/rabbitmq_health_check.rb
94
111
  - lib/health_check/redis_health_check.rb
95
112
  - lib/health_check/resque_health_check.rb
96
113
  - lib/health_check/s3_health_check.rb
@@ -104,18 +121,22 @@ files:
104
121
  - test/migrate/twelve/011_create_roles.roles.rb
105
122
  - test/migrate/twelve/012_create_users.rb
106
123
  - test/migrate/twelve/9_create_countries.rb
107
- - test/rails_4.0.gemfile
108
- - test/rails_4.1.gemfile
109
- - test/rails_4.2.gemfile
124
+ - test/provision_vagrant
110
125
  - test/rails_5.0.gemfile
126
+ - test/rails_5.1.gemfile
127
+ - test/rails_5.2.gemfile
128
+ - test/rails_6.0.gemfile
129
+ - test/rails_6.1.gemfile
130
+ - test/rails_6.2.gemfile
111
131
  - test/rails_edge.gemfile
112
132
  - test/setup_railsapp
113
133
  - test/test_with_railsapp
114
134
  - test/testurl
115
135
  homepage: https://github.com/ianheggie/health_check
116
- licenses: []
136
+ licenses:
137
+ - MIT
117
138
  metadata: {}
118
- post_install_message:
139
+ post_install_message:
119
140
  rdoc_options: []
120
141
  require_paths:
121
142
  - lib
@@ -123,19 +144,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
144
  requirements:
124
145
  - - ">="
125
146
  - !ruby/object:Gem::Version
126
- version: 1.9.3
147
+ version: 2.2.2
127
148
  required_rubygems_version: !ruby/object:Gem::Requirement
128
149
  requirements:
129
150
  - - ">="
130
151
  - !ruby/object:Gem::Version
131
152
  version: '0'
132
153
  requirements: []
133
- rubyforge_project:
134
- rubygems_version: 2.5.1
135
- signing_key:
154
+ rubygems_version: 3.2.15
155
+ signing_key:
136
156
  specification_version: 4
137
157
  summary: Simple health check of Rails app for uptime monitoring with Pingdom, NewRelic,
138
- EngineYard or uptime.openacs.org etc.
158
+ EngineYard etc.
139
159
  test_files:
140
160
  - test/fake_smtp_server
141
161
  - test/init_variables
@@ -144,10 +164,13 @@ test_files:
144
164
  - test/migrate/twelve/011_create_roles.roles.rb
145
165
  - test/migrate/twelve/012_create_users.rb
146
166
  - test/migrate/twelve/9_create_countries.rb
147
- - test/rails_4.0.gemfile
148
- - test/rails_4.1.gemfile
149
- - test/rails_4.2.gemfile
167
+ - test/provision_vagrant
150
168
  - test/rails_5.0.gemfile
169
+ - test/rails_5.1.gemfile
170
+ - test/rails_5.2.gemfile
171
+ - test/rails_6.0.gemfile
172
+ - test/rails_6.1.gemfile
173
+ - test/rails_6.2.gemfile
151
174
  - test/rails_edge.gemfile
152
175
  - test/setup_railsapp
153
176
  - test/test_with_railsapp