summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaymala Sinha <jsinha@chef.io>2019-07-24 12:54:08 -0400
committerJaymala Sinha <jsinha@chef.io>2019-07-26 12:09:51 -0400
commitd1bdc99d00039e1cf693dde45861611ced93b538 (patch)
treead566286342a0a36fefd92705175481669bc37f7
parent06e1fc76fc28fa85b1c3bbd763f0ee571d528874 (diff)
downloadchef-jsinha/fix_ec2_sles.tar.gz
Fix zypper test failuresjsinha/fix_ec2_sles
Resolve error from kill for leftover rspec processes Cloud testers have as many as 10 zypper repos configured and enabled, so the zypper searches from specs take longer to run on our testers as too many repos with most of them enabled were slowing down the zypper process, locking it during the test runs and failing the zypper package functional tests. Since we do not use these repos in our testing we delete them. Signed-off-by: Jaymala Sinha <jsinha@chef.io>
-rw-r--r--omnibus/omnibus-test.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/omnibus/omnibus-test.sh b/omnibus/omnibus-test.sh
index 068dac1a13..2c03787add 100644
--- a/omnibus/omnibus-test.sh
+++ b/omnibus/omnibus-test.sh
@@ -49,7 +49,7 @@ sudo rm -rf "$TMPDIR"
mkdir -p "$TMPDIR"
# Verify that we kill any orphaned test processes. Kill any orphaned rspec processes.
-ps ax | grep -E 'rspec' | grep -v grep | awk '{ print $1 }' | xargs sudo kill -s KILL || true
+sudo kill -9 $(ps ax | grep 'rspec' | grep -v grep | awk '{ print $1 }') || true
PATH="/opt/$product/bin:$PATH"
export PATH
@@ -152,6 +152,18 @@ elif [[ -d /usr/local/etc/sudoers.d ]]; then
sudo chmod 440 "/usr/local/etc/sudoers.d/$(id -un)-preserve_path"
fi
+# Remove the ec2 cloud zypper repos before running functional tests
+if [[ ! $(grep s390 /etc/SuSE-release) ]] > /dev/null 2>&1; then # Don't delete repos on s390x
+ if [[ $(grep -i suse /etc/SuSE-release /etc/os-release) ]] > /dev/null 2>&1; then
+ echo "Removing zypper repos for Amazon SLES nodes"
+ sleep 5 # Allow some time for repo setup to complete
+ for i in $(zypper lr |grep -v "Alias" |awk -F "|" '{print $2}'); do
+ sudo zypper rr $i
+ done
+ sudo rm /usr/lib/zypp/plugins/services/* || true
+ fi
+fi
+
cd "$chef_gem"
sudo -E bundle install
sudo -E bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f documentation spec/functional