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


##########
hugegraph-server/hugegraph-dist/docker/docker-entrypoint-test.sh:
##########
@@ -388,5 +388,58 @@ done
     HG_SERVER_AUTH_TOKEN_SECRET="${fake_key}" bash ./docker-entrypoint.sh)
 [[ "$(cat "${TEST_HOME}/docker/init-store-locale")" == 'en_US.UTF-8' ]]
 
+# Unset discovery variables leave the shipped defaults alone.
+if grep -qE '^server\.(urls_to_pd|deploy_in_k8s)' \
+    "${TEST_HOME}/conf/rest-server.properties"; then
+    echo "unset discovery variables wrote server.* keys" >&2
+    exit 1
+fi
+
+(
+    cd "${TEST_HOME}"
+    HG_SERVER_URLS_TO_PD=' http://server-0:8080, http://server-1:8080 ' \
+    HG_SERVER_DEPLOY_IN_K8S=' TRUE ' \
+        bash ./docker-entrypoint.sh
+)
+grep -qx 'server.urls_to_pd=http://server-0:8080,http://server-1:8080' \
+    "${TEST_HOME}/conf/rest-server.properties"
+grep -qx 'server.deploy_in_k8s=true' "${TEST_HOME}/conf/rest-server.properties"
+
+# A restart with new values replaces each key instead of appending another.
+(
+    cd "${TEST_HOME}"
+    HG_SERVER_URLS_TO_PD=http://server-2:8080 \
+    HG_SERVER_DEPLOY_IN_K8S=off \
+        bash ./docker-entrypoint.sh
+)
+[[ "$(grep -c '^server\.urls_to_pd' 
"${TEST_HOME}/conf/rest-server.properties")" -eq 1 ]]
+[[ "$(grep -c '^server\.deploy_in_k8s' 
"${TEST_HOME}/conf/rest-server.properties")" -eq 1 ]]
+grep -qx 'server.urls_to_pd=http://server-2:8080' \
+    "${TEST_HOME}/conf/rest-server.properties"
+grep -qx 'server.deploy_in_k8s=off' "${TEST_HOME}/conf/rest-server.properties"
+
+# HugeConfig rejects 0 and 1 for a boolean, so the entrypoint refuses them
+# before writing either conf file, the URL list included.
+cp "${TEST_HOME}/conf/rest-server.properties" \
+    "${TEST_HOME}/conf/rest-server.properties.before-k8s-flag"
+cp "${TEST_HOME}/conf/graphs/hugegraph.properties" \
+    "${TEST_HOME}/conf/graphs/hugegraph.properties.before-k8s-flag"
+for invalid_k8s_flag in 1 0 enabled; do
+    if (
+        cd "${TEST_HOME}"
+        HG_SERVER_BACKEND=hstore \

Review Comment:
   Minor: this `HG_SERVER_BACKEND=hstore` cannot show that 
`hugegraph.properties` was left alone. Lines 96-107 already wrote 
`backend=hstore` into that file, and nothing after them changes it, so if the 
backend mapping did run before the flag check it would write the same value and 
the `cmp` on line 440 would still pass. I checked this by moving the 
`HG_SERVER_DEPLOY_IN_K8S` check to just before the `server.urls_to_pd` mapping 
(after the `backend` and `pd.peers` writes) and running the suite on Linux: it 
still exits 0. With `HG_SERVER_BACKEND=rocksdb` here, the unmodified head still 
passes and that mutant fails with `hugegraph.properties.before-k8s-flag ... 
differ: byte 9, line 1`. Could you use a value that differs from the file's 
current backend, for example `rocksdb`?



-- 
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