bitflicker64 commented on code in PR #3105:
URL: https://github.com/apache/hugegraph/pull/3105#discussion_r3675454508
##########
hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh:
##########
@@ -286,26 +311,37 @@ download_and_verify() {
local url=$1
local filepath=$2
local expected_md5=$3
+ local actual_md5
- if [[ -f $filepath ]]; then
+ if [[ -f "$filepath" ]]; then
echo "File $filepath exists. Verifying MD5 checksum..."
- actual_md5=$(md5sum $filepath | awk '{ print $1 }')
- if [[ $actual_md5 != $expected_md5 ]]; then
+ actual_md5=$(md5sum -- "$filepath" | awk '{ print $1 }')
+ if [[ "$actual_md5" != "$expected_md5" ]]; then
echo "MD5 checksum verification failed for $filepath. Expected:
$expected_md5, but got: $actual_md5"
echo "Deleting $filepath..."
- rm -f $filepath
+ rm -f -- "$filepath"
Review Comment:
Addressed in `8b4e01ae`. A checksum mismatch no longer removes the shared
destination; every caller downloads to its own adjacent `mktemp`, verifies that
file, and only then publishes with `mv -f`. The coordinated two-caller
regression holds a stale checksum until another caller installs valid bytes,
forces the stale caller's download to fail, and asserts the valid destination
survives with no temp files. Successful callers publish the same expected
checksum, so this contract does not require a new lock dependency.
##########
.github/workflows/docker-build-ci.yml:
##########
@@ -47,6 +47,28 @@ jobs:
run: |
IMAGE_ID=$(docker build -q -f ${{ matrix.dockerfile }} .)
echo "Built: $IMAGE_ID"
+ echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_ENV"
HC=$(docker inspect --format='{{json .Config.Healthcheck}}'
"$IMAGE_ID")
echo "Healthcheck: $HC"
[[ "$HC" != "null" ]] || { echo "ERROR: HEALTHCHECK missing in ${{
matrix.dockerfile }}"; exit 1; }
+
+ # The startup preflight needs a socket-table tool, and the base image
+ # ships none of its own. Without one every start reports "unknown" and
+ # a duplicate start is no longer refused, so assert the image can
+ # actually answer. Only the server images run check_port.
+ # TODO(docker-ci): this pins the probe dependency, not the behaviour it
+ # protects. A full duplicate-start/stop check needs a booted server with
+ # a backend, which belongs with the e2e job rather than the image build.
+ - name: Port preflight can answer inside ${{ matrix.dockerfile }}
Review Comment:
Addressed in `8b4e01ae`. `pull_request.paths` now includes the exact probed
file: `hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh`. The
workflow parses successfully and the structural path assertion passes; this
push has also triggered Docker Build CI.
##########
hugegraph-server/hugegraph-dist/src/assembly/travis/test-check-port.sh:
##########
@@ -0,0 +1,395 @@
+#!/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.
+#
+
+# Contract tests for the startup port preflight in bin/util.sh.
+#
+# The preflight is best effort: the server's own bind is authoritative. These
+# tests pin the three-state contract (busy / free / unknown) rather than the
+# internals of any one probe.
+#
+# TODO(test-check-port): the Linux and BSD detection branches are both driven
+# by mocked tool output, so on any one runner only the host's own branch is
+# ever exercised against a real kernel. The single real-listener case covers
+# whichever OS the job runs on. Closing this needs the suite to run on both
+# a Linux and a macOS runner, which CI already does for the server job.
+
+set -u
+
+STATIC_DIR="${1:-hugegraph-server/hugegraph-dist/src/assembly/static}"
+UTIL_SH="$STATIC_DIR/bin/util.sh"
+
+if [[ ! -f "$UTIL_SH" ]]; then
+ echo "SKIP: util.sh not found at $UTIL_SH"
+ exit 0
Review Comment:
Addressed in `8b4e01ae`. An explicitly supplied missing server utility now
prints `ERROR` and exits 1; an explicitly supplied missing Store utility does
the same. Only no-argument discovery may skip. Both Linux and macOS workflow
calls now pass the exact server and Store utility paths, and both negative
invocations were verified locally.
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh:
##########
@@ -185,16 +366,31 @@ function wait_for_startup() {
return 1
fi
- status=$(curl -I -sS -k -w "%{http_code}" -o /dev/null "$server_url"
2> "$error_file_name")
- if [[ $status -eq 200 || $status -eq 401 ]]; then
+ # Bound each probe by the time left in the overall deadline: without
+ # --max-time a single blackholed request blocks past ${timeout_s}s.
+ local remain_s=$((stop_s - now_s))
+ [ "$remain_s" -lt 1 ] && remain_s=1
Review Comment:
Addressed in `8b4e01ae`. `wait_for_startup` now uses an exclusive loop
boundary, refreshes the clock immediately before curl, and stops when `remain_s
<= 0` instead of granting a new one-second budget. The file-backed clock
regression lands exactly on the deadline and asserts that curl receives zero
calls. Current focused suite: 60/60 on macOS Bash 3.2.
--
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]