Sha256: 15e4c696d0b028b427ceb6723aac98e03529a0e11a3cf279ff649f175fb52228

Contents?: true

Size: 1.99 KB

Versions: 45

Compression:

Stored size: 1.99 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

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')
    refute_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')
    refute_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

45 entries across 45 versions & 2 rubygems

Version Path
newrelic_rpm-4.1.0.333 test/multiverse/test/multiverse_test.rb
newrelic_rpm-4.0.0.332 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.18.1.330 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.18.0.329 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.17.2.327 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.17.1.326 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.17.0.325 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.16.3.323 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.16.2.321 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.16.1.320 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.16.0.318 test/multiverse/test/multiverse_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.15.2.317 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.15.1.316 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.15.0.314 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.14.3.313 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.14.2.312 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.14.1.311 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.14.0.305 test/multiverse/test/multiverse_test.rb
newrelic_rpm-3.13.2.302 test/multiverse/test/multiverse_test.rb