Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move all tests inside the PhusionPassenger namespace instead of inclu…

…ding PhusionPassenger in the global namespace, otherwise it can cause weird conflicts with Rack.
  • Loading branch information...
commit c52449a7773d2bd685a3470a2072caf5f75d74fa 1 parent 6a5cd68
@FooBarWidget FooBarWidget authored
Showing with 121 additions and 9 deletions.
  1. +4 −0 test/ruby/abstract_request_handler_spec.rb
  2. +4 −0 test/ruby/abstract_server_collection_spec.rb
  3. +4 −0 test/ruby/abstract_server_spec.rb
  4. +4 −0 test/ruby/admin_tools_spec.rb
  5. +5 −1 test/ruby/analytics_logger_spec.rb
  6. +4 −0 test/ruby/app_process_spec.rb
  7. +4 −0 test/ruby/classic_rails/application_spawner_spec.rb
  8. +4 −0 test/ruby/classic_rails/framework_spawner_spec.rb
  9. +4 −0 test/ruby/message_channel_spec.rb
  10. +4 −0 test/ruby/rack/application_spawner_spec.rb
  11. +4 −0 test/ruby/shared/abstract_server_spec.rb
  12. +6 −1 test/ruby/shared/rails/analytics_logging_extensions_spec.rb
  13. +4 −0 test/ruby/shared/spawners/classic_rails/framework_spawner_spec.rb
  14. +4 −0 test/ruby/shared/spawners/classic_rails/lack_of_rails_gem_version_spec.rb
  15. +4 −0 test/ruby/shared/spawners/classic_rails/spawner_spec.rb
  16. +5 −1 test/ruby/shared/spawners/non_preloading_spawner_spec.rb
  17. +5 −1 test/ruby/shared/spawners/preloading_spawner_spec.rb
  18. +4 −0 test/ruby/shared/spawners/reload_all_spec.rb
  19. +4 −0 test/ruby/shared/spawners/reload_single_spec.rb
  20. +4 −0 test/ruby/shared/spawners/spawn_server_spec.rb
  21. +4 −0 test/ruby/shared/spawners/spawner_spec.rb
  22. +4 −0 test/ruby/shared/utils/pseudo_io_spec.rb
  23. +4 −0 test/ruby/spawn_manager_spec.rb
  24. +1 −2  test/ruby/spec_helper.rb
  25. +4 −0 test/ruby/utils/file_system_watcher_spec.rb
  26. +5 −1 test/ruby/utils/hosts_file_parser.rb
  27. +4 −0 test/ruby/utils/unseekable_socket_spec.rb
  28. +4 −0 test/ruby/utils_spec.rb
  29. +3 −0  test/ruby/wsgi/application_spawner_spec.rb
  30. +3 −2 test/support/test_helper.rb
View
4 test/ruby/abstract_request_handler_spec.rb
@@ -4,6 +4,8 @@
require 'fileutils'
+module PhusionPassenger
+
describe AbstractRequestHandler do
before :each do
preinitialize if respond_to?(:preinitialize)
@@ -394,3 +396,5 @@ def base64(data)
############################
end
+
+end # module PhusionPassenger
View
4 test/ruby/abstract_server_collection_spec.rb
@@ -2,6 +2,8 @@
require 'phusion_passenger/abstract_server'
require 'phusion_passenger/abstract_server_collection'
+module PhusionPassenger
+
describe AbstractServerCollection do
before :each do
@collection = AbstractServerCollection.new
@@ -241,3 +243,5 @@
block.should_not raise_error
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/abstract_server_spec.rb
@@ -1,6 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'phusion_passenger/abstract_server'
+module PhusionPassenger
+
describe AbstractServer do
before :each do
@server = AbstractServer.new
@@ -55,3 +57,5 @@
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/admin_tools_spec.rb
@@ -4,6 +4,8 @@
require 'phusion_passenger/admin_tools'
require 'phusion_passenger/admin_tools/server_instance'
+module PhusionPassenger
+
describe AdminTools do
include Utils
@@ -279,3 +281,5 @@ def create_generation(dir, number = 0, major = GENERATION_STRUCTURE_MAJOR_VERSIO
end
end
end
+
+end # module PhusionPassenger
View
6 test/ruby/analytics_logger_spec.rb
@@ -2,6 +2,8 @@
require 'stringio'
require 'phusion_passenger/analytics_logger'
+module PhusionPassenger
+
describe AnalyticsLogger do
YESTERDAY = Time.utc(2010, 4, 11, 11, 56, 02)
TODAY = Time.utc(2010, 4, 11, 12, 56, 02)
@@ -179,4 +181,6 @@ def mock_time(time)
log_file = "#{@log_dir}/1/#{FOOBAR_MD5}/#{LOCALHOST_MD5}/requests/2010/04/11/12/log.txt"
File.read(log_file).should =~ /hello/
end
-end
+end
+
+end # module PhusionPassenger
View
4 test/ruby/app_process_spec.rb
@@ -1,6 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'phusion_passenger/app_process'
+module PhusionPassenger
+
describe AppProcess do
before :each do
@stub = RailsStub.new('2.3/foobar')
@@ -37,3 +39,5 @@
detector.should raise_error(::PhusionPassenger::VersionNotFound)
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/classic_rails/application_spawner_spec.rb
@@ -10,6 +10,8 @@
require 'ruby/shared/spawners/classic_rails/lack_of_rails_gem_version_spec'
require 'ruby/shared/rails/analytics_logging_extensions_spec'
+module PhusionPassenger
+
describe ClassicRails::ApplicationSpawner do
include SpawnerSpecHelper
@@ -83,3 +85,5 @@ def spawn_some_application(extra_options = {})
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/classic_rails/framework_spawner_spec.rb
@@ -12,6 +12,8 @@
# TODO: test whether FrameworkSpawner restarts ApplicationSpawner if it crashed
+module PhusionPassenger
+
describe ClassicRails::FrameworkSpawner do
include SpawnerSpecHelper
@@ -86,3 +88,5 @@ def load_nonexistant_framework(options = {})
it_should_behave_like "a Rails spawner that supports #reload()"
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/message_channel_spec.rb
@@ -2,6 +2,8 @@
require 'socket'
require 'phusion_passenger/message_channel'
+module PhusionPassenger
+
describe MessageChannel do
describe "scenarios with a single channel" do
before :each do
@@ -190,3 +192,5 @@ def spawn_process
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/rack/application_spawner_spec.rb
@@ -8,6 +8,8 @@
require 'ruby/shared/spawners/non_preloading_spawner_spec'
require 'ruby/shared/rails/analytics_logging_extensions_spec'
+module PhusionPassenger
+
describe Rack::ApplicationSpawner do
include SpawnerSpecHelper
@@ -110,3 +112,5 @@ def spawn_some_application(extra_options = {})
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/abstract_server_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+module PhusionPassenger
+
shared_examples_for "an AbstractServer" do
it "doesn't crash if it's started and stopped multiple times" do
3.times do
@@ -17,3 +19,5 @@
lambda { server.start }.should raise_error(AbstractServer::ServerAlreadyStarted)
end
end
+
+end # module PhusionPassenger
View
7 test/ruby/shared/rails/analytics_logging_extensions_spec.rb
@@ -1,8 +1,11 @@
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'socket'
require 'fileutils'
require 'phusion_passenger/analytics_logger'
require 'phusion_passenger/utils/tmpdir'
+module PhusionPassenger
+
shared_examples_for "analytics logging extensions for Rails" do
before :each do
@agent_pid, @socket_filename = spawn_logging_agent(Utils.passenger_tmpdir, "1234")
@@ -205,4 +208,6 @@ def index
log.include?("INTERVAL: view rendering")
end
end
-end
+end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/classic_rails/framework_spawner_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a ClassicRails::FrameworkSpawner" do
it "raises FrameworkInitError if the framework could not be loaded" do
block = lambda do
@@ -32,3 +34,5 @@
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/classic_rails/lack_of_rails_gem_version_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a Rails app that lacks RAILS_GEM_VERSION" do
it "loads a random Rails version if the app doesn't specify RAILS_GEM_VERSION" do
after_start %q{
@@ -13,3 +15,5 @@
File.read("#{app.app_root}/rails_version.txt").should =~ /^(\d+.)+\d+$/
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/classic_rails/spawner_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a Rails spawner" do
it "sets RAILS_ENV" do
after_start %q{
@@ -9,3 +11,5 @@
File.read("#{app.app_root}/rails_env.txt").should == "staging"
end
end
+
+end # module PhusionPassenger
View
6 test/ruby/shared/spawners/non_preloading_spawner_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a spawner that does not preload app code" do
specify "the starting_worker_process event is called with forked=false" do
after_start %q{
@@ -20,4 +22,6 @@
lines.count("forked = false") == 2
end
end
-end
+end
+
+end # module PhusionPassenger
View
6 test/ruby/shared/spawners/preloading_spawner_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a spawner that preloads app code" do
specify "the starting_worker_process event is called with forked=true" do
after_start %q{
@@ -22,4 +24,6 @@
"forked = true\n"
end
end
-end
+end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/reload_all_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a Rails spawner that supports #reload()" do
it "#reload() reloads all applications" do
use_some_stub do |stub1|
@@ -30,3 +32,5 @@
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/reload_single_spec.rb
@@ -1,5 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+module PhusionPassenger
+
shared_examples_for "a Rails spawner that supports #reload(app_group_name)" do
it "#reload(app_group_name) reloads a specific application" do
use_some_stub do |stub1|
@@ -46,3 +48,5 @@
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/spawn_server_spec.rb
@@ -1,6 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'ruby/shared/abstract_server_spec'
+module PhusionPassenger
+
shared_examples_for "a spawn server" do
it "raises an AbstractServer::ServerError if the server was killed" do
spawner # Start the spawn server.
@@ -22,3 +24,5 @@
File.exist?(filename).should be_true
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/spawners/spawner_spec.rb
@@ -2,6 +2,8 @@
require 'yaml'
require 'etc'
+module PhusionPassenger
+
shared_examples_for "a spawner" do
def ping_app(app, connect_password)
if app.server_sockets[:main][1] == "unix"
@@ -267,3 +269,5 @@ def dummy_function
end
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/shared/utils/pseudo_io_spec.rb
@@ -2,6 +2,8 @@
require 'stringio'
require 'phusion_passenger/message_channel'
+module PhusionPassenger
+
shared_examples_for "a pseudo stderr created by #report_app_init_status" do
before :each do
@sink = StringIO.new
@@ -54,3 +56,5 @@
pseudo_stderr.instance_variable_get(:@buffer).should be_nil
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/spawn_manager_spec.rb
@@ -10,6 +10,8 @@
# TODO: test whether SpawnManager restarts the subspawner if it crashed
+module PhusionPassenger
+
describe SpawnManager do
include SpawnerSpecHelper
@@ -128,3 +130,5 @@ def spawn_some_application(extra_options = {})
end
end
end
+
+end # module PhusionPassenger
View
3  test/ruby/spec_helper.rb
@@ -25,7 +25,6 @@
require 'phusion_passenger'
require 'phusion_passenger/utils/tmpdir'
-include PhusionPassenger
include TestHelper
# Seed the pseudo-random number generator here
@@ -66,7 +65,7 @@ def self.included(klass)
# hog memory for the next test case.
eventually(5) do
@apps.all? do |app|
- !Utils.process_is_alive?(app.pid)
+ !PhusionPassenger::Utils.process_is_alive?(app.pid)
end
end
ensure
View
4 test/ruby/utils/file_system_watcher_spec.rb
@@ -1,6 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'phusion_passenger/utils/file_system_watcher'
+module PhusionPassenger
+
describe Utils::FileSystemWatcher do
before :each do
@tmpdir = "tmp.fs_watcher"
@@ -215,3 +217,5 @@ def test_block(filenames)
@watcher.close
end
end
+
+end # module PhusionPassenger
View
6 test/ruby/utils/hosts_file_parser.rb
@@ -2,6 +2,8 @@
require 'phusion_passenger/utils/hosts_file_parser'
require 'stringio'
+module PhusionPassenger
+
describe Utils::HostsFileParser do
before :each do
@io = StringIO.new
@@ -251,4 +253,6 @@ def create
target.string.should == original_data
end
end
-end
+end
+
+end # module PhusionPassenger
View
4 test/ruby/utils/unseekable_socket_spec.rb
@@ -1,6 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'phusion_passenger/utils/unseekable_socket'
+module PhusionPassenger
+
describe Utils::UnseekableSocket do
class MyException < StandardError
end
@@ -60,3 +62,5 @@ def catch_exception
Utils::UnseekableSocket.new.source_of_exception?(e2).should be_false
end
end
+
+end # module PhusionPassenger
View
4 test/ruby/utils_spec.rb
@@ -9,6 +9,8 @@
require 'ruby/shared/utils/pseudo_io_spec'
+module PhusionPassenger
+
describe Utils do
include Utils
@@ -680,3 +682,5 @@ def group_name_for_gid(gid)
######################
end
+
+end # module PhusionPassenger
View
3  test/ruby/wsgi/application_spawner_spec.rb
@@ -4,6 +4,8 @@
require 'fileutils'
require 'tempfile'
+module PhusionPassenger
+
describe WSGI::ApplicationSpawner do
include Utils
@@ -45,3 +47,4 @@ def spawn(app_root)
end
end
+end # module PhusionPassenger
View
5 test/support/test_helper.rb
@@ -361,15 +361,16 @@ def run_script(code, *args)
end
def spawn_logging_agent(log_dir, password)
+ passenger_tmpdir = PhusionPassenger::Utils.passenger_tmpdir
pid = spawn_process("#{AGENTS_DIR}/PassengerLoggingAgent",
- "server_instance_dir", Utils.passenger_tmpdir,
+ "server_instance_dir", passenger_tmpdir,
"generation_number", "0",
"analytics_log_dir", log_dir,
"analytics_log_user", CONFIG['normal_user_1'],
"analytics_log_group", CONFIG['normal_group_1'],
"analytics_log_permissions", "u=rwx,g=rwx,o=rwx",
"logging_agent_password", [password].pack("m"))
- socket_filename = "#{Utils.passenger_tmpdir}/generation-0/logging.socket"
+ socket_filename = "#{passenger_tmpdir}/generation-0/logging.socket"
eventually do
File.exist?(socket_filename)
end
Please sign in to comment.
Something went wrong with that request. Please try again.