summary refs log tree commit
diff options
context:
space:
mode:
authorFelix Bùˆnemann <buenemann@louis.info>2019-09-09 21:11:21 +0200
committerFelix Bùˆnemann <buenemann@louis.info>2019-09-09 21:11:21 +0200
commita0ae289a8961837906a7091ffa0cfdbf3d7d7303 (patch)
tree314b59ab5e2acd58b8a17dab995edea7e164fcaa
parente44c6873ce21de9a6d4aac70b9a684e07aa11d4d (diff)
downloadrack-a0ae289a8961837906a7091ffa0cfdbf3d7d7303.tar.gz
Skip server spec that can't work in Docker
This skips the server spec for the :not_owned pid file status, if PID 1
is owned by the same user as the current process, which is usually true
if the specs are run as root or in a Docker / LXC container.

This should fix the failing specs on Circle CI.
-rw-r--r--test/spec_server.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/spec_server.rb b/test/spec_server.rb
index 7a60a61e..3ec88f16 100644
--- a/test/spec_server.rb
+++ b/test/spec_server.rb
@@ -161,6 +161,8 @@ describe Rack::Server do
   end
 
   it "check pid file presence and not owned process" do
+    owns_pid_1 = (Process.kill(0, 1) rescue nil) == 1
+    skip "cannot test if pid 1 owner matches current process (eg. docker/lxc)" if owns_pid_1
     pidfile = Tempfile.open('pidfile') { |f| f.write(1); break f }.path
     server = Rack::Server.new(pid: pidfile)
     server.send(:pidfile_process_status).must_equal :not_owned