Skip to content

Commit

Permalink
Use pushd and popd for ci/tests.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Rosiek committed Oct 12, 2020
1 parent 3eedbec commit a02e5da
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ci/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ function test_fluentd_plugin() {
local version="${2}"
# Strip everything after "-" (longest match) to avoid gem prerelease behavior
local gem_version="${version%%-*}"
local result

cd "${plugin_name}" || exit 1
pushd "${plugin_name}" || exit 1

if [[ -z "${version}" ]] ; then
echo "Please provide the version when bundling fluentd plugins"
Expand All @@ -28,7 +29,13 @@ function test_fluentd_plugin() {
bundle install

echo "Run unit tests..."
bundle exec rake || exit 1
bundle exec rake

readonly result=$?
popd || exit 1
if [ "${result}" -eq "0" ]; then
exit 1
fi
}

function test_fluentd_plugins() {
Expand All @@ -42,7 +49,7 @@ function test_fluentd_plugins() {
find . -maxdepth 1 -name 'fluent-plugin-*' -type 'd' -print |
while read -r line; do
# Run tests in their own context
(test_fluentd_plugin "$(basename "${line}")" "${version}") || exit 1
test_fluentd_plugin "$(basename "${line}")" "${version}" || exit 1
done
}

Expand Down

0 comments on commit a02e5da

Please sign in to comment.