Sha256: cffa1423588ecba286c4bdf276980f4274042d0491aadc04a234d6ccad50efdb

Contents?: true

Size: 673 Bytes

Versions: 13

Compression:

Stored size: 673 Bytes

Contents

module SystemHelpers
  def recognize_as_heroku
    ENV['DYNO'] = 'dyno1'
    value = recognize_as_container :lxc do
      yield
    end
    ENV.delete 'DYNO'
    value
  end

  def recognize_as_container(file)
    org_cgroup_file = Appsignal::System::Container::CGROUP_FILE
    Appsignal::System::Container.send :remove_const, :CGROUP_FILE
    Appsignal::System::Container.send :const_set, :CGROUP_FILE,
      File.join(DirectoryHelper.fixtures_dir, 'containers', 'cgroups', file.to_s)

    value = yield

    Appsignal::System::Container.send :remove_const, :CGROUP_FILE
    Appsignal::System::Container.send :const_set, :CGROUP_FILE, org_cgroup_file

    value
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
appsignal-2.0.6 spec/support/helpers/system_helpers.rb
appsignal-2.0.5 spec/support/helpers/system_helpers.rb
appsignal-2.0.5.beta.1 spec/support/helpers/system_helpers.rb
appsignal-2.1.0.alpha.3 spec/support/helpers/system_helpers.rb
appsignal-2.1.0.alpha.2 spec/support/helpers/system_helpers.rb
appsignal-2.1.0.alpha.1 spec/support/helpers/system_helpers.rb
appsignal-2.0.4 spec/support/helpers/system_helpers.rb
appsignal-2.0.3 spec/support/helpers/system_helpers.rb
appsignal-2.0.2 spec/support/helpers/system_helpers.rb
appsignal-2.0.1 spec/support/helpers/system_helpers.rb
appsignal-2.0.0 spec/support/helpers/system_helpers.rb
appsignal-2.0.0.beta.1 spec/support/helpers/system_helpers.rb
appsignal-1.4.0.beta.1 spec/support/helpers/system_helpers.rb