chillout 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (425) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.travis.yml +45 -9
  4. data/CHANGELOG.md +14 -0
  5. data/Gemfile +8 -0
  6. data/README.md +43 -7
  7. data/Rakefile +17 -2
  8. data/chillout.gemspec +21 -10
  9. data/lib/chillout/client.rb +26 -5
  10. data/lib/chillout/config.rb +15 -0
  11. data/lib/chillout/creation_listener.rb +10 -5
  12. data/lib/chillout/custom_metric.rb +27 -0
  13. data/lib/chillout/integrations/sidekiq.rb +22 -0
  14. data/lib/chillout/job.rb +12 -0
  15. data/lib/chillout/listener_injector.rb +23 -0
  16. data/lib/chillout/middleware/creations_monitor.rb +1 -1
  17. data/lib/chillout/middleware/sidekiq.rb +21 -0
  18. data/lib/chillout/railtie.rb +12 -14
  19. data/lib/chillout/server_side/dispatcher.rb +1 -1
  20. data/lib/chillout/server_side/plain_http_client.rb +22 -2
  21. data/lib/chillout/version.rb +1 -1
  22. data/lib/chillout/worker.rb +5 -5
  23. data/lib/chillout.rb +11 -0
  24. data/test/acceptance/client_sends_metrics_test.rb +21 -0
  25. data/test/acceptance/sidekiq_workers_send_metrics_test.rb +22 -0
  26. data/test/config_test.rb +31 -1
  27. data/test/custom_metric_test.rb +15 -0
  28. data/test/event_data_builder_test.rb +47 -41
  29. data/test/integration/client_test.rb +78 -4
  30. data/test/integration/worker_test.rb +3 -2
  31. data/test/middleware/creations_monitor_test.rb +28 -29
  32. data/test/middleware/sidekiq_test.rb +45 -0
  33. data/test/plain_http_client_test.rb +13 -0
  34. data/test/support/rails_3_2_13/Gemfile +5 -0
  35. data/test/support/rails_3_2_13/Rakefile +7 -0
  36. data/test/support/rails_3_2_13/app/controllers/application_controller.rb +3 -0
  37. data/test/support/rails_3_2_13/app/controllers/entities_controller.rb +70 -0
  38. data/test/support/rails_3_2_13/app/helpers/application_helper.rb +2 -0
  39. data/test/support/rails_3_2_13/app/models/entity.rb +3 -0
  40. data/test/support/rails_3_2_13/app/views/entities/_form.html.erb +21 -0
  41. data/test/support/rails_3_2_13/app/views/entities/edit.html.erb +6 -0
  42. data/test/support/rails_3_2_13/app/views/entities/index.html.erb +23 -0
  43. data/test/support/rails_3_2_13/app/views/entities/new.html.erb +5 -0
  44. data/test/support/rails_3_2_13/app/views/entities/show.html.erb +10 -0
  45. data/test/support/rails_3_2_13/app/views/layouts/application.html.erb +14 -0
  46. data/test/support/rails_3_2_13/config/application.rb +63 -0
  47. data/test/support/rails_3_2_13/config/boot.rb +6 -0
  48. data/test/support/rails_3_2_13/config/database.yml +11 -0
  49. data/test/support/rails_3_2_13/config/environment.rb +5 -0
  50. data/test/support/rails_3_2_13/config/environments/development.rb +32 -0
  51. data/test/support/rails_3_2_13/config/environments/production.rb +56 -0
  52. data/test/support/rails_3_2_13/config/environments/test.rb +37 -0
  53. data/test/support/rails_3_2_13/config/initializers/backtrace_silencers.rb +7 -0
  54. data/test/support/rails_3_2_13/config/initializers/inflections.rb +15 -0
  55. data/test/support/rails_3_2_13/config/initializers/load_schema.rb +4 -0
  56. data/test/support/rails_3_2_13/config/initializers/mime_types.rb +5 -0
  57. data/test/support/rails_3_2_13/config/initializers/secret_token.rb +7 -0
  58. data/test/support/rails_3_2_13/config/initializers/session_store.rb +8 -0
  59. data/test/support/rails_3_2_13/config/initializers/wrap_parameters.rb +14 -0
  60. data/test/support/rails_3_2_13/config/locales/en.yml +5 -0
  61. data/test/support/rails_3_2_13/config/routes.rb +3 -0
  62. data/test/support/rails_3_2_13/config.ru +4 -0
  63. data/test/support/rails_3_2_13/db/schema.rb +22 -0
  64. data/test/support/rails_3_2_13/public/404.html +26 -0
  65. data/test/support/rails_3_2_13/public/422.html +26 -0
  66. data/test/support/rails_3_2_13/public/500.html +25 -0
  67. data/test/support/rails_3_2_13/public/favicon.ico +0 -0
  68. data/test/support/rails_3_2_13/public/robots.txt +5 -0
  69. data/test/support/rails_3_2_13/script/rails +6 -0
  70. data/test/support/rails_4_0_0/Gemfile +5 -0
  71. data/test/support/rails_4_0_0/Rakefile +6 -0
  72. data/test/support/rails_4_0_0/app/controllers/application_controller.rb +5 -0
  73. data/test/support/rails_4_0_0/app/controllers/concerns/.keep +0 -0
  74. data/test/support/rails_4_0_0/app/controllers/entities_controller.rb +70 -0
  75. data/test/support/rails_4_0_0/app/helpers/application_helper.rb +2 -0
  76. data/test/support/rails_4_0_0/app/models/.keep +0 -0
  77. data/test/support/rails_4_0_0/app/models/concerns/.keep +0 -0
  78. data/test/support/rails_4_0_0/app/models/entity.rb +2 -0
  79. data/test/support/rails_4_0_0/app/views/entities/_form.html.erb +21 -0
  80. data/test/support/rails_4_0_0/app/views/entities/edit.html.erb +6 -0
  81. data/test/support/rails_4_0_0/app/views/entities/index.html.erb +23 -0
  82. data/test/support/rails_4_0_0/app/views/entities/new.html.erb +5 -0
  83. data/test/support/rails_4_0_0/app/views/entities/show.html.erb +10 -0
  84. data/test/support/rails_4_0_0/app/views/layouts/application.html.erb +14 -0
  85. data/test/support/rails_4_0_0/config/application.rb +31 -0
  86. data/test/support/rails_4_0_0/config/boot.rb +4 -0
  87. data/test/support/rails_4_0_0/config/database.yml +11 -0
  88. data/test/support/rails_4_0_0/config/environment.rb +5 -0
  89. data/test/support/rails_4_0_0/config/environments/development.rb +25 -0
  90. data/test/support/rails_4_0_0/config/environments/production.rb +67 -0
  91. data/test/support/rails_4_0_0/config/environments/test.rb +36 -0
  92. data/test/support/rails_4_0_0/config/initializers/backtrace_silencers.rb +7 -0
  93. data/test/support/rails_4_0_0/config/initializers/filter_parameter_logging.rb +4 -0
  94. data/test/support/rails_4_0_0/config/initializers/inflections.rb +16 -0
  95. data/test/support/rails_4_0_0/config/initializers/load_schema.rb +4 -0
  96. data/test/support/rails_4_0_0/config/initializers/mime_types.rb +5 -0
  97. data/test/support/rails_4_0_0/config/initializers/secret_token.rb +12 -0
  98. data/test/support/rails_4_0_0/config/initializers/session_store.rb +3 -0
  99. data/test/support/rails_4_0_0/config/initializers/wrap_parameters.rb +14 -0
  100. data/test/support/rails_4_0_0/config/locales/en.yml +23 -0
  101. data/test/support/rails_4_0_0/config/routes.rb +3 -0
  102. data/test/support/rails_4_0_0/config.ru +4 -0
  103. data/test/support/rails_4_0_0/db/schema.rb +22 -0
  104. data/test/support/rails_4_0_0/lib/assets/.keep +0 -0
  105. data/test/support/rails_4_0_0/lib/tasks/.keep +0 -0
  106. data/test/support/rails_4_0_0/public/404.html +58 -0
  107. data/test/support/rails_4_0_0/public/422.html +58 -0
  108. data/test/support/rails_4_0_0/public/500.html +57 -0
  109. data/test/support/rails_4_0_0/public/favicon.ico +0 -0
  110. data/test/support/rails_4_0_0/public/robots.txt +5 -0
  111. data/test/support/rails_4_0_0/script/bundle +3 -0
  112. data/test/support/rails_4_0_0/script/rails +4 -0
  113. data/test/support/rails_4_0_0/script/rake +4 -0
  114. data/test/support/rails_4_0_13/Gemfile +5 -0
  115. data/test/support/rails_4_0_13/Rakefile +6 -0
  116. data/test/support/rails_4_0_13/app/controllers/application_controller.rb +5 -0
  117. data/test/support/rails_4_0_13/app/controllers/concerns/.keep +0 -0
  118. data/test/support/rails_4_0_13/app/controllers/entities_controller.rb +70 -0
  119. data/test/support/rails_4_0_13/app/helpers/application_helper.rb +2 -0
  120. data/test/support/rails_4_0_13/app/models/.keep +0 -0
  121. data/test/support/rails_4_0_13/app/models/concerns/.keep +0 -0
  122. data/test/support/rails_4_0_13/app/models/entity.rb +2 -0
  123. data/test/support/rails_4_0_13/app/views/entities/_form.html.erb +21 -0
  124. data/test/support/rails_4_0_13/app/views/entities/edit.html.erb +6 -0
  125. data/test/support/rails_4_0_13/app/views/entities/index.html.erb +23 -0
  126. data/test/support/rails_4_0_13/app/views/entities/new.html.erb +5 -0
  127. data/test/support/rails_4_0_13/app/views/entities/show.html.erb +10 -0
  128. data/test/support/rails_4_0_13/app/views/layouts/application.html.erb +14 -0
  129. data/test/support/rails_4_0_13/config/application.rb +31 -0
  130. data/test/support/rails_4_0_13/config/boot.rb +4 -0
  131. data/test/support/rails_4_0_13/config/database.yml +11 -0
  132. data/test/support/rails_4_0_13/config/environment.rb +5 -0
  133. data/test/support/rails_4_0_13/config/environments/development.rb +25 -0
  134. data/test/support/rails_4_0_13/config/environments/production.rb +67 -0
  135. data/test/support/rails_4_0_13/config/environments/test.rb +36 -0
  136. data/test/support/rails_4_0_13/config/initializers/backtrace_silencers.rb +7 -0
  137. data/test/support/rails_4_0_13/config/initializers/filter_parameter_logging.rb +4 -0
  138. data/test/support/rails_4_0_13/config/initializers/inflections.rb +16 -0
  139. data/test/support/rails_4_0_13/config/initializers/load_schema.rb +4 -0
  140. data/test/support/rails_4_0_13/config/initializers/mime_types.rb +5 -0
  141. data/test/support/rails_4_0_13/config/initializers/secret_token.rb +12 -0
  142. data/test/support/rails_4_0_13/config/initializers/session_store.rb +3 -0
  143. data/test/support/rails_4_0_13/config/initializers/wrap_parameters.rb +14 -0
  144. data/test/support/rails_4_0_13/config/locales/en.yml +23 -0
  145. data/test/support/rails_4_0_13/config/routes.rb +3 -0
  146. data/test/support/rails_4_0_13/config.ru +4 -0
  147. data/test/support/rails_4_0_13/db/schema.rb +22 -0
  148. data/test/support/rails_4_0_13/lib/assets/.keep +0 -0
  149. data/test/support/rails_4_0_13/lib/tasks/.keep +0 -0
  150. data/test/support/rails_4_0_13/public/404.html +58 -0
  151. data/test/support/rails_4_0_13/public/422.html +58 -0
  152. data/test/support/rails_4_0_13/public/500.html +57 -0
  153. data/test/support/rails_4_0_13/public/favicon.ico +0 -0
  154. data/test/support/rails_4_0_13/public/robots.txt +5 -0
  155. data/test/support/rails_4_0_13/script/bundle +3 -0
  156. data/test/support/rails_4_0_13/script/rails +4 -0
  157. data/test/support/rails_4_0_13/script/rake +4 -0
  158. data/test/support/rails_4_1_0/Gemfile +5 -0
  159. data/test/support/rails_4_1_0/Rakefile +6 -0
  160. data/test/support/rails_4_1_0/app/controllers/application_controller.rb +5 -0
  161. data/test/support/rails_4_1_0/app/controllers/concerns/.keep +0 -0
  162. data/test/support/rails_4_1_0/app/controllers/entities_controller.rb +70 -0
  163. data/test/support/rails_4_1_0/app/helpers/application_helper.rb +2 -0
  164. data/test/support/rails_4_1_0/app/models/.keep +0 -0
  165. data/test/support/rails_4_1_0/app/models/concerns/.keep +0 -0
  166. data/test/support/rails_4_1_0/app/models/entity.rb +2 -0
  167. data/test/support/rails_4_1_0/app/views/entities/_form.html.erb +21 -0
  168. data/test/support/rails_4_1_0/app/views/entities/edit.html.erb +6 -0
  169. data/test/support/rails_4_1_0/app/views/entities/index.html.erb +23 -0
  170. data/test/support/rails_4_1_0/app/views/entities/new.html.erb +5 -0
  171. data/test/support/rails_4_1_0/app/views/entities/show.html.erb +10 -0
  172. data/test/support/rails_4_1_0/app/views/layouts/application.html.erb +14 -0
  173. data/test/support/rails_4_1_0/config/application.rb +31 -0
  174. data/test/support/rails_4_1_0/config/boot.rb +4 -0
  175. data/test/support/rails_4_1_0/config/database.yml +11 -0
  176. data/test/support/rails_4_1_0/config/environment.rb +5 -0
  177. data/test/support/rails_4_1_0/config/environments/development.rb +25 -0
  178. data/test/support/rails_4_1_0/config/environments/production.rb +67 -0
  179. data/test/support/rails_4_1_0/config/environments/test.rb +36 -0
  180. data/test/support/rails_4_1_0/config/initializers/backtrace_silencers.rb +7 -0
  181. data/test/support/rails_4_1_0/config/initializers/filter_parameter_logging.rb +4 -0
  182. data/test/support/rails_4_1_0/config/initializers/inflections.rb +16 -0
  183. data/test/support/rails_4_1_0/config/initializers/load_schema.rb +4 -0
  184. data/test/support/rails_4_1_0/config/initializers/mime_types.rb +5 -0
  185. data/test/support/rails_4_1_0/config/initializers/secret_token.rb +12 -0
  186. data/test/support/rails_4_1_0/config/initializers/session_store.rb +3 -0
  187. data/test/support/rails_4_1_0/config/initializers/wrap_parameters.rb +14 -0
  188. data/test/support/rails_4_1_0/config/locales/en.yml +23 -0
  189. data/test/support/rails_4_1_0/config/routes.rb +3 -0
  190. data/test/support/rails_4_1_0/config.ru +4 -0
  191. data/test/support/rails_4_1_0/db/schema.rb +22 -0
  192. data/test/support/rails_4_1_0/lib/assets/.keep +0 -0
  193. data/test/support/rails_4_1_0/lib/tasks/.keep +0 -0
  194. data/test/support/rails_4_1_0/public/404.html +58 -0
  195. data/test/support/rails_4_1_0/public/422.html +58 -0
  196. data/test/support/rails_4_1_0/public/500.html +57 -0
  197. data/test/support/rails_4_1_0/public/favicon.ico +0 -0
  198. data/test/support/rails_4_1_0/public/robots.txt +5 -0
  199. data/test/support/rails_4_1_0/script/bundle +3 -0
  200. data/test/support/rails_4_1_0/script/rails +4 -0
  201. data/test/support/rails_4_1_0/script/rake +4 -0
  202. data/test/support/rails_4_1_16/Gemfile +5 -0
  203. data/test/support/rails_4_1_16/Rakefile +6 -0
  204. data/test/support/rails_4_1_16/app/controllers/application_controller.rb +5 -0
  205. data/test/support/rails_4_1_16/app/controllers/concerns/.keep +0 -0
  206. data/test/support/rails_4_1_16/app/controllers/entities_controller.rb +70 -0
  207. data/test/support/rails_4_1_16/app/helpers/application_helper.rb +2 -0
  208. data/test/support/rails_4_1_16/app/models/.keep +0 -0
  209. data/test/support/rails_4_1_16/app/models/concerns/.keep +0 -0
  210. data/test/support/rails_4_1_16/app/models/entity.rb +2 -0
  211. data/test/support/rails_4_1_16/app/views/entities/_form.html.erb +21 -0
  212. data/test/support/rails_4_1_16/app/views/entities/edit.html.erb +6 -0
  213. data/test/support/rails_4_1_16/app/views/entities/index.html.erb +23 -0
  214. data/test/support/rails_4_1_16/app/views/entities/new.html.erb +5 -0
  215. data/test/support/rails_4_1_16/app/views/entities/show.html.erb +10 -0
  216. data/test/support/rails_4_1_16/app/views/layouts/application.html.erb +14 -0
  217. data/test/support/rails_4_1_16/config/application.rb +31 -0
  218. data/test/support/rails_4_1_16/config/boot.rb +4 -0
  219. data/test/support/rails_4_1_16/config/database.yml +11 -0
  220. data/test/support/rails_4_1_16/config/environment.rb +5 -0
  221. data/test/support/rails_4_1_16/config/environments/development.rb +25 -0
  222. data/test/support/rails_4_1_16/config/environments/production.rb +67 -0
  223. data/test/support/rails_4_1_16/config/environments/test.rb +36 -0
  224. data/test/support/rails_4_1_16/config/initializers/backtrace_silencers.rb +7 -0
  225. data/test/support/rails_4_1_16/config/initializers/filter_parameter_logging.rb +4 -0
  226. data/test/support/rails_4_1_16/config/initializers/inflections.rb +16 -0
  227. data/test/support/rails_4_1_16/config/initializers/load_schema.rb +4 -0
  228. data/test/support/rails_4_1_16/config/initializers/mime_types.rb +5 -0
  229. data/test/support/rails_4_1_16/config/initializers/secret_token.rb +12 -0
  230. data/test/support/rails_4_1_16/config/initializers/session_store.rb +3 -0
  231. data/test/support/rails_4_1_16/config/initializers/wrap_parameters.rb +14 -0
  232. data/test/support/rails_4_1_16/config/locales/en.yml +23 -0
  233. data/test/support/rails_4_1_16/config/routes.rb +3 -0
  234. data/test/support/rails_4_1_16/config.ru +4 -0
  235. data/test/support/rails_4_1_16/db/schema.rb +22 -0
  236. data/test/support/rails_4_1_16/lib/assets/.keep +0 -0
  237. data/test/support/rails_4_1_16/lib/tasks/.keep +0 -0
  238. data/test/support/rails_4_1_16/public/404.html +58 -0
  239. data/test/support/rails_4_1_16/public/422.html +58 -0
  240. data/test/support/rails_4_1_16/public/500.html +57 -0
  241. data/test/support/rails_4_1_16/public/favicon.ico +0 -0
  242. data/test/support/rails_4_1_16/public/robots.txt +5 -0
  243. data/test/support/rails_4_1_16/script/bundle +3 -0
  244. data/test/support/rails_4_1_16/script/rails +4 -0
  245. data/test/support/rails_4_1_16/script/rake +4 -0
  246. data/test/support/rails_4_2_0/Gemfile +5 -0
  247. data/test/support/rails_4_2_0/Rakefile +6 -0
  248. data/test/support/rails_4_2_0/app/controllers/application_controller.rb +5 -0
  249. data/test/support/rails_4_2_0/app/controllers/concerns/.keep +0 -0
  250. data/test/support/rails_4_2_0/app/controllers/entities_controller.rb +70 -0
  251. data/test/support/rails_4_2_0/app/helpers/application_helper.rb +2 -0
  252. data/test/support/rails_4_2_0/app/models/.keep +0 -0
  253. data/test/support/rails_4_2_0/app/models/concerns/.keep +0 -0
  254. data/test/support/rails_4_2_0/app/models/entity.rb +2 -0
  255. data/test/support/rails_4_2_0/app/views/entities/_form.html.erb +21 -0
  256. data/test/support/rails_4_2_0/app/views/entities/edit.html.erb +6 -0
  257. data/test/support/rails_4_2_0/app/views/entities/index.html.erb +23 -0
  258. data/test/support/rails_4_2_0/app/views/entities/new.html.erb +5 -0
  259. data/test/support/rails_4_2_0/app/views/entities/show.html.erb +10 -0
  260. data/test/support/rails_4_2_0/app/views/layouts/application.html.erb +14 -0
  261. data/test/support/rails_4_2_0/config/application.rb +31 -0
  262. data/test/support/rails_4_2_0/config/boot.rb +4 -0
  263. data/test/support/rails_4_2_0/config/database.yml +11 -0
  264. data/test/support/rails_4_2_0/config/environment.rb +5 -0
  265. data/test/support/rails_4_2_0/config/environments/development.rb +25 -0
  266. data/test/support/rails_4_2_0/config/environments/production.rb +67 -0
  267. data/test/support/rails_4_2_0/config/environments/test.rb +36 -0
  268. data/test/support/rails_4_2_0/config/initializers/backtrace_silencers.rb +7 -0
  269. data/test/support/rails_4_2_0/config/initializers/filter_parameter_logging.rb +4 -0
  270. data/test/support/rails_4_2_0/config/initializers/inflections.rb +16 -0
  271. data/test/support/rails_4_2_0/config/initializers/load_schema.rb +4 -0
  272. data/test/support/rails_4_2_0/config/initializers/mime_types.rb +5 -0
  273. data/test/support/rails_4_2_0/config/initializers/secret_token.rb +12 -0
  274. data/test/support/rails_4_2_0/config/initializers/session_store.rb +3 -0
  275. data/test/support/rails_4_2_0/config/initializers/wrap_parameters.rb +14 -0
  276. data/test/support/rails_4_2_0/config/locales/en.yml +23 -0
  277. data/test/support/rails_4_2_0/config/routes.rb +3 -0
  278. data/test/support/rails_4_2_0/config.ru +4 -0
  279. data/test/support/rails_4_2_0/db/schema.rb +22 -0
  280. data/test/support/rails_4_2_0/lib/assets/.keep +0 -0
  281. data/test/support/rails_4_2_0/lib/tasks/.keep +0 -0
  282. data/test/support/rails_4_2_0/public/404.html +58 -0
  283. data/test/support/rails_4_2_0/public/422.html +58 -0
  284. data/test/support/rails_4_2_0/public/500.html +57 -0
  285. data/test/support/rails_4_2_0/public/favicon.ico +0 -0
  286. data/test/support/rails_4_2_0/public/robots.txt +5 -0
  287. data/test/support/rails_4_2_0/script/bundle +3 -0
  288. data/test/support/rails_4_2_0/script/rails +4 -0
  289. data/test/support/rails_4_2_0/script/rake +4 -0
  290. data/test/support/rails_4_2_8/Gemfile +5 -0
  291. data/test/support/rails_4_2_8/Rakefile +6 -0
  292. data/test/support/rails_4_2_8/app/controllers/application_controller.rb +5 -0
  293. data/test/support/rails_4_2_8/app/controllers/concerns/.keep +0 -0
  294. data/test/support/rails_4_2_8/app/controllers/entities_controller.rb +70 -0
  295. data/test/support/rails_4_2_8/app/helpers/application_helper.rb +2 -0
  296. data/test/support/rails_4_2_8/app/models/.keep +0 -0
  297. data/test/support/rails_4_2_8/app/models/concerns/.keep +0 -0
  298. data/test/support/rails_4_2_8/app/models/entity.rb +2 -0
  299. data/test/support/rails_4_2_8/app/views/entities/_form.html.erb +21 -0
  300. data/test/support/rails_4_2_8/app/views/entities/edit.html.erb +6 -0
  301. data/test/support/rails_4_2_8/app/views/entities/index.html.erb +23 -0
  302. data/test/support/rails_4_2_8/app/views/entities/new.html.erb +5 -0
  303. data/test/support/rails_4_2_8/app/views/entities/show.html.erb +10 -0
  304. data/test/support/rails_4_2_8/app/views/layouts/application.html.erb +14 -0
  305. data/test/support/rails_4_2_8/config/application.rb +34 -0
  306. data/test/support/rails_4_2_8/config/boot.rb +4 -0
  307. data/test/support/rails_4_2_8/config/database.yml +11 -0
  308. data/test/support/rails_4_2_8/config/environment.rb +5 -0
  309. data/test/support/rails_4_2_8/config/environments/development.rb +25 -0
  310. data/test/support/rails_4_2_8/config/environments/production.rb +73 -0
  311. data/test/support/rails_4_2_8/config/environments/test.rb +36 -0
  312. data/test/support/rails_4_2_8/config/initializers/backtrace_silencers.rb +7 -0
  313. data/test/support/rails_4_2_8/config/initializers/filter_parameter_logging.rb +4 -0
  314. data/test/support/rails_4_2_8/config/initializers/inflections.rb +16 -0
  315. data/test/support/rails_4_2_8/config/initializers/load_schema.rb +4 -0
  316. data/test/support/rails_4_2_8/config/initializers/mime_types.rb +5 -0
  317. data/test/support/rails_4_2_8/config/initializers/secret_token.rb +12 -0
  318. data/test/support/rails_4_2_8/config/initializers/session_store.rb +3 -0
  319. data/test/support/rails_4_2_8/config/initializers/wrap_parameters.rb +14 -0
  320. data/test/support/rails_4_2_8/config/locales/en.yml +23 -0
  321. data/test/support/rails_4_2_8/config/routes.rb +3 -0
  322. data/test/support/rails_4_2_8/config.ru +4 -0
  323. data/test/support/rails_4_2_8/db/schema.rb +22 -0
  324. data/test/support/rails_4_2_8/lib/assets/.keep +0 -0
  325. data/test/support/rails_4_2_8/lib/tasks/.keep +0 -0
  326. data/test/support/rails_4_2_8/public/404.html +58 -0
  327. data/test/support/rails_4_2_8/public/422.html +58 -0
  328. data/test/support/rails_4_2_8/public/500.html +57 -0
  329. data/test/support/rails_4_2_8/public/favicon.ico +0 -0
  330. data/test/support/rails_4_2_8/public/robots.txt +5 -0
  331. data/test/support/rails_4_2_8/script/bundle +3 -0
  332. data/test/support/rails_4_2_8/script/rails +4 -0
  333. data/test/support/rails_4_2_8/script/rake +4 -0
  334. data/test/support/rails_5_0_3/Gemfile +5 -0
  335. data/test/support/rails_5_0_3/Rakefile +6 -0
  336. data/test/support/rails_5_0_3/app/controllers/application_controller.rb +5 -0
  337. data/test/support/rails_5_0_3/app/controllers/concerns/.keep +0 -0
  338. data/test/support/rails_5_0_3/app/controllers/entities_controller.rb +70 -0
  339. data/test/support/rails_5_0_3/app/helpers/application_helper.rb +2 -0
  340. data/test/support/rails_5_0_3/app/models/.keep +0 -0
  341. data/test/support/rails_5_0_3/app/models/concerns/.keep +0 -0
  342. data/test/support/rails_5_0_3/app/models/entity.rb +2 -0
  343. data/test/support/rails_5_0_3/app/views/entities/_form.html.erb +21 -0
  344. data/test/support/rails_5_0_3/app/views/entities/edit.html.erb +6 -0
  345. data/test/support/rails_5_0_3/app/views/entities/index.html.erb +23 -0
  346. data/test/support/rails_5_0_3/app/views/entities/new.html.erb +5 -0
  347. data/test/support/rails_5_0_3/app/views/entities/show.html.erb +10 -0
  348. data/test/support/rails_5_0_3/app/views/layouts/application.html.erb +14 -0
  349. data/test/support/rails_5_0_3/config/application.rb +30 -0
  350. data/test/support/rails_5_0_3/config/boot.rb +4 -0
  351. data/test/support/rails_5_0_3/config/database.yml +11 -0
  352. data/test/support/rails_5_0_3/config/environment.rb +5 -0
  353. data/test/support/rails_5_0_3/config/environments/development.rb +25 -0
  354. data/test/support/rails_5_0_3/config/environments/production.rb +73 -0
  355. data/test/support/rails_5_0_3/config/environments/test.rb +36 -0
  356. data/test/support/rails_5_0_3/config/initializers/backtrace_silencers.rb +7 -0
  357. data/test/support/rails_5_0_3/config/initializers/filter_parameter_logging.rb +4 -0
  358. data/test/support/rails_5_0_3/config/initializers/inflections.rb +16 -0
  359. data/test/support/rails_5_0_3/config/initializers/load_schema.rb +4 -0
  360. data/test/support/rails_5_0_3/config/initializers/mime_types.rb +5 -0
  361. data/test/support/rails_5_0_3/config/initializers/secret_token.rb +12 -0
  362. data/test/support/rails_5_0_3/config/initializers/session_store.rb +3 -0
  363. data/test/support/rails_5_0_3/config/initializers/wrap_parameters.rb +14 -0
  364. data/test/support/rails_5_0_3/config/locales/en.yml +23 -0
  365. data/test/support/rails_5_0_3/config/routes.rb +3 -0
  366. data/test/support/rails_5_0_3/config.ru +4 -0
  367. data/test/support/rails_5_0_3/db/schema.rb +22 -0
  368. data/test/support/rails_5_0_3/lib/assets/.keep +0 -0
  369. data/test/support/rails_5_0_3/lib/tasks/.keep +0 -0
  370. data/test/support/rails_5_0_3/public/404.html +58 -0
  371. data/test/support/rails_5_0_3/public/422.html +58 -0
  372. data/test/support/rails_5_0_3/public/500.html +57 -0
  373. data/test/support/rails_5_0_3/public/favicon.ico +0 -0
  374. data/test/support/rails_5_0_3/public/robots.txt +5 -0
  375. data/test/support/rails_5_0_3/script/bundle +3 -0
  376. data/test/support/rails_5_0_3/script/rails +4 -0
  377. data/test/support/rails_5_0_3/script/rake +4 -0
  378. data/test/support/rails_5_1_1/Gemfile +6 -0
  379. data/test/support/rails_5_1_1/Rakefile +6 -0
  380. data/test/support/rails_5_1_1/app/controllers/application_controller.rb +5 -0
  381. data/test/support/rails_5_1_1/app/controllers/concerns/.keep +0 -0
  382. data/test/support/rails_5_1_1/app/controllers/entities_controller.rb +70 -0
  383. data/test/support/rails_5_1_1/app/helpers/application_helper.rb +2 -0
  384. data/test/support/rails_5_1_1/app/jobs/create_entity_job.rb +6 -0
  385. data/test/support/rails_5_1_1/app/models/.keep +0 -0
  386. data/test/support/rails_5_1_1/app/models/concerns/.keep +0 -0
  387. data/test/support/rails_5_1_1/app/models/entity.rb +2 -0
  388. data/test/support/rails_5_1_1/app/views/entities/_form.html.erb +21 -0
  389. data/test/support/rails_5_1_1/app/views/entities/edit.html.erb +6 -0
  390. data/test/support/rails_5_1_1/app/views/entities/index.html.erb +23 -0
  391. data/test/support/rails_5_1_1/app/views/entities/new.html.erb +5 -0
  392. data/test/support/rails_5_1_1/app/views/entities/show.html.erb +10 -0
  393. data/test/support/rails_5_1_1/app/views/layouts/application.html.erb +14 -0
  394. data/test/support/rails_5_1_1/config/application.rb +30 -0
  395. data/test/support/rails_5_1_1/config/boot.rb +4 -0
  396. data/test/support/rails_5_1_1/config/database.yml +11 -0
  397. data/test/support/rails_5_1_1/config/environment.rb +5 -0
  398. data/test/support/rails_5_1_1/config/environments/development.rb +25 -0
  399. data/test/support/rails_5_1_1/config/environments/production.rb +73 -0
  400. data/test/support/rails_5_1_1/config/environments/test.rb +36 -0
  401. data/test/support/rails_5_1_1/config/initializers/backtrace_silencers.rb +7 -0
  402. data/test/support/rails_5_1_1/config/initializers/filter_parameter_logging.rb +4 -0
  403. data/test/support/rails_5_1_1/config/initializers/inflections.rb +16 -0
  404. data/test/support/rails_5_1_1/config/initializers/load_schema.rb +4 -0
  405. data/test/support/rails_5_1_1/config/initializers/mime_types.rb +5 -0
  406. data/test/support/rails_5_1_1/config/initializers/secret_token.rb +12 -0
  407. data/test/support/rails_5_1_1/config/initializers/session_store.rb +3 -0
  408. data/test/support/rails_5_1_1/config/initializers/wrap_parameters.rb +14 -0
  409. data/test/support/rails_5_1_1/config/locales/en.yml +23 -0
  410. data/test/support/rails_5_1_1/config/routes.rb +3 -0
  411. data/test/support/rails_5_1_1/config.ru +4 -0
  412. data/test/support/rails_5_1_1/db/schema.rb +22 -0
  413. data/test/support/rails_5_1_1/lib/assets/.keep +0 -0
  414. data/test/support/rails_5_1_1/lib/tasks/.keep +0 -0
  415. data/test/support/rails_5_1_1/public/404.html +58 -0
  416. data/test/support/rails_5_1_1/public/422.html +58 -0
  417. data/test/support/rails_5_1_1/public/500.html +57 -0
  418. data/test/support/rails_5_1_1/public/favicon.ico +0 -0
  419. data/test/support/rails_5_1_1/public/robots.txt +5 -0
  420. data/test/support/rails_5_1_1/script/bundle +3 -0
  421. data/test/support/rails_5_1_1/script/rails +4 -0
  422. data/test/support/rails_5_1_1/script/rake +4 -0
  423. data/test/test_helper.rb +149 -11
  424. data/test/worker_test.rb +1 -1
  425. metadata +974 -143
data/test/test_helper.rb CHANGED
@@ -1,18 +1,16 @@
1
- require 'test/unit'
2
- require 'mocha'
3
- require 'contest'
4
- require 'webmock/test_unit'
1
+ require 'minitest/autorun'
2
+ require 'mocha/setup'
3
+ require 'webmock/minitest'
5
4
  require 'rack/test'
5
+ require 'pathname'
6
+ require 'bbq/spawn'
7
+ require 'sidekiq/testing'
6
8
 
7
9
  $LOAD_PATH << File.expand_path('../../lib', __FILE__)
8
10
 
9
11
  require 'chillout'
10
12
 
11
- class ChilloutTestCase < Test::Unit::TestCase
12
- def refute(value, message=nil)
13
- assert !value, message || "Expected #{value.inspect} to be false."
14
- end
15
-
13
+ class ChilloutTestCase < Minitest::Test
16
14
  def assert_includes(collection, object, message=nil)
17
15
  assert collection.include?(object), message || "#{collection.inspect} expected to include #{object.inspect}."
18
16
  end
@@ -34,7 +32,7 @@ class ChilloutTestCase < Test::Unit::TestCase
34
32
 
35
33
  def api_url(resource_name)
36
34
  raise "API KEY not set" unless @_api_key
37
- "https://#{@_api_key}:#{@_api_key}@api.chillout.io/#{resource_name}"
35
+ "https://api.chillout.io/#{resource_name}"
38
36
  end
39
37
 
40
38
  def null_logger
@@ -45,7 +43,147 @@ class ChilloutTestCase < Test::Unit::TestCase
45
43
  _, status = Process.wait2(pid)
46
44
  assert_equal 0, status.exitstatus
47
45
  end
46
+ end
47
+
48
+ class AcceptanceTestCase < Minitest::Test
49
+
50
+ def setup
51
+ WebMock.disable!
52
+ end
53
+
54
+ def teardown
55
+ WebMock.enable!
56
+ end
57
+
58
+ end
59
+
60
+ require 'net/http'
61
+
62
+ class TestUser
63
+
64
+ def create_entity(name)
65
+ Net::HTTP.start('127.0.0.1', 3000) do |http|
66
+ http.post('/entities', "entity[name]=#{name}")
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ class TestApp
73
+
74
+ def boot
75
+ sample_app_name = ENV['SAMPLE_APP'] || 'rails_4_0_0'
76
+ sample_app_root = Pathname.new(File.expand_path('../support', __FILE__)).join(sample_app_name)
77
+ command = [Gem.ruby, sample_app_root.join('script/rails').to_s, 'server'].join(' ')
78
+ @executor = Bbq::Spawn::Executor.new(command) do |process|
79
+ process.cwd = sample_app_root.to_s
80
+ process.environment['BUNDLE_GEMFILE'] = sample_app_root.join('Gemfile').to_s
81
+ process.environment['RAILS_ENV'] = 'production'
82
+ end
83
+ @executor = Bbq::Spawn::CoordinatedExecutor.new(@executor, :url => 'http://127.0.0.1:3000/', timeout: 15)
84
+ @executor.start
85
+ @executor.join
86
+ end
87
+
88
+ def shutdown
89
+ @executor.stop
90
+ end
91
+
92
+ end
93
+
94
+ class TestSidekiqServer
95
+ def boot(chillout_port:)
96
+ sample_app_name = ENV['SAMPLE_APP'] || 'rails_4_0_0'
97
+ sample_app_root = Pathname.new(File.expand_path('../support', __FILE__)).join(sample_app_name)
98
+ command = [
99
+ Gem.ruby,
100
+ sample_app_root.join('script/bundle').to_s,
101
+ 'exec sidekiq'
102
+ ].join(' ')
103
+ @executor = Bbq::Spawn::Executor.new(command) do |process|
104
+ process.cwd = sample_app_root.to_s
105
+ process.environment['BUNDLE_GEMFILE'] = sample_app_root.join('Gemfile').to_s
106
+ process.environment['RAILS_ENV'] = 'production'
107
+ process.environment['CHILLOUT_PORT'] = chillout_port.to_s
108
+ end
109
+ @executor = Bbq::Spawn::CoordinatedExecutor.new(
110
+ @executor,
111
+ banner: "Starting processing, hit Ctrl-C to stop",
112
+ timeout: 15
113
+ )
114
+ @executor.start
115
+ @executor.join
116
+ end
117
+
118
+ def shutdown
119
+ @executor.stop
120
+ end
121
+
122
+ def push_job
123
+ Sidekiq::Testing.disable! do
124
+ Sidekiq::Client.push(
125
+ 'class' => 'CreateEntityJob',
126
+ 'queue' => 'default',
127
+ 'args' => []
128
+ )
129
+ end
130
+ end
131
+ end
132
+
133
+ class TestEndpoint
134
+
135
+ attr_reader :metrics, :startups
136
+
137
+ def initialize(port: 8080)
138
+ @metrics = Queue.new
139
+ @startups = Queue.new
140
+ @port = port
141
+ end
142
+
143
+ def listen
144
+ Thread.new do
145
+ Rack::Server.start(
146
+ :app => self,
147
+ :Host => 'localhost',
148
+ :Port => @port
149
+ )
150
+ end
151
+ end
152
+
153
+ def call(env)
154
+ payload = MultiJson.load(env['rack.input'].read) rescue {}
155
+
156
+ case env['PATH_INFO']
157
+ when /clients/
158
+ startups << payload
159
+ when /metrics/
160
+ metrics << payload
161
+ end
162
+
163
+ [200, {'Content-Type' => 'text/plain'}, ['OK']]
164
+ end
165
+
166
+ def has_received_information_about_startup
167
+ 10.times do
168
+ begin
169
+ return startups.pop(true)
170
+ rescue ThreadError
171
+ sleep(1)
172
+ end
173
+ end
174
+ false
175
+ end
176
+
177
+ def has_one_creation_for_entity_resource
178
+ 10.times do
179
+ begin
180
+ return metrics.pop(true)
181
+ rescue ThreadError
182
+ sleep(1)
183
+ end
184
+ end
185
+ false
186
+ end
48
187
 
49
188
  end
50
189
 
51
- class ChilloutTestException < Exception; end
data/test/worker_test.rb CHANGED
@@ -6,7 +6,7 @@ module Chillout
6
6
  @dispatcher = stub
7
7
  @queue = stub
8
8
  @container = stub
9
- @logger = stub(:info => "", :error => "")
9
+ @logger = stub(info: "", error:"", debug: "")
10
10
  @container_class = stub(:new => @container)
11
11
  @worker = Worker.new(@dispatcher, @queue, @logger, @container_class)
12
12
  end