From 08f302c5c4e1c37fc11ee8692accf254b4e1e63a Mon Sep 17 00:00:00 2001 From: kennywillbe <121614133+kennywillbe@users.noreply.github.com> Date: Mon, 31 Aug 2026 18:14:46 +0300 Subject: [PATCH] point the init section's config at the run's own OpenSearch The generated config kept init's default target url, so validate in an isolated run health-checked the dev stack instead of the run's container and passed or failed with a stack the run does not own. The default is now asserted and then rewritten to $OS, the edit an operator makes first. --- dev/e2e-test.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dev/e2e-test.sh b/dev/e2e-test.sh index ca78854..2f50f6a 100755 --- a/dev/e2e-test.sh +++ b/dev/e2e-test.sh @@ -992,8 +992,12 @@ echo -e "\n\033[1m== 19. init writes a config that runs ==\033[0m" # other one takes a `-c FILE` that has to exist first. Measured before this # existed, the first hand-written config failed on an unqualified table name. # -# Nothing is edited after `init` here, deliberately: the out-of-the-box path is -# what is being tested, down to the default config name and target url. +# The out-of-the-box path is what is being tested, down to the default config +# name and target url — the default is asserted below rather than passed to +# `init`. The one edit is the one an operator makes first, pointing the target +# at their own cluster: without it a run with a stack of its own (ci-local +# --isolated) would validate against whatever listens on the default port, +# which is the dev stack and not this run. ABIN="$(pwd)/$BIN" INITDIR=$(mktemp -d /tmp/pg2osync-e2e-init.XXXXXX) pg "DROP TABLE IF EXISTS init_probe, init_no_pk;" > /dev/null 2>&1 @@ -1030,9 +1034,13 @@ if (cd "$INITDIR" && "$ABIN" init --table init_probe > /dev/null 2>&1); then else ok "init refuses to overwrite without --force" fi -# The whole point: what it writes validates, unedited and with no -c flag. +check "and wrote the default target url" \ + "$(grep -c '^url = "http://localhost:9200"$' "$INITDIR/pg2osync.toml" 2> /dev/null || echo 0)" "1" +sed "s|^url = \"http://localhost:9200\"$|url = \"$OS\"|" "$INITDIR/pg2osync.toml" \ + > "$INITDIR/retargeted.toml" && mv "$INITDIR/retargeted.toml" "$INITDIR/pg2osync.toml" +# The whole point: what it writes validates, with no -c flag. if (cd "$INITDIR" && "$ABIN" validate > /dev/null 2>&1); then - ok "validate passes on the generated config, unedited" + ok "validate passes on the generated config" else bad "the generated config does not validate" fi