Skip to content

Commit

Permalink
test runinng rojo serve and killing
Browse files Browse the repository at this point in the history
  • Loading branch information
afujiwara-roblox committed Oct 4, 2023
1 parent 499a7d8 commit 086b068
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,21 @@ jobs:
foreman --version
PATH=$PATH:~/.foreman/bin
./scripts/end-to-end-tests.sh
kill-process-test-unix:
strategy:
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
needs: build

steps:
- uses: actions/checkout@v2

- name: End-to-end tests
shell: bash
run: |
cargo install --path .
foreman --version
PATH=$PATH:~/.foreman/bin
./scripts/kill-process-test-unix.sh
48 changes: 48 additions & 0 deletions scripts/kill-process-test-unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
write_foreman_toml () {
echo "[tools]" > foreman.toml
echo "$2 = { $1 = \"$3\", version = \"=$4\" }" >> foreman.toml
}

create_rojo_files() {
echo "{
\"name\": \"test\",
\"tree\": {
\"\$path\": \"src\"
}
}" > default.project.json
}

setup_rojo() {
write_foreman_toml github rojo "rojo-rbx/rojo" "7.3.0"
cargo run --release -- install
create_rojo_files
}

delay_kill_process_and_check() {
sleep 5
echo "waiting 5 seconds before killing rojo"
ps -ef | grep "rojo serve" | grep -v grep | awk '{print $2}' | xargs kill -INT
check_killed_subprocess
}

run_rojo_serve_and_kill_process() {
setup_rojo
(rojo serve default.project.json) & (delay_kill_process_and_check)
}

check_killed_subprocess(){
if ps -ef | grep "rojo" | grep -v grep
then
echo "rojo subprocess was not killed properly"
rm foreman.toml
rm default.project.json
exit 1
else
echo "rojo subprocess was killed properly"
rm foreman.toml
rm default.project.json
exit 0
fi
}

run_rojo_serve_and_kill_process

0 comments on commit 086b068

Please sign in to comment.