Skip to content

Commit

Permalink
Run kill_uaa as part of integrationTests
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Gangwal <prateek.gangwal@broadcom.com>
  • Loading branch information
duanemay authored and coolgang123 committed Jun 24, 2024
1 parent 86c583a commit 53299c0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
34 changes: 28 additions & 6 deletions scripts/kill_uaa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,43 @@ find_jps_command() {
}

function main() {
local pid
local jps_command
local kill_count=5
jps_command=$(find_jps_command)

while $jps_command | grep Bootstrap; do
$jps_command | grep Bootstrap | cut -f 1 -d' ' | xargs kill -HUP
echo "Waiting for Bootstrap to finish"
pid=$($jps_command -vlm | grep Bootstrap | grep uaa | cut -f 1 -d' ')
if [ -z "$pid" ]; then
echo "No UAA process found"
exit 0
fi

echo Currently running UAA processes:
$jps_command -vlm | egrep "^${pid} "
echo
echo -n "Attempting to kill UAA process with PID=$pid: "

while [ "$kill_count" -ge "0" ]; do
if ! $jps_command | egrep "^${pid} " > /dev/null; then
break
fi
echo -n .
kill -HUP "${pid}" || true
sleep 1
kill_count=$((kill_count - 1))
done

$jps_command | grep Bootstrap
if $jps_command | egrep "^${pid} " > /dev/null; then
echo -n " Forcibly killing: "
kill -9 "${pid}" || true
fi

$jps_command | egrep "^${pid} "
if [ $? -eq 0 ]; then
echo "Bootstrap is still running"
echo " Bootstrap is still running"
exit 1
else
echo "Bootstrap has finished"
echo " Bootstrap has finished"
exit 0
fi
}
Expand Down
8 changes: 8 additions & 0 deletions uaa/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,15 @@ generateDocs {
dependsOn(slate)
}

//task declarations
tasks.register('killUaa', Exec) {
workingDir '../'
executable = 'scripts/kill_uaa.sh'
}

integrationTest {
dependsOn killUaa

filter {
includeTestsMatching("org.cloudfoundry.identity.uaa.integration.*")
includeTestsMatching("*IT")
Expand Down

0 comments on commit 53299c0

Please sign in to comment.