-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial files * basic app is alive test * better file structure * adjust wait * fix wait script * actually fix wait script * delete running on push on feature branch after testing on Actions * updated ubungu version * busy wait scripts for both pods and backend * properly added busy wait scripts for both pods and backend * made sure files can be found * bash to sh * make it run * was i just missing a slash this entire time? * increase timeout on ui test * changed check * stop opik server step and empty line * fixed stop step * all good, removed on push event --------- Co-authored-by: Andrei Căutișanu <[email protected]> Co-authored-by: Andrei Căutișanu <[email protected]> Co-authored-by: Liya Katz <[email protected]>
- Loading branch information
1 parent
817419d
commit 1cb7756
Showing
5 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Install Local Version of Opik | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test_installation: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install Opik | ||
run: pip install ${{ github.workspace }}/sdks/python | ||
|
||
- name: Install Test Dependencies | ||
run: | | ||
pip install -r ${{ github.workspace }}/tests_end_to_end/test_requirements.txt | ||
playwright install | ||
- name: Install Opik | ||
run: | | ||
cd ${{ github.workspace }}/deployment/docker-compose | ||
docker compose up --detach | ||
- name: Check Docker pods are up | ||
run: | | ||
chmod +x ./tests_end_to_end/installer/check_docker_compose_pods.sh | ||
./tests_end_to_end/installer/check_docker_compose_pods.sh | ||
shell: bash | ||
|
||
- name: Check backend health | ||
run: | | ||
chmod +x ./tests_end_to_end/installer/check_backend.sh | ||
./tests_end_to_end/installer/check_backend.sh | ||
shell: bash | ||
|
||
- name: Check app is up via the UI | ||
run: | | ||
pytest -v -s ${{ github.workspace }}/tests_end_to_end/installer/test_app_status.py | ||
- name: Stop Opik server | ||
if: always() | ||
run: | | ||
cd ${{ github.workspace }}/deployment/docker-compose | ||
docker compose down | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
max_retries=12 | ||
wait_interval=5 | ||
retries=0 | ||
|
||
url="http://localhost:5173/api/health-check?name=all&type=ready" | ||
|
||
while (( retries < max_retries )) | ||
do | ||
response=$(curl -s -o /dev/null -w "%{http_code}" $url) | ||
if [[ $response -eq 200 ]]; then | ||
echo "Backend is up and healthy!" | ||
exit 0 | ||
else | ||
echo "Waiting for backend to be ready... (Attempt: $((retries+1))/$max_retries, Status Code: $response)" | ||
sleep $wait_interval | ||
retries=$((retries+1)) | ||
fi | ||
done | ||
|
||
echo "Error: Backend did not respond with 200 OK after $((max_retries * wait_interval)) seconds." | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
cd deployment/docker-compose | ||
max_retries=5 | ||
wait_interval=3 | ||
retries=0 | ||
|
||
while [[ $retries -lt $max_retries ]] | ||
do | ||
containers=$(docker compose ps --status running -q) | ||
if [ -z "$containers" ]; then | ||
echo "Waiting for containers to be up... (Attempt: $((retries+1))/$max_retries)" | ||
sleep $wait_interval | ||
retries=$((retries+1)) | ||
else | ||
echo "Containers running" | ||
docker compose ps | ||
break | ||
fi | ||
done | ||
|
||
if [[ $retries -eq $max_retries ]]; then | ||
echo "Containers failed to start" | ||
docker compose ps | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from playwright.sync_api import Page, expect | ||
|
||
def test_app_loads(page: Page): | ||
page.goto("http://localhost:5173/default/projects") | ||
expect(page.get_by_role("heading", name="Projects")).to_be_visible() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest | ||
playwright | ||
pytest-playwright |