Fix order-dependent ActionCable spec failure
What does this MR do and why?
If another spec uses ActionCable before the ActionCable initializer
spec runs, then the current PubSub Redis connection will already be
configured with a memoized identifier. The spec attempts to test a
Redis configuration with a nil
identifier to support GCP
Memorystore, but for that to work we need to reset the Redis
connection and cause the new config to be used.
This commit fixes the order-dependent test by clearing out the
ActionCable server status before and after the test via
ActionCable.server.restart
.
Closes #418937 (closed)
How to set up and validate locally
Run:
bundle exec rspec spec/graphql/resolvers/users/participants_resolver_spec.rb spec/initializers/action_cable_subscription_adapter_identifier_spec.rb
On master
, this fails with something like:
Failures:
1) ActionCableSubscriptionAdapterIdentifier override #identifier when id key is nil on cable.yml does not override server config id with action cable pid
Failure/Error: expect(sub.connection[:id]).to eq('unix:///home/localuser/redis/redis.socket/0')
expected: "unix:///home/localuser/redis/redis.socket/0"
got: "ActionCable-PID-54546"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Stan Hu