diff --git a/test-full.sh b/test-full.sh index 4bf986e..cf2439d 100755 --- a/test-full.sh +++ b/test-full.sh @@ -521,6 +521,39 @@ check_fail "remove needs name" \ "$KAPPA remove" \ 'no package name' + +# --features and --config flags +check "add with --features" \ + "$KAPPA add featpkg --features 'ssl=on,gzip=off'" \ + 'added featpkg' + +check "add features present in config" \ + "grep -c 'ssl = true' $KAPPA_ROOT/system/config.kap" \ + '1' + +check "update existing with --features" \ + "$KAPPA add featpkg --features 'http2=on'" \ + 'updated featpkg' + +check "add with --config" \ + "$KAPPA add cfgpkg --config 'port=9090,worker=4'" \ + 'added cfgpkg' + +check "config values written to file" \ + "grep 'port = 9090' $KAPPA_ROOT/system/config.kap" \ + 'port = 9090' + +check "add with features and config together" \ + "$KAPPA add combopkg --features 'ssl=on' --config 'host=localhost'" \ + 'added combopkg' + +check "features and config both in file" \ + "grep -c ssl $KAPPA_ROOT/system/config.kap" \ + '2' + +check "add idempotent with no flags" \ + "$KAPPA add cfgpkg" \ + 'already in packages' # ═══════════════════════════════════════════ echo "" echo "=== Install: list and rollback ===" @@ -670,6 +703,64 @@ check "resolve deptree (c has dep)" \ "$KAPPA resolve $TMPDIR/deptree-config.kap 2>&1" \ 'dep-c (1 deps)' +# Transitive dependency resolution +cat > "$KAPPA_ROOT/cache/packages/trans-a.kap" << 'TRANSEOF' +package "trans-a" { + version = "1.0" + source = "a.tar.gz" + sha256 = "abc" + license = "MIT" + build { echo a } + install { echo a } +} +TRANSEOF +cat > "$KAPPA_ROOT/cache/packages/trans-b.kap" << 'TRANSEOF' +package "trans-b" { + version = "1.0" + source = "b.tar.gz" + sha256 = "abc" + license = "MIT" + depends = [{ name = "trans-a" }] + build { echo b } + install { echo b } +} +TRANSEOF +cat > "$KAPPA_ROOT/cache/packages/trans-c.kap" << 'TRANSEOF' +package "trans-c" { + version = "1.0" + source = "c.tar.gz" + sha256 = "abc" + license = "MIT" + depends = [{ name = "trans-b" }] + build { echo c } + install { echo c } +} +TRANSEOF + +cat > "$TMPDIR/transitive-config.kap" << 'TRANSEOF' +system { hostname = "test" } +packages { trans-c {} } +services {} +boot { + kernel = "linux" + init = "s6" + root = "/dev/sda1" + bootloader = "limine" +} +TRANSEOF + +check "transitive deps auto-resolve (only c declared)" \ + "$KAPPA resolve $TMPDIR/transitive-config.kap 2>&1" \ + 'trans-a (0 deps)' + +check "transitive deps include intermediate" \ + "$KAPPA resolve $TMPDIR/transitive-config.kap 2>&1" \ + 'trans-b (1 deps)' + +check "transitive deps resolve root last" \ + "$KAPPA resolve $TMPDIR/transitive-config.kap 2>&1" \ + 'trans-c (1 deps)' + # ═══════════════════════════════════════════ echo "" echo "=== Build: simple execution ===" @@ -955,6 +1046,62 @@ check "parse-config with features" \ # ═══════════════════════════════════════════ echo "" + + +echo "" +echo "=== Search: cached index queries ===" +echo "" + +mkdir -p "$KAPPA_ROOT/cache/indexes" +cat > "$KAPPA_ROOT/cache/indexes/test-repo-stable.kap" << 'SRCHEOF' +index "test-repo/stable" { + trans-a { version = "1.0" } + trans-b { version = "1.0" } + trans-c { version = "1.0" } + testpkg { version = "1.0" } +} +SRCHEOF + +check "search finds package by name" \ + "$KAPPA search trans-a" \ + 'trans-a' + +check "search finds by substring" \ + "$KAPPA search ans" \ + 'trans-a' + +check "search shows repo source" \ + "$KAPPA search trans-a" \ + 'test-repo/stable' + +check "search no match" \ + "$KAPPA search zzz999" \ + 'no packages matching' + +echo "" +echo "=== Upgrade: version comparison ===" +echo "" + +mkdir -p "$KAPPA_ROOT/db" +cat > "$KAPPA_ROOT/db/installed" << 'UPGEOF' +trans-a 0.9 a1b2c3d4e5f6a7b8 +trans-b 0.9 b2c3d4e5f6a7b8c9 +trans-c 1.0 c3d4e5f6a7b8c9d0 +UPGEOF + +check "upgrade detects newer versions" \ + "$KAPPA upgrade 2>&1" \ + 'trans-a' + +check "upgrade shows old version" \ + "$KAPPA upgrade 2>&1" \ + '0.9' + +check "upgrade dry-run does not apply" \ + "$KAPPA upgrade --dry-run 2>&1" \ + 'run kappa add' + +rm -f "$KAPPA_ROOT/db/installed" echo "=== Rebuild: dry-run detection ===" echo ""