aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/subscription_adapter
Commit message (Collapse)AuthorAgeFilesLines
* Fix test case to ensure default connection id is filledRyuta Kamizono2018-09-071-2/+2
| | | | Follow up of #33798.
* ActionCable: add id option to redis adapter configIlia Kasianenko2018-09-051-2/+10
|
* Add Action Cable test adapterVladimir Dementyev2018-08-191-0/+47
|
* Merge pull request #33102 from bogdanvlviv/refactor-actioncable-testsRafael França2018-06-081-4/+1
|\ | | | | Refactor actioncable's tests
| * Include `ActiveSupport::Testing::MethodCallAssertions` to ↵bogdanvlviv2018-06-081-3/+0
| | | | | | | | | | | | | | | | | | `ActionCable::TestCase` Remove all `include ActiveSupport::Testing::MethodCallAssertions` in actioncable's tests since we can do it only in `ActionCable::TestCase` in order to prevent code duplication. We use the same approach for other modules of Rails.
| * Inherit all actioncable's test classes from `ActionCable::TestCase`bogdanvlviv2018-06-081-1/+1
| | | | | | | | | | | | We have defined `ActionCable::TestCase` in `actioncable/test/test_helper.rb` that we can use in order to prevent code duplication and build common interface for actioncable's test.
* | Merge pull request #27577 from maclover7/jm-fix-27547Rafael Mendonça França2018-06-081-0/+23
|\ \ | |/ |/| | | Action Cable owns database connection, not Active Record
| * Action Cable owns database connection, not Active RecordJon Moss2017-03-251-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the database connection used in Action Cable's PostgreSQL adapter was "owned" by `ActiveRecord::Base.connection_pool`. This meant that if, for example, `#clear_reloadable_connections!` was called on the pool, Active Record would "steal" the database connection from Action Cable, and would cause all sorts of issues. This became evident during file reloads; despite Action Cable trying its hardest to return its borrowed database connection to Active Record via `@pubsub.shutdown`, Active Record calls `#clear_reloadable_connections!` on the connection pool, and due to the order of callbacks, Active Record's callback was being executed first. This meant that if you tried to rerender a view after a file was reloaded, you would have to wait through Active Record's timeout and such. Now, Action Cable takes direct ownership of the database connection it uses. It removes the connection from the pool to avoid the situation described above. Action Cable also makes sure to call `#disconnect!` on the connection when appropriate, to match the previous behavior of Active Record. [ Jon Moss & Matthew Draper]
* | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-1/+1
| |
* | Action Cable: run Redis tests against a default config without a passwordJeremy Daer2017-11-131-2/+21
| | | | | | | | | | | | | | | | Simplify our dev testing and CI story since we're also testing against Redis for the Active Support cache store. Directly test whether db, host, password, etc are passed through as config instead of spinning up a Redis server with a password set on it.
* | Removed deprected evented redis adapterRafael Mendonça França2017-10-231-61/+0
| |
* | Use frozen string literal in actioncable/Kir Shatrov2017-07-239-0/+18
| |
* | Fix postgresql adapter setup for ActionCable testspalkan2017-07-111-1/+1
| | | | | | | | | | (cherry picked from commit e2093c1f678175bde7c37c848686d979427346e1) (cherry picked from commit d7dbe48273bd9e0adb1de5b52e3cdaeb4a65630b)
* | [Fix #28751] Hash stream long stream identifiers when using Postgres adapterpalkan2017-07-061-0/+14
| |
* | Remove redundant `assert_respond_to`Ryuta Kamizono2017-07-031-13/+3
| | | | | | | | It is covered by following assertion.
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-029-9/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* | Enforce frozen string in RubocopKir Shatrov2017-07-019-0/+9
| |
* | Allows for other common redis options to be in cable.yml, by defaultMarc Ignacio2017-06-222-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adds RedisAdapterTest::AlternateConfiguration to account for a relatively common alternative setup, as it’s used as the first example in the [Redis rubygem](https://github.com/redis/redis-rb#getting-started) - Supplies original RedisAdapterTest with more complete redis:// url format by adding a ‘userinfo’ (blank user), so that it resembles the alternate configuration - Supplies original EventedRedisAdapterTest with more complete redis:// url as well - Adds before_script to start redis-server with password as a daemon and with explicit defaults copied from the default redis.conf (Instead of using Travis' default init/upstart scripts for `redis` service)
* | Use `require_relative` instead of `require` with full pathbogdanvlviv2017-06-145-7/+7
|/
* Deprecate the EventedRedis subscription adapterMatthew Draper2017-02-231-1/+3
| | | | | Unlike Faye support, it seems a bit too documented to remove without warning. So, here's a warning.
* Add channel_prefix support to ActionCable redis/evented_redis adapters.Chad Ingram2017-01-173-0/+40
|
* Prevent race condition when launching EventMachine reactorMatthew Draper2016-11-301-0/+26
| | | | | | | reactor_running? will be true just after the thread enters EventMachine.run; reactor_thread only gets set after the internal initialize_event_machine method has been called, the C extension is set up, and it is entering its run loop.
* Don't shut down adapters that haven't been setMatthew Draper2016-10-041-1/+1
| | | | We hit when we skip the PostgreSQL adapter.
* Shut down EventMachine before re-enabling warningsMatthew Draper2016-10-022-0/+9
|
* Remove Faye modeMatthew Draper2016-10-011-1/+0
| | | | No deprecation, because it was never documented.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-2/+0
|
* applies new string literal convention in actioncable/testXavier Noria2016-08-068-70/+70
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add guard to broadcast.mmmpa2016-05-261-0/+17
|
* Cable message encodingJeremy Daer2016-03-311-2/+1
| | | | | | | | | | | | | | | | | | | * Introduce a connection coder responsible for encoding Cable messages as WebSocket messages, defaulting to `ActiveSupport::JSON` and duck- typing to any object responding to `#encode` and `#decode`. * Consolidate encoding responsibility to the connection. No longer explicitly JSON-encode from channels or other sources. Pass Cable messages as Hashes to `#transmit` and rely on it to encode. * Introduce stream encoders responsible for decoding pubsub messages. Preserve the currently raw encoding, but make it easy to use JSON. Same duck type as the connection encoder. * Revert recent data normalization/quoting (#23649) which treated `identifier` and `data` values as nested JSON objects rather than as opaque JSON-encoded strings. That dealt us an awkward hand where we'd decode JSON strings… or not, but always encode as JSON. Embedding JSON object values directly is preferably, no extra JSON encoding, but that should be a purposeful protocol version change rather than ambiguously, inadvertently supporting multiple message formats.
* Cable: Shush pop warnings when skipping Postgres tests.Kasper Timm Hansen2016-03-261-0/+1
| | | | | | | | `skip` raises an exception to abort the execution of the test, so `super` would never be called and thus `@rx_adapter` and `@tx_adapter` would never have been defined at the time of teardown. Define them just before skipping and zap the warnings.
* Shush up EM::Hiredis when running tests.Kasper Timm Hansen2016-03-261-0/+11
| | | | | | | | | | EM::Hiredis were spewing screenfuls of warnings when running the Action Cable tests. Copied over the technique that shushes up faye-websocket in the client tests, so we can reduce the noise ratio. Note: there's still warnings spewed after tests have finished when EM::Hiredis shuts down. I haven't been able to shush them up yet.
* AC: skip PG adapter tests if the db isn't availableJeremy Daer2016-03-111-0/+7
|
* Support faye-websocket + EventMachine as an optionMatthew Draper2016-03-021-0/+1
|
* remove args from assert_nothing_raised in testsTara Scherner de la Fuente2016-02-221-3/+3
|
* Don't rely on the global server as a receiver.Kasper Timm Hansen2016-02-141-6/+0
| | | | | | | | | | | | | | | | The `WorkerTest`'s `Receiver` is imporsonating an `ActionCable::Connection::Base`, but just delegates the logger to `ActionCable.logger`. This creates a mismatch as the connection requires the logger to be a `TaggedLoggerProxy`'ied logger, while the server doesn't. Thus to ensure an exception isn't raised when the worker tries to call `tag` other tests have to assign a proxied logger to their test server. Instead of forcing change on other tests, have Receiver adhere to the connection contract and use a `TaggedLoggerProxy`. As a consequence remove more setup from the tests.
* Default connection class to ActionCable::Connection::Base.Kasper Timm Hansen2016-02-141-8/+0
| | | | | | | Instead of depending on ApplicationCable::Connection being defined at initialize we should inject it in the Railtie. Thus we can kill more setup in the tests too.
* Inject Rails' channel paths in engine.Kasper Timm Hansen2016-02-141-8/+0
| | | | | | | | | | | | | We were explicitly referencing Rails.root in ActionCable::Server::Configuration.initialize, thereby coupling ourselves to Rails. Instead add `app/channels` to Rails' app paths and assign the existent files to `channel_paths`. Users can still append to those load paths with `<<` and `push` in `config/application.rb`. This means we can remove the custom `Dir` lookup in `channel_paths` and the Rails and root definitions in the tests.
* Switch the default redis adapter to a single-stream modelMatthew Draper2016-02-012-1/+17
| | | | | | This new adapter does get a little more intimate with the redis-rb gem's implementation than I would like, but it's the least bad of the approaches I've come up with.
* Revert "Revert "Eliminate the EventMachine dependency""Matthew Draper2016-01-301-3/+0
|
* Revert "Eliminate the EventMachine dependency"David Heinemeier Hansson2016-01-271-0/+3
|
* Ditch the EM error logging helperMatthew Draper2016-01-241-1/+0
| | | | | | We're no longer doing our work in the EM event loop, so errors are quite unlikely, and if they do occur, they're not really our responsibility to handle.
* Using a hacked faye-websocket, drop EventMachineMatthew Draper2016-01-241-2/+0
|
* Add tests for the ActionCable adaptersMatthew Draper2016-01-245-0/+218
|
* ActionCable::StorageAdapter ==> ActionCable::SubscriptionAdapterJon Moss2016-01-181-0/+73