diff --git a/ci/journey.sh b/ci/journey.sh index d64f799..37274a5 100755 --- a/ci/journey.sh +++ b/ci/journey.sh @@ -2026,6 +2026,88 @@ EOF # export round-trips the managed set to reviewable YAML. "$ARCHIVER" export --config /tmp/journey-conn.yaml >/tmp/journey-export.log 2>&1 if grep -q "source_table: cli_events" /tmp/journey-export.log; then pass "export emits cli_events as YAML"; else fail "export missing cli_events"; tail -5 /tmp/journey-export.log; fi + + # TC-118: archiver.tables in YAML is ignored at runtime — the archiver always + # resolves its table set from coldfront.partition_config regardless of what + # archiver.tables says in the config file. + cat > /tmp/journey-yaml-tables.yaml </tmp/journey-yaml-tables.log 2>&1; then + pass "TC-118: archiver ran with stale archiver.tables block in YAML" + else + fail "TC-118: archiver failed — see /tmp/journey-yaml-tables.log"; tail -8 /tmp/journey-yaml-tables.log + fi + if grep -q "from coldfront.partition_config" /tmp/journey-yaml-tables.log; then + pass "TC-118: archiver drove off partition_config (YAML archiver.tables ignored)" + else + fail "TC-118: archiver did not load from partition_config"; tail -5 /tmp/journey-yaml-tables.log + fi + if grep -qi "bogus_table_yaml" /tmp/journey-yaml-tables.log; then + fail "TC-118: archiver processed the YAML-only table (should be ignored)" + else + pass "TC-118: YAML archiver.tables block was not processed" + fi + + # TC-119: export → delete row → import restores the partition_config entry. + # export emits ALL enabled tables; importing that full set would hit unique-key + # conflicts on rows still in partition_config. Verify export is correct + # separately, then import only cli_events via a targeted YAML. + "$ARCHIVER" export --config /tmp/journey-conn.yaml >/tmp/journey-export.log 2>&1 + if grep -q "source_table: cli_events" /tmp/journey-export.log; then + pass "TC-119: export produced YAML with cli_events" + else + fail "TC-119: export missing cli_events"; tail -3 /tmp/journey-export.log + fi + cat > /tmp/journey-roundtrip.yaml </dev/null + assert_eq "TC-119: cli_events deleted from partition_config" "0" \ + "$(q "$HOST" "SELECT count(*) FROM coldfront.partition_config WHERE table_name='cli_events';")" + if "$ARCHIVER" import --config /tmp/journey-roundtrip.yaml >/tmp/journey-roundtrip.log 2>&1; then + pass "TC-119: import from YAML succeeded" + else + fail "TC-119: import failed — see /tmp/journey-roundtrip.log"; tail -5 /tmp/journey-roundtrip.log + fi + assert_eq "TC-119: cli_events row restored in partition_config" "1" \ + "$(q "$HOST" "SELECT count(*) FROM coldfront.partition_config WHERE table_name='cli_events';")" + + # TC-120: set writes to partition_config only — the YAML config file is never + # touched. Capture a checksum before, run set, then verify both the DB + # change and the unchanged file. + local yaml_cksum; yaml_cksum=$(md5sum /tmp/journey-conn.yaml | awk '{print $1}') + if "$ARCHIVER" set --config /tmp/journey-conn.yaml --table cli_events --hot-period "45 days" >/tmp/journey-setf.log 2>&1; then + pass "TC-120: set --hot-period succeeded" + else + fail "TC-120: set failed — see /tmp/journey-setf.log"; tail -3 /tmp/journey-setf.log + fi + local hot_val; hot_val=$(q "$HOST" "SELECT hot_period FROM coldfront.partition_config WHERE schema_name='public' AND table_name='cli_events';") + if echo "$hot_val" | grep -qi "45"; then + pass "TC-120: partition_config.hot_period updated to 45 days" + else + fail "TC-120: partition_config.hot_period not updated (got: $hot_val)" + fi + if [ "$(md5sum /tmp/journey-conn.yaml | awk '{print $1}')" = "$yaml_cksum" ]; then + pass "TC-120: YAML file unchanged by set" + else + fail "TC-120: set modified the YAML file (it must not)" + fi } # idmode_check