From 3bcffeae1575222753f6b67bce364f883a4737c9 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Sat, 16 Feb 2019 12:16:02 -0800 Subject: [PATCH] tests: Disable tests that require being non-root Set the environment variable USER=root which is required by brew tests --only=utils/user Fix these tests: rspec ./test/diagnostic_checks_spec.rb:26 # Homebrew::Diagnostic::Checks #check_access_directories rspec ./test/pathname_spec.rb:120 # Pathname#ensure_writable makes a file writable and restores permissions rspec ./test/utils/user_spec.rb:22 # User#gui? when the current user is in a console session gui? should equal true rspec ./test/utils/user_spec.rb:6 # User should eq nil --- Dockerfile.test.yml | 2 +- Library/Homebrew/test/diagnostic_checks_spec.rb | 1 + Library/Homebrew/test/pathname_spec.rb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.test.yml b/Dockerfile.test.yml index 79e6e7caa3..4b930db2c6 100644 --- a/Dockerfile.test.yml +++ b/Dockerfile.test.yml @@ -1,3 +1,3 @@ sut: build: . - command: brew test-bot + command: env USER=root brew test-bot diff --git a/Library/Homebrew/test/diagnostic_checks_spec.rb b/Library/Homebrew/test/diagnostic_checks_spec.rb index 3f1dbcd44a..76ce1222db 100644 --- a/Library/Homebrew/test/diagnostic_checks_spec.rb +++ b/Library/Homebrew/test/diagnostic_checks_spec.rb @@ -24,6 +24,7 @@ describe Homebrew::Diagnostic::Checks do end specify "#check_access_directories" do + skip "User is root so everything is writable." if Process.euid.zero? begin dirs = [ HOMEBREW_CACHE, diff --git a/Library/Homebrew/test/pathname_spec.rb b/Library/Homebrew/test/pathname_spec.rb index 5f846fde13..e1c6645bf9 100644 --- a/Library/Homebrew/test/pathname_spec.rb +++ b/Library/Homebrew/test/pathname_spec.rb @@ -118,6 +118,7 @@ describe Pathname do describe "#ensure_writable" do it "makes a file writable and restores permissions afterwards" do + skip "User is root so everything is writable." if Process.euid.zero? touch file chmod 0555, file expect(file).not_to be_writable