MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.74k stars 406 forks source link

Check if memcached is running during memcache spec, and fail if not running #591

Closed technicalpickles closed 1 year ago

technicalpickles commented 1 year ago

I was trying to run the test suite locally, and it failed here because I didn't have memcached running (yet):

  1) Rack::MiniProfiler::MemcacheStore page struct storage can store a PageStruct and retrieve it
     Failure/Error: @client.set("#{@prefix}#{page_struct[:id]}", Marshal::dump(page_struct), @expires_in_seconds)

     Dalli::RingError:
       No server available
     # ./lib/mini_profiler/storage/memcache_store.rb:22:in `save'
     # ./spec/lib/storage/memcache_store_spec.rb:17:in `block (4 levels) in <top (required)>'

This adds a alive? method that the spec can check, and give more specific information to the user. I've also included a docker-compose.yml to give a one-liner to start memcached.