Skip to content
  • eileencodes's avatar
    1f98fd2b
    Implement ability to opt out of parallel database hooks · 1f98fd2b
    eileencodes authored
    Preivously, you could append your own hooks to parallel tests, but there
    was no way to skip the Rails database parallelization hooks. There may
    be cases where you want to implement your own database handling, so this
    allows you to implement all of that in a `parallelize_setup` block
    without having Rails create any databases for you.
    
    To skip Rails database parallelization when running parallel tests you
    can set it in the `parallelize` caller:
    
    ```ruby
    parallelize(workers: 10, parallelize_databases: false)
    ```
    
    Or in your application config:
    
    ```ruby
    config.active_support.parallelize_test_databases = false
    ```
    
    This is set to true by default.
    
    Note: if you do not create databases for the processes, it is possible
    for your test suite to deadlock. If you're seeing frequent deadlocks,
    you may need to create more databases for the processes to use or adjust
    your tests/code so it's less likely to cause database contention.
    1f98fd2b
    Implement ability to opt out of parallel database hooks
    eileencodes authored
    Preivously, you could append your own hooks to parallel tests, but there
    was no way to skip the Rails database parallelization hooks. There may
    be cases where you want to implement your own database handling, so this
    allows you to implement all of that in a `parallelize_setup` block
    without having Rails create any databases for you.
    
    To skip Rails database parallelization when running parallel tests you
    can set it in the `parallelize` caller:
    
    ```ruby
    parallelize(workers: 10, parallelize_databases: false)
    ```
    
    Or in your application config:
    
    ```ruby
    config.active_support.parallelize_test_databases = false
    ```
    
    This is set to true by default.
    
    Note: if you do not create databases for the processes, it is possible
    for your test suite to deadlock. If you're seeing frequent deadlocks,
    you may need to create more databases for the processes to use or adjust
    your tests/code so it's less likely to cause database contention.
Loading