New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unused attr_writer #2955
Remove unused attr_writer #2955
Conversation
48e490e
to
d7f7c00
Compare
Thanks for working on this. In the comment, I mentioned "(tests may need changes)". Ok, that was not true. I should have said "tests will require changes, and there may be several files that require small changes to several tests.". Tests that start the server in Below is a quick patch for test_persistent.rb. test_persistent.rb patchdiff --git a/test/test_persistent.rb b/test/test_persistent.rb
index be90d09b..863c4d6d 100644
--- a/test/test_persistent.rb
+++ b/test/test_persistent.rb
@@ -1,4 +1,5 @@
require_relative "helper"
+require "puma/log_writer"
class TestPersistent < Minitest::Test
@@ -23,9 +24,9 @@ class TestPersistent < Minitest::Test
[status, @headers, @body]
end
- @server = Puma::Server.new @simple
+ opts = {min_threads: 1, max_threads: 1}
+ @server = Puma::Server.new @simple, Puma::LogWriter.stdio, Puma::Events.new, opts
@port = (@server.add_tcp_listener HOST, 0).addr[1]
- @server.max_threads = 1
@server.run
sleep 0.15 if Puma.jruby?
@client = TCPSocket.new HOST, @port
@@ -156,7 +157,7 @@ class TestPersistent < Minitest::Test
end
def test_persistent_timeout
- @server.persistent_timeout = 1
+ @server.instance_variable_set(:@persistent_timeout, 1)
@client << @valid_request
sz = @body[0].size.to_s
@@ -193,7 +194,7 @@ class TestPersistent < Minitest::Test
def test_two_requests_in_one_chunk
- @server.persistent_timeout = 3
+ @server.instance_variable_set(:@persistent_timeout, 3)
req = @valid_request.to_s
req += "GET /second HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n"
@@ -210,7 +211,7 @@ class TestPersistent < Minitest::Test
end
def test_second_request_not_in_first_req_body
- @server.persistent_timeout = 3
+ @server.instance_variable_set(:@persistent_timeout, 3)
req = @valid_request.to_s
req += "GET /second HTTP/1.1\r\nHost: test.com\r\nContent-Type: text/plain\r\n\r\n" |
a427356
to
bc6dd87
Compare
Co-authored-by: MSP-Greg <Greg.mpls@gmail.com>
bc6dd87
to
3e798ac
Compare
@MSP-Greg Thanks for sharing a patch. I just applied it and fixed some tests. |
@@ -156,7 +157,7 @@ def test_one_with_keep_alive_header | |||
end | |||
|
|||
def test_persistent_timeout | |||
@server.persistent_timeout = 1 | |||
@server.instance_variable_set(:@persistent_timeout, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later, we should rewrite the tests so we can pass this in as an option when we create the server object, rather than have to change the instance variable.
The real motivation behind removing these methods wasn't spelled out here so I dug it up, see these comments from Nate and Greg: |
Description
from #2918 (comment).
Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.