From f95728213fc219abb4fe350f2b40e1084159c230 Mon Sep 17 00:00:00 2001 From: ahmedgamalyousef Date: Sat, 4 Oct 2025 22:36:26 +0300 Subject: [PATCH] Updating Scripts and CI Workflow --- .github/workflows/ci.yml | 2 +- fruit_api.log | 1 + log_monitor.sh | 4 ++-- test_results.log | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebb938d..4a7ea9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Run API in background run: | - nohup python fruit_api.py & + python fruit_api.py & sleep 5 - name: Run API tests diff --git a/fruit_api.log b/fruit_api.log index 9379eb9..97e58d1 100644 --- a/fruit_api.log +++ b/fruit_api.log @@ -337,3 +337,4 @@ 2025-09-30 23:59:59 - METHOD:GET - ENDPOINT:/fruits - STATUS:400 - ERROR: db not connected 2025-10-01 00:15:00 - METHOD:GET - ENDPOINT:/fruits - STATUS:500 - ERROR: db not connected 2025-10-01 00:15:00 - METHOD:GET - ENDPOINT:/fruits - STATUS:500 - ERROR: db not connected +2025-10-01 00:15:00 - METHOD:GET - ENDPOINT:/fruits - STATUS:500 - ERROR: db not connected diff --git a/log_monitor.sh b/log_monitor.sh index c55732c..8f8b955 100755 --- a/log_monitor.sh +++ b/log_monitor.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash LOG_FILE="fruit_api.log" -# ALERT_URL="https://gahymah.systems.com" +ALERT_URL=" " # Here Any Endpoint tail -Fn0 "$LOG_FILE" | while read line; do if echo "$line" | grep -qiE "STATUS:(4[0-9]{2}|5[0-9]{2})|failed|timeout|error|exception"; then @@ -15,7 +15,7 @@ tail -Fn0 "$LOG_FILE" | while read line; do { "error": "$line", "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", - "message": "Error detected in Fruit API logs", + "message": "Error detected in Ahmed Gamal's Fruit API logs", "server_metrics": { "ip": "$IP", "cpu_usage": "$CPU", diff --git a/test_results.log b/test_results.log index 260272f..5bd3844 100644 --- a/test_results.log +++ b/test_results.log @@ -796,3 +796,7 @@ Status: 200 ✅ Status: 200 ✅ Status: 200 ✅ Status: 201 +✅ Status: 200 +✅ Status: 200 +✅ Status: 200 +✅ Status: 201