Skip to content
This repository

Simple fix for running specs as root. #2061

Merged
merged 1 commit into from over 1 year ago

3 participants

Diego Elio Pettenò Don't Add Me To Your Organization a.k.a The Travis Bot André Arko
Diego Elio Pettenò

This test would fail on default Gentoo installs as the package is
executed as root.

Diego Elio Pettenò spec: do not check for /usr/bin not to be writable when running as root.
This test would fail on default Gentoo installs as the package is
executed as root.
433b4bc
Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request fails (merged 433b4bc into 3a1121a).

Diego Elio Pettenò

Uhm I think travisbot is wrong, given that error reported is:

Error: #<NativeException: org.virtualbox_4_1.VBoxException: The function "powerDown" returned an error condition: "The virtual machine is being powered down"  (0x80bb0002)>
André Arko
Owner

Um... the tests also fail if they are run outside a git repo. Does gentoo run the package tests from inside a git repo?

Diego Elio Pettenò

We have workarounds for those — I didn't want to submit those just yet, but this one seems to be valid anyway: it's just avoiding a non-writeable check, that would then always fail, when running as root.

André Arko
Owner

Is the "fix" to just disable all tests that depend on being inside a git repo when the tests run? Either way, I'd be interested in a pull with those changes. A subset of the tests that pass would be an improvement over tests that can't pass from inside an installed gem.

As for this test, it seems okay. I personally would be terrified of running any test suite as root, though. :P

André Arko indirect merged commit d97ada4 into from August 15, 2012
André Arko indirect closed this August 15, 2012
Diego Elio Pettenò

Not really a fix, yes I think it's disabling quite a few of the git tests, and I agree, a subset passing is better than not being able to run them. I'll try to put them in shape to be merged (right now they are unconditional).

As for running as root, we're moving toward a default of not doing so but.. a number of packages actually expect root :( Luckily we use a pre-loaded library to sandbox the execution, so it's "safe enough".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 13, 2012
Diego Elio Pettenò spec: do not check for /usr/bin not to be writable when running as root.
This test would fail on default Gentoo installs as the package is
executed as root.
433b4bc
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  spec/install/gems/simple_case_spec.rb
2  spec/install/gems/simple_case_spec.rb
@@ -796,7 +796,7 @@ def set_bundle_path(type, location)
796 796
     # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
797 797
     # you want to avoid sudo installs for system gems with OS X's default ruby
798 798
     it "overrides Gem.bindir" do
799  
-      Pathname.new("/usr/bin").should_not be_writable
  799
+      Pathname.new("/usr/bin").should_not be_writable unless Process::euid == 0
800 800
       gemfile <<-G
801 801
         require 'rubygems'
802 802
         def Gem.bindir; "/usr/bin"; end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.