Skip to content

Commit

Permalink
Fix Red Hat 7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Apr 30, 2015
1 parent e910426 commit 37166dd
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 10 deletions.
1 change: 1 addition & 0 deletions docker_images/testbox-centos-6/install.sh
Expand Up @@ -23,6 +23,7 @@ header "Installing dependencies"
run rpm -Uvh http://mirror.overthewire.com.au/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
run yum install -y --enablerepo centosplus centos-release-SCL
run yum install -y --enablerepo centosplus \
@development-tools \
python27-python nodejs010-nodejs nodejs010-npm \
ruby ruby-devel rubygems rubygem-rack rubygem-rake perl git tar which \
httpd httpd-devel httpd-tools zlib-devel sqlite-devel curl-devel \
Expand Down
3 changes: 2 additions & 1 deletion docker_images/testbox-centos-7/install.sh
Expand Up @@ -21,8 +21,9 @@ run adduser --uid 2467 --gid 2467 --password '#' app

header "Installing dependencies"
run yum install -y --enablerepo centosplus epel-release centos-release-SCL
run yum group install -y "Development Tools"
run yum install -y --enablerepo centosplus \
ruby ruby-devel rubygems rubygem-rack rubygem-rake nodejs \
ruby ruby-devel rubygems rubygem-rack rubygem-rake nodejs npm \
perl git tar which \
httpd httpd-devel httpd-tools zlib-devel sqlite-devel curl-devel \
GeoIP gd libxslt
Expand Down
4 changes: 2 additions & 2 deletions internal/build/Rakefile
Expand Up @@ -89,7 +89,7 @@ namespace :srpm do
raise e
end

task.sh "rpmbuild -bs --root ~/rpmbuild/root_passenger #{spec_target_file}"
task.sh "rpmbuild -bs --root ~/rpmbuild/root-passenger-#{distro_id} #{spec_target_file}"
ARCHITECTURES.each do |arch|
task.sh "mkdir -p /work/#{distro_id}-#{arch}"
task.sh "cp #{RPM_SRPMS_DIR}/#{passenger_srpm_name(distro_id)} /work/#{distro_id}-#{arch}/"
Expand Down Expand Up @@ -126,7 +126,7 @@ namespace :srpm do
raise e
end

task.sh "rpmbuild -bs --root ~/rpmbuild/root_nginx #{spec_target_file}"
task.sh "rpmbuild -bs --root ~/rpmbuild/root-nginx-#{distro_id} #{spec_target_file}"
ARCHITECTURES.each do |arch|
task.sh "mkdir -p /work/#{distro_id}-#{arch}"
task.sh "cp #{RPM_SRPMS_DIR}/#{nginx_srpm_name(distro_id)} /work/#{distro_id}-#{arch}/"
Expand Down
4 changes: 2 additions & 2 deletions internal/test/misc/config.json
@@ -1,9 +1,9 @@
{
"normal_user_1": "games",
"normal_user_2": "daemon",
"default_user": "gopher",
"default_user": "operator",
"normal_group_1": "daemon",
"normal_group_2": "gopher",
"normal_group_2": "operator",
"default_group": "games",

"nonexistant_user": "xxxxxxxxxxxxxxxxxxx",
Expand Down
7 changes: 7 additions & 0 deletions internal/test/misc/test_support.rb
Expand Up @@ -59,3 +59,10 @@ def eventually(deadline_duration = 10, check_interval = 0.05)
end
raise "Time limit exceeded"
end

def clear_bundler_env!
orig_env = Bundler.with_clean_env do
ENV.to_hash
end
ENV.replace(orig_env)
end
31 changes: 28 additions & 3 deletions internal/test/system_web_server_test.rb
Expand Up @@ -4,6 +4,8 @@

include FileUtils

clear_bundler_env!

def create_app_dir(source, startup_file, dir_name)
app_root = "/home/app/#{dir_name}"
rm_rf(app_root)
Expand All @@ -23,11 +25,34 @@ def create_app_dirs
app_dirs
end

def redhat_major_release
File.read("/etc/redhat-release") =~ /release ([0-9]+)/
$1.to_i
end

def start_stop_service(name, action)
if File.exist?("/sbin/service")
sh("service #{name} #{action}")
if redhat_major_release >= 7
if name == "httpd"
if action == "start"
sh(". /etc/sysconfig/httpd && /usr/sbin/httpd $OPTIONS")
elsif action == "stop"
sh("kill `cat /run/httpd/httpd.pid`")
else
raise "Don't know how to #{action} #{name}"
end
elsif name == "nginx"
if action == "start"
sh("/usr/sbin/nginx")
elsif action == "stop"
sh("kill -s QUIT `cat /run/nginx.pid`")
else
raise "Don't know how to #{action} #{name}"
end
else
raise "Don't know how to #{action} #{name}"
end
else
sh("systemctl #{action} #{name}.service")
sh("service #{name} #{action}")
end
end

Expand Down
6 changes: 4 additions & 2 deletions internal/test/test.sh
Expand Up @@ -55,8 +55,10 @@ else
run chmod 644 /etc/httpd/conf.d/apache-pre-24.conf
fi
run setuser app chmod 755 /home/app
run setuser app mkdir -p /cache/test/bundle
run setuser app rake test:install_deps DOCTOOLS=no DEPS_TARGET=/cache/test/bundle BUNDLE_ARGS="-j 4"
run setuser app mkdir -p /cache/test-$DISTRIBUTION/bundle
run setuser app mkdir -p /cache/test-$DISTRIBUTION/node_modules
run setuser app ln -s /cache/test-$DISTRIBUTION/node_modules node_modules
run setuser app rake test:install_deps DOCTOOLS=no DEPS_TARGET=/cache/test-$DISTRIBUTION/bundle BUNDLE_ARGS="-j 4"
run setuser app cp /system/internal/test/misc/config.json test/config.json
find /var/{log,lib}/nginx -type d | xargs --no-run-if-empty chmod o+rwx
find /var/{log,lib}/nginx -type f | xargs --no-run-if-empty chmod o+rw
Expand Down

0 comments on commit 37166dd

Please sign in to comment.