| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Because of the expanding whitelist for test filters, this test ended up
running the tests on lines 4 and 9 in the post test even though the path
wasn't right.
Happened incidentally because the same line numbers were used in both
account and post test.
Add the .rb line so the file is required correctly and the filters are
applied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`derive_regexp` was written with the assumption that we were run from a
blank slate — that if the filter didn't match we might as well return it
because it was nil.
This isn't the case because minitest calls `run` on every runnable. Which
is any subclass of Minitest::Runnable, such as ActiveSupport::TestCase,
ActionDispatch::IntegrationTest as well as any inheriting from those.
Thus after the first `run` we'd have put in a composite filter in
`options[:filter]` making the next `run` create a linked list when it
failed to match the regexp and put the composite filter as the head.
Every runnable would accumulate more and more of the same filters,
which effectively acted like an expanding whitelist and we ran tests
from other runnables.
Clog the accumulation by returning nil if there's no filter to derive
a regexp from.
Note: we pass a seed in the tests because Minitest shuffles the runnables
to ensure the whitelist is expanded enough that the failure is triggered.
|
|
|
|
|
| |
For other task has become to use the rails command at doc and test,
I think that routes task also it is better to use the rails command.
|
|\
| |
| | |
move `test_generator_if_skip_action_cable_is_given_for_an_api_app` to the appropriate file
|
| |
| |
| |
| |
| |
| | |
appropriate file
Test of Rails API should be in `api_app_generator_test.rb`.
|
|/
|
|
|
|
| |
Generated engines should call `protect_from_forgery`. If this method
isn't called, then the Engine could be susceptible to XSS attacks.
Thanks @tomekr for reporting this to us!
|
|\
| |
| | |
Add options for rake routes task
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add two options: `-c` and `-g`.
`-g` option returns the urls name, verb and path fields that match the pattern.
`-c` option returns the urls for specific controller.
Fixes #18902, and Fixes #20420
[Anton Davydov & Vipul A M]
|
|\ \
| |/
|/|
| |
| | |
yahonda/shorten_internal_metadata_table_name_less_than_30_byte
Shorten ActiveRecord::InternalMetadata.table_name to ar_internal_metadata
|
| |
| |
| |
| | |
to support Oracle database which only supports 30 byte identifier length
|
|\ \
| | |
| | | |
Add Default Puma Config
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When the `puma` command is run without any configuration options it will detect presence of a `config/puma.rb` file and use that. Currently there is discrepancy between `puma` command and `rails server` but Evan said it would be reasonable to add in reading in config from the default location. I am working on that right now as a feature in puma/puma.
Why do we need this? By default Puma uses 16 threads, and by default ActiveRecord only has 5 threads. Due to the architecture of AR it is guaranteed that if you're running with fewer DB connections than your server has threads you will hit `ActiveRecord::ConnectionTimeoutError ` eventually if your app gets modest amounts of traffic. Since we are providing a default webserver, we should provide reasonable configuration for that webserver.
This PR does a few things, first it sets the default Puma thread count to 5 to mach ActiveRecord's default. It sets the default environment to `"development"` and the default port to 300 so that booting the server with `$ puma` will give you the same default port as `rails server`. It is worth mentioning that by reading in from `PORT` environment variable this config can work with containerized deployments, such as on Heroku.
We are not using worker processes by default, that way JRuby and windows devs can use this configuration without modification. I went ahead and included a default `on_worker_boot`. It won't be used unless a worker count is specified, that means this config will not use it. Even though it's not being used now It will make someone who wants to try modifying their config to run extra workers easier.
cc/ @pixeltrix
|
|\ \ \
| |_|/
|/| | |
Redis sans EventMachine
|
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|/ / |
|
| | |
|
| |
| |
| |
| | |
As requested by David in 23233.
|
|\ \
| | |
| | | |
Be consistent in testing outputs from railties test and use /bin/rails
|
| | |
| | |
| | |
| | |
| | |
| | | |
everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere
[Ryo Hashimoto & Vipul A M]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- Using `references` or `belongs_to` in migrations will always add index
for the referenced column by default, without adding `index:true` option
to generated migration file.
- Users can opt out of this by passing `index: false`.
- Legacy migrations won't be affected by this change. They will continue
to run as they were before.
- Fixes #18146
|
|/ /
| |
| |
| |
| |
| | |
as argument
- Fixes #23137.
|
|/ |
|
|
|
|
|
| |
Because the form is not in the Rails API,
`per_form_csrf_tokens` initializer I think unnecessary.
|
|\
| |
| | |
Remove action_cable_meta_tag when skip Action Cable
|
| | |
|
|/ |
|
|\
| |
| |
| |
| | |
y-yagi/add_application_mailer_rb_to_mountable_engine
add application_mailer.rb to template of mountable engine
|
| | |
|
| |
| |
| |
| |
| | |
since 9446e38ba47c9ca3be2ad668d8a8bea0141be6fc, generated mailer inherents from ApplicationMailer,
ApplicationMailer is required in the mountable engine.
|
|\ \
| | |
| | |
| | | |
Adapterize storage for ActionCable
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
Forgot to remove it, when I changed the expectations in 88881d2.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If running `bin/rails t test/models/bunny_test.rb:` we'd implicitly run all the
tests in the bunny test. I now highly doubt that people would ever put in a line
filter without a line *and* want that to mean run all tests in that file.
Instead, change regex to require a line digit after the colon, so runs without a
line at the end would fail to require the test file.
This also has the side benefit of breaking requiring a file with many colons:
`bin/rails t test/models/bunny_test.rb:::::::::::::4`
Think this means I've had enough colonoscopy to last me through the year :)
|
|\ \ \
| |/ /
|/| | |
CodeStatistic will now ignore hidden files:
|
| | |
| | |
| | |
| | | |
- Modify the default regex to not match hidden files
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix bug (#22811) that occurs when rails server is started in daemon mode
and optional path to the `server.pid` file is omitted. Store default path
in a constant instead of evaluating it multiple time using `File.expand_path`.
The bug in detail: The server startup procedure crashes, since it tries to
open a file at `/tmp/pids/server.pid` instead of
`<path to project>/tmp/pids/server.pid`. This bug was introduced in 51211a94bd
when Rack was upgraded from version 1.x to 2.x. Since version 2.x,
Rack does not memoize the options hash [1], and as a consequence
`Rails::Server#default_options` will be evaluated multiple times.
The hash returned by `Rails::Server#default_options` holds the default path
to the `server.pid` file. The path is generated with the method
`File.expand_path`. However, the return value of this method depends on the
current working directory [2], which changes once `Process.daemon` is invoked
by `Rack::Server#daemonize_app` and the process is detached from the current
shell.
Close #22811
[1]https://git.io/vzen2
[2]http://ruby-doc.org/core-2.1.5/File.html#method-c-expand_path
|
| |
| |
| |
| |
| |
| |
| | |
Closes #23027.
This does not restore complete backwards compatibility. It simply passes
the contets of the `TEST` env to the new runner.
|
|/
|
|
|
|
|
|
|
| |
This removes the following warnings.
```
test/application/rake_test.rb:33: warning: ambiguous first argument; put parentheses or a space even after `/' operator
test/application/rake_test.rb:43: warning: ambiguous first argument; put parentheses or a space even after `/' operator
```
|
| |
|
|
|
|
|
|
|
|
| |
- Avoided truncating all files if no ENV['LOGS'] specified
- Updated task to accept LOGS=all for truncating all files from log/ i.e. log/*log
- If no LOGS specified will truncates standard environment log files i.e. 'development,test,production'
- CHANGELOG & guide update added
- bin/setup test cases fixed
|
|\
| |
| | |
Prevent destructive action on production database
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd.
It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large.
To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In high volume applications it can be very difficult to figure out what is happening in logs because each request is not easily identified. For example 3 requests could look something like this:
```
Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:21 +0000
Rendered welcome/index.html.erb within layouts/application (0.1ms)
Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:22 +0000
Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:23 +0000
Rendered welcome/index.html.erb within layouts/application (0.1ms)
Processing by WelcomeController#index as HTML
Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/application (0.1ms)
Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
Processing by WelcomeController#index as HTML
Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
```
The `:request_id` log tag ensures that each request is tagged with a unique identifier. While they are still interleaved it is possible to figure out which lines belong to which requests. Like:
```
[c6034478-4026-4ded-9e3c-088c76d056f1] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:21 +0000
[c6034478-4026-4ded-9e3c-088c76d056f1] Rendered welcome/index.html.erb within layouts/application (0.1ms)
[abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:22 +0000
[acfab2a7-f1b7-4e15-8bf6-cdaa008d102c] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:23 +0000
[abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Rendered welcome/index.html.erb within layouts/application (0.1ms)
[c6034478-4026-4ded-9e3c-088c76d056f1] Processing by WelcomeController#index as HTML
[c6034478-4026-4ded-9e3c-088c76d056f1] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
[abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Processing by WelcomeController#index as HTML
[abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Rendered welcome/index.html.erb within layouts/application (0.1ms)
[abuqw781-5026-6ded-7e2v-788c7md0L6fQ] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
[acfab2a7-f1b7-4e15-8bf6-cdaa008d102c] Processing by WelcomeController#index as HTML
[acfab2a7-f1b7-4e15-8bf6-cdaa008d102c] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
```
Now if you have the logs and you find this unique ID you can filter to only look at information from that request. So a filtered log output would be very clear:
```
[c6034478-4026-4ded-9e3c-088c76d056f1] Started GET "/" for 72.48.77.213 at 2016-01-06 20:30:21 +0000
[c6034478-4026-4ded-9e3c-088c76d056f1] Rendered welcome/index.html.erb within layouts/application (0.1ms)
[c6034478-4026-4ded-9e3c-088c76d056f1] Processing by WelcomeController#index as HTML
[c6034478-4026-4ded-9e3c-088c76d056f1] Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.0ms)
```
In addition to this benefit the `:request_id` can be set via the `X-Request-ID` header so that the same request could be traced between multiple components. For example a request comes in Nginx (or another load balancer) could assign a request id. As the load balancer processes the request I can log using that id, then when the request is passed on to Rails, the same id is used. That way if a problem is determined to be not caused in Rails it could be traced back to other components with the same ID. You can set a value in nginx for example using something like this:
```
location / {
proxy_pass http://upstream;
proxy_set_header X-Request-Id $pid-$msec-$remote_addr-$request_length;
}
# http://stackoverflow.com/questions/17748735/setting-a-trace-id-in-nginx-load-balancer
```
Heroku sets this header value so problems like timeouts that are logged by like router can be traced back to specific request within the application.
Whether you are using components that are setting request ID or not, all production applications can benefit from the additional debugging information of having a unique identifier for all requests. This change will only affect new applications, anyone can opt out by commenting or removing the line in `config/production.rb`.
|
|\ \
| | |
| | |
| | |
| | | |
y-yagi/make_generated_controller_test_file_work_correctly
make generated controller test work correctly
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since the `#file_name` that not consideration for the namespace, if generate a controller with a namespace,
not the correct url helper generation, it had become an error to run the test.
Modified to generate the correct url helper, even if it is produced a namespace with controller.
|
|\ \ \
| | | |
| | | | |
Per-form CSRF tokens
|
| |/ / |
|
|/ /
| |
| |
| | |
Add tests for detecting bad options for runner
|