1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
Commit graph

5 commits

Author SHA1 Message Date
schneems
85dfe8edcf Implement user_supplied_options behavior.
When options are passed to the Puma rack handler it is unknown if the options were set via a framework as a default or via a user. Puma currently has 3 different sources of configuration, the user via command line, the config files, and defaults. 

Rails 5.1+ will record the values actually specified by the user versus the values specified by the frameworks. It passes these values to the Rack handler and now it's up to Puma to do something with that information.

When only framework defaults are passed it will set

```
options[:user_supplied_options] = []
```

When one or more options are specified by the user such as `:Port` then those keys will be in the array. In that example it will look like this


```
options[:user_supplied_options] = [:Port]
```

This change is 100% backwards compatible. If the framework is older and does not pass this information then the `user_supplied_options` will not be set, in that case we assume all values are user supplied.

Internally we accomplish this separation by replacing `LeveledOptions` which was a generic way of specifying options with different priorities with a more explicit `UserFileDefaultOptions` this assumes only 3 levels of options and it will use them in the order supplied (user config wins over file based config wins over defaults).

Now instead of using 1 dsl to set all values, we use 3. A user dsl, a file dsl and a Configuration.new` will return all 3 DSLs to the block. It's up to the person using the block to use the correct dsl corresponding to the source of data they are getting.
2017-03-09 11:38:26 -06:00
Fumiaki MATSUSHIMA
0b3424a7d6 Fix test error
We got following error on travis now:

https://travis-ci.org/puma/puma/jobs/207434226

```
1) Error:
WebServerTest#test_simple_server:
NameError: uninitialized constant Net
    /home/travis/build/puma/puma/test/test_helper.rb:24:in `block in hit'
    /home/travis/build/puma/puma/test/test_helper.rb:20:in `each'
    /home/travis/build/puma/puma/test/test_helper.rb:20:in `hit'
    /home/travis/build/puma/puma/test/test_web_server.rb:36:in `test_simple_server'
```

I confirmed test passed with bundler 1.14.4 but errored with 1.14.5.

https://github.com/bundler/bundler/compare/v1.14.4...v1.14.5

The cause is 984f64d8a5
because `rubygems/spec_fetcher` requires `net/http` internally but is deferred now.

I think we should require stdlibs explicitly.
2017-03-09 00:56:07 +09:00
Nate Berkopec
d6acadaefd Fix timeout not being included 2017-03-03 09:53:33 -07:00
Jun Aruga
063c721c13 Use conditionalized requiring for the test environment without Bundler. 2017-02-18 15:51:06 +01:00
Francesco Rodriguez
b638dd1948 Use Minitest instead of Test::Unit (#1152)
* Bump minitest version.

* Add basic test helper file.

* Use minitest for web server tests.

* Use Minitest for unix socket tests.

* Use Minitest for ThreadPool tests.

* Use Minitest for TCP-Rack tests

* Use Minitest for TCPLogger tests.

* Add missing helper to test helpers.

* Use Minitest for Rack server tests.

* Use Minitest for Rack handler tests.

* Use Minitest for Puma::Server tests.

* Use Minitest for Puma::Server with SSL tests.

* Use Minitest for persisten connections tests.

* Require puma in test_helper file.

* Use minitest for Puma::NullIO tests.

* Remove unnecessary requires on test files.

* Use Minitest for MiniSSL tests.

* Use Minitest for IOBuffer tests.

* Require bundler/setup in Rakefile.

* Use Minitest for HttpParser tests.

* Use Minitest for Puma::Configuration tests.

* Use Minitest for Puma::CLI tests.

* Bump Minitest version for Ruby 2.1 Gemfile.

* Use Minitest for integration tests.

* Use Minitest for Puma::App::Status tests.

* Remove test-unit from Gemfiles.

* Add timeout helper to Minitest::Test.

* Use Minitest for Puma::Binder tests.

* Remove testhelp file.

* Add missing require to Puma::Binder tests.

* Prefer require instead of require_relative.
2016-11-22 08:05:49 -07:00
Renamed from test/testhelp.rb (Browse further)