diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2019-11-21 01:03:16 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-21 01:03:16 +0900 |
commit | d55193de9be3be6cbfa4cc2c632fce31abd23cdf (patch) | |
tree | 3565b593d68d41d2477556d114de32fdb1e04085 | |
parent | 2faa88c48d020ca93d40c304905f207f21c7fec2 (diff) | |
parent | a6f0502a2513ba0f9a621428a705a5268bbeff87 (diff) | |
download | rack-d55193de9be3be6cbfa4cc2c632fce31abd23cdf.tar.gz |
Merge pull request #1414 from rack/remove-lighttp
Remove broken lighttpd specs.
-rw-r--r-- | README.rdoc | 31 | ||||
-rwxr-xr-x | test/cgi/lighttpd.conf | 26 | ||||
-rwxr-xr-x | test/cgi/test.fcgi | 9 | ||||
-rw-r--r-- | test/helper.rb | 28 | ||||
-rw-r--r-- | test/spec_cgi.rb | 86 | ||||
-rw-r--r-- | test/spec_fastcgi.rb | 87 |
6 files changed, 1 insertions, 266 deletions
diff --git a/README.rdoc b/README.rdoc index 89bb475a..289d69e4 100644 --- a/README.rdoc +++ b/README.rdoc @@ -158,36 +158,7 @@ To run the test suite completely, you need: * memcache-client * thin -The full set of tests test FCGI access with lighttpd (on port -9203) so you will need lighttpd installed as well as the FCGI -libraries and the fcgi gem: - -Download and install lighttpd: - - http://www.lighttpd.net/download - -Installing the FCGI libraries: - -If you use Homebrew: - - brew install fcgi - -Or using curl: - - curl -O -k -L https://github.com/FastCGI-Archives/FastCGI.com/raw/master/original_snapshot/fcgi-2.4.1-SNAP-0910052249.tar.gz - tar xvfz fcgi-2.4.1-SNAP-0910052249.tar.gz - cd fcgi-2.4.1-SNAP-0910052249 - - ./configure --prefix=/usr/local - make - sudo make install - cd .. - -Installing the Ruby fcgi gem: - - gem install fcgi - -Furthermore, to test Memcache sessions, you need memcached (will be +To test Memcache sessions, you need memcached (will be run on port 11211) and memcache-client installed. == Configuration diff --git a/test/cgi/lighttpd.conf b/test/cgi/lighttpd.conf deleted file mode 100755 index c195f78c..00000000 --- a/test/cgi/lighttpd.conf +++ /dev/null @@ -1,26 +0,0 @@ -server.modules = ("mod_fastcgi", "mod_cgi") -server.document-root = "." -server.errorlog = var.CWD + "/lighttpd.errors" -server.port = 9203 -server.bind = "127.0.0.1" - -server.event-handler = "select" - -cgi.assign = ("/test" => "", -# ".ru" => "" - ) - -fastcgi.server = ( - "test.fcgi" => ("localhost" => - ("min-procs" => 1, - "socket" => "/tmp/rack-test-fcgi", - "bin-path" => "test.fcgi")), - "test.ru" => ("localhost" => - ("min-procs" => 1, - "socket" => "/tmp/rack-test-ru-fcgi", - "bin-path" => CWD + "/rackup_stub.rb test.ru")), - "sample_rackup.ru" => ("localhost" => - ("min-procs" => 1, - "socket" => "/tmp/rack-test-rackup-fcgi", - "bin-path" => CWD + "/rackup_stub.rb sample_rackup.ru")), - ) diff --git a/test/cgi/test.fcgi b/test/cgi/test.fcgi deleted file mode 100755 index a67e547a..00000000 --- a/test/cgi/test.fcgi +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -require 'uri' -$:.unshift '../../lib' -require 'rack' -require '../testrequest' - -Rack::Handler::FastCGI.run(Rack::Lint.new(TestRequest.new)) diff --git a/test/helper.rb b/test/helper.rb index dff89558..38f7df40 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -4,33 +4,5 @@ require 'minitest/global_expectations/autorun' module Rack class TestCase < Minitest::Test - # Check for Lighttpd and launch it for tests if available. - `which lighttpd` - - if $?.success? - begin - # Keep this first. - LIGHTTPD_PID = fork { - ENV['RACK_ENV'] = 'deployment' - ENV['RUBYLIB'] = [ - ::File.expand_path('../../lib', __FILE__), - ENV['RUBYLIB'], - ].compact.join(':') - - Dir.chdir(::File.expand_path("../cgi", __FILE__)) do - exec "lighttpd -D -f lighttpd.conf" - end - } - rescue NotImplementedError - warn "Your Ruby doesn't support Kernel#fork. Skipping Rack::Handler::CGI and ::FastCGI tests." - else - Minitest.after_run do - Process.kill 15, LIGHTTPD_PID - Process.wait LIGHTTPD_PID - end - end - else - warn "Lighttpd isn't installed. Skipping Rack::Handler::CGI and FastCGI tests. Install lighttpd to run them." - end end end diff --git a/test/spec_cgi.rb b/test/spec_cgi.rb deleted file mode 100644 index 8d48e999..00000000 --- a/test/spec_cgi.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -require 'helper' - -if defined? Rack::TestCase::LIGHTTPD_PID - -require File.expand_path('../testrequest', __FILE__) -require 'rack/handler/cgi' - -describe Rack::Handler::CGI do - include TestRequest::Helpers - - before do - @host = '127.0.0.1' - @port = 9203 - end - - if `which lighttpd` && !$?.success? - raise "lighttpd not found" - end - - it "respond" do - sleep 1 - GET("/test") - response.wont_be :nil? - end - - it "be a lighttpd" do - GET("/test") - status.must_equal 200 - response["SERVER_SOFTWARE"].must_match(/lighttpd/) - response["HTTP_VERSION"].must_equal "HTTP/1.1" - response["SERVER_PROTOCOL"].must_equal "HTTP/1.1" - response["SERVER_PORT"].must_equal @port.to_s - response["SERVER_NAME"].must_equal @host - end - - it "have rack headers" do - GET("/test") - response["rack.version"].must_equal [1, 3] - assert_equal false, response["rack.multithread"] - assert_equal true, response["rack.multiprocess"] - assert_equal true, response["rack.run_once"] - end - - it "have CGI headers on GET" do - GET("/test") - response["REQUEST_METHOD"].must_equal "GET" - response["SCRIPT_NAME"].must_equal "/test" - response["REQUEST_PATH"].must_equal "/" - response["PATH_INFO"].must_be_nil - response["QUERY_STRING"].must_equal "" - response["test.postdata"].must_equal "" - - GET("/test/foo?quux=1") - response["REQUEST_METHOD"].must_equal "GET" - response["SCRIPT_NAME"].must_equal "/test" - response["REQUEST_PATH"].must_equal "/" - response["PATH_INFO"].must_equal "/foo" - response["QUERY_STRING"].must_equal "quux=1" - end - - it "have CGI headers on POST" do - POST("/test", { "rack-form-data" => "23" }, { 'X-test-header' => '42' }) - status.must_equal 200 - response["REQUEST_METHOD"].must_equal "POST" - response["SCRIPT_NAME"].must_equal "/test" - response["REQUEST_PATH"].must_equal "/" - response["QUERY_STRING"].must_equal "" - response["HTTP_X_TEST_HEADER"].must_equal "42" - response["test.postdata"].must_equal "rack-form-data=23" - end - - it "support HTTP auth" do - GET("/test", { user: "ruth", passwd: "secret" }) - response["HTTP_AUTHORIZATION"].must_equal "Basic cnV0aDpzZWNyZXQ=" - end - - it "set status" do - GET("/test?secret") - status.must_equal 403 - response["rack.url_scheme"].must_equal "http" - end -end - -end # if defined? Rack::TestCase::LIGHTTPD_PID diff --git a/test/spec_fastcgi.rb b/test/spec_fastcgi.rb deleted file mode 100644 index f3942076..00000000 --- a/test/spec_fastcgi.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -require 'helper' - -if defined? Rack::TestCase::LIGHTTPD_PID - -require File.expand_path('../testrequest', __FILE__) -require 'rack/handler/fastcgi' - -describe Rack::Handler::FastCGI do - include TestRequest::Helpers - - before do - @host = '127.0.0.1' - @port = 9203 - end - - it "respond" do - sleep 1 - GET("/test") - response.wont_be :nil? - end - - it "respond via rackup server" do - GET("/sample_rackup.ru") - status.must_equal 200 - end - - it "be a lighttpd" do - GET("/test.fcgi") - status.must_equal 200 - response["SERVER_SOFTWARE"].must_match(/lighttpd/) - response["HTTP_VERSION"].must_equal "HTTP/1.1" - response["SERVER_PROTOCOL"].must_equal "HTTP/1.1" - response["SERVER_PORT"].must_equal @port.to_s - response["SERVER_NAME"].must_equal @host - end - - it "have rack headers" do - GET("/test.fcgi") - response["rack.version"].must_equal [1, 3] - assert_equal false, response["rack.multithread"] - assert_equal true, response["rack.multiprocess"] - assert_equal false, response["rack.run_once"] - end - - it "have CGI headers on GET" do - GET("/test.fcgi") - response["REQUEST_METHOD"].must_equal "GET" - response["SCRIPT_NAME"].must_equal "/test.fcgi" - response["REQUEST_PATH"].must_equal "/" - response["PATH_INFO"].must_equal "" - response["QUERY_STRING"].must_equal "" - response["test.postdata"].must_equal "" - - GET("/test.fcgi/foo?quux=1") - response["REQUEST_METHOD"].must_equal "GET" - response["SCRIPT_NAME"].must_equal "/test.fcgi" - response["REQUEST_PATH"].must_equal "/" - response["PATH_INFO"].must_equal "/foo" - response["QUERY_STRING"].must_equal "quux=1" - end - - it "have CGI headers on POST" do - POST("/test.fcgi", { "rack-form-data" => "23" }, { 'X-test-header' => '42' }) - status.must_equal 200 - response["REQUEST_METHOD"].must_equal "POST" - response["SCRIPT_NAME"].must_equal "/test.fcgi" - response["REQUEST_PATH"].must_equal "/" - response["QUERY_STRING"].must_equal "" - response["HTTP_X_TEST_HEADER"].must_equal "42" - response["test.postdata"].must_equal "rack-form-data=23" - end - - it "support HTTP auth" do - GET("/test.fcgi", { user: "ruth", passwd: "secret" }) - response["HTTP_AUTHORIZATION"].must_equal "Basic cnV0aDpzZWNyZXQ=" - end - - it "set status" do - GET("/test.fcgi?secret") - status.must_equal 403 - response["rack.url_scheme"].must_equal "http" - end -end - -end # if defined? Rack::TestCase::LIGHTTPD_PID |