byteayan commented on code in PR #3352:
URL: https://github.com/apache/hugegraph/pull/3352#discussion_r4280022856
##########
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:
Right, the graph conf already has `backend=hstore` by then, so that `cmp`
could never fail. Changed it to `HG_SERVER_BACKEND=rocksdb` in 7a207d469. I
reran your mutant (flag check moved to just before the `server.urls_to_pd`
mapping): it now fails on `hugegraph.properties ... differ: char 9, line 1`,
and the unmodified head passes.
--
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]