Sha256: 5d340a8d8a8a38e67de30e6a1b912181d4961940255d44162d905f9120a1b5bb

Contents?: true

Size: 1.84 KB

Versions: 27

Compression:

Stored size: 1.84 KB

Contents

require 'test/unit'
ENV['NEWRELIC_GEM_PATH'] = '../../../../../ruby_agent'

class MultiverseTest < Test::Unit::TestCase
  RUNNER = File.expand_path(File.join(
    File.dirname(__FILE__), '..', 'script', 'runner'))
  TEST_SUITE_EXAMPLES_ROOT = File.expand_path(File.join(
    File.dirname(__FILE__), 'suite_examples'))

  # encapsulates state from a example test suite run
  class SuiteRun
    def initialize
      @output = ''
    end
    attr_accessor :output, :exit_status
  end

  def suite_directory_for(name)
    File.join(TEST_SUITE_EXAMPLES_ROOT, name.to_s)
  end

  def run_suite(suite)
    ENV['SUITES_DIRECTORY'] = suite_directory_for(suite)
    ENV['NEWRELIC_GEM_PATH'] = '../../../../../../..'
    cmd = RUNNER
    suite_run = SuiteRun.new
    IO.popen(cmd) do |io|
      while line = io.gets
        suite_run.output << line
        # print line # uncomment for debugging rake test:self
      end
    end
    suite_run.exit_status = $?
    suite_run
  end

  def test_suite_environments_are_isolated_from_each_other
    run = run_suite('one')
    assert_equal 0, run.exit_status, "Test suite should demonstrate that " <<
                                     "gems loaded in for one suite don't " <<
                                     "persist in the next suite\n"# + run.output
  end

  def test_failed_tests_mean_unsuccessful_exit_code_in_parent_with_fork_execute_mode
    run = run_suite('two')
    assert_not_equal 0, run.exit_status, "Failed test should mean unsucessful " <<
                                         "exit status in parent \n" # + run.output
  end

  def test_failed_tests_mean_unsucessful_exit_code_in_parent_with_spawn_execute_mode
    run = run_suite('three')
    assert_not_equal 0, run.exit_status, "Failed test in spawn mode should mean unsucessful " <<
                                         "exit status in parent \n" # + run.output
  end
end

Version data entries

27 entries across 27 versions & 4 rubygems

Version Path
wd_newrelic_rpm-3.5.8 test/multiverse/test/multiverse_test.rb
sundawg_newrelic_rpm-3.5.8.2 test/multiverse/test/multiverse_test.rb
sundawg_newrelic_rpm-3.5.8.1 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.8.72 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.8.70 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.8.64.beta test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.7.59 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.7.59.beta test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.7.58.beta test/multiverse/test/multiverse_test.rb
wd_newrelic_rpm-3.5.6 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.7.57.beta test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.6.55 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.6.48.beta test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.6.46.beta test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.6.42.beta test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.5.39.beta test/multiverse/test/multiverse_test.rb
wd_newrelic_rpm-3.5.5 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.5.38 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.5.540.dev test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.5.4.35.beta test/multiverse/test/multiverse_test.rb