bitflicker64 commented on code in PR #3044:
URL: https://github.com/apache/hugegraph/pull/3044#discussion_r3332214447


##########
hugegraph-server/hugegraph-dist/src/assembly/travis/test-start-hugegraph.sh:
##########
@@ -0,0 +1,430 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# test-start-hugegraph.sh — Tests for start-hugegraph.sh foreground mode fix
+#
+# Baseline (unmodified code):  Tests 1, 2, 4 PASS — Tests 3, 5 FAIL
+# After chunk 1 fix:           All 5 tests PASS
+#
+# Usage: ./test-start-hugegraph.sh [path-to-hugegraph-root]
+#   path-to-hugegraph-root: path to the extracted HugeGraph server dist 
directory
+#                           defaults to current directory if not provided
+#
+# Note: Tests require crontab access. On macOS Catalina+ this may
+#       require Full Disk Access permission in System Preferences.
+# Note: Assumes rocksdb backend. init-store.sh is run automatically if needed.
+
+set -uo pipefail
+
+HUGEGRAPH_ROOT="${1:-$(pwd)}"
+BIN="$HUGEGRAPH_ROOT/bin"
+START_SCRIPT="$BIN/start-hugegraph.sh"
+STOP_SCRIPT="$BIN/stop-hugegraph.sh"
+PID_FILE="$BIN/pid"
+SERVER_URL="http://127.0.0.1:8080";
+STARTUP_WAIT=60   # seconds to wait for server HTTP to respond
+SETTLE_WAIT=5     # seconds after kill before checking process exit
+WAIT_TIMEOUT=30   # seconds for timeout on wait calls
+PASS=0
+FAIL=0
+ERRORS=()
+
+GREEN='\033[0;32m'
+RED='\033[0;31m'
+YELLOW='\033[1;33m'
+NC='\033[0m'
+
+pass() {
+    echo -e "${GREEN}  PASS${NC} $1"
+    PASS=$((PASS + 1))
+}
+
+fail() {
+    echo -e "${RED}  FAIL${NC} $1"
+    ERRORS+=("$1")
+    FAIL=$((FAIL + 1))
+}
+
+info() {
+    echo -e "${YELLOW}  ....${NC} $1"
+}
+
+section() {
+    echo ""
+    echo "── $1 ──"
+}
+
+# Kill server, clear pid file, kill ports, clear crontab monitor entry
+cleanup() {
+    info "Cleaning up..."
+    "$STOP_SCRIPT" >/dev/null 2>&1 || true
+    if [[ -s "$PID_FILE" ]]; then
+        kill "$(cat "$PID_FILE")" 2>/dev/null || true
+    fi
+    rm -f "$PID_FILE"
+    # kill anything still holding server ports so check_port doesn't fail next 
test
+    lsof -ti :8080 | xargs kill -9 2>/dev/null || true

Review Comment:
   Added preflight check for all required external tools (lsof, crontab, curl, 
java) .suite exits with a clear SKIP message if any are missing rather than 
failing mid test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to