From def294112843134c1584a8c3acea6dbf4e5f5102 Mon Sep 17 00:00:00 2001 From: lew Date: Wed, 17 Dec 2025 14:28:18 +0000 Subject: [PATCH] chore(testdata): updates test expectations to match new error messaging --- cmd/del.go | 5 +- testdata/get__missing__err.ct | 14 +-- testdata/get__missing__err__with__any.ct | 104 ++---------------- testdata/get__secret__err.ct | 14 +-- testdata/get__secret__err__with__binary.ct | 14 +-- .../get__secret__err__with__binary_run.ct | 14 +-- testdata/get__secret__err__with__run.ct | 14 +-- testdata/help__ok.ct | 4 + testdata/root__ok.ct | 2 + testdata/set__err__with__invalid-ttl.ct | 10 -- 10 files changed, 22 insertions(+), 173 deletions(-) diff --git a/cmd/del.go b/cmd/del.go index c946c20..ed4625f 100644 --- a/cmd/del.go +++ b/cmd/del.go @@ -81,7 +81,10 @@ func del(cmd *cobra.Command, args []string) error { if err := tx.Delete(k); errors.Is(err, badger.ErrKeyNotFound) { return fmt.Errorf("cannot remove '%s': No such key", args[0]) } - return fmt.Errorf("cannot remove '%s': %v", args[0], err) + if err != nil { + return fmt.Errorf("cannot remove '%s': %v", args[0], err) + } + return nil }, } diff --git a/testdata/get__missing__err.ct b/testdata/get__missing__err.ct index 92ac16e..ced6568 100644 --- a/testdata/get__missing__err.ct +++ b/testdata/get__missing__err.ct @@ -1,14 +1,2 @@ $ pda get foobar --> FAIL -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret +Error: cannot get 'foobar': Key not found diff --git a/testdata/get__missing__err__with__any.ct b/testdata/get__missing__err__with__any.ct index e178f4c..d4c9284 100644 --- a/testdata/get__missing__err__with__any.ct +++ b/testdata/get__missing__err__with__any.ct @@ -5,100 +5,10 @@ $ pda get foobar --include-binary --run --secret --> FAIL $ pda get foobar --run --> FAIL $ pda get foobar --run --secret --> FAIL $ pda get foobar --secret --> FAIL -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret - -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret - -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret - -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret - -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret - -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret - -Error: Key not found -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret +Error: cannot get 'foobar': Key not found +Error: cannot get 'foobar': Key not found +Error: cannot get 'foobar': Key not found +Error: cannot get 'foobar': Key not found +Error: cannot get 'foobar': Key not found +Error: cannot get 'foobar': Key not found +Error: cannot get 'foobar': Key not found diff --git a/testdata/get__secret__err.ct b/testdata/get__secret__err.ct index 05d2a66..1dc4e6e 100644 --- a/testdata/get__secret__err.ct +++ b/testdata/get__secret__err.ct @@ -1,15 +1,3 @@ $ pda set a b --secret $ pda get a --> FAIL -Error: "a" is marked secret; re-run with --secret to display it -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret +Error: cannot get 'a': marked as secret, run with --secret diff --git a/testdata/get__secret__err__with__binary.ct b/testdata/get__secret__err__with__binary.ct index a2b0300..065b3fc 100644 --- a/testdata/get__secret__err__with__binary.ct +++ b/testdata/get__secret__err__with__binary.ct @@ -1,16 +1,4 @@ $ fecho cmd echo hello world $ pda set a --secret < cmd $ pda get a --include-binary --> FAIL -Error: "a" is marked secret; re-run with --secret to display it -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret +Error: cannot get 'a': marked as secret, run with --secret diff --git a/testdata/get__secret__err__with__binary_run.ct b/testdata/get__secret__err__with__binary_run.ct index 6d84bbd..877ac77 100644 --- a/testdata/get__secret__err__with__binary_run.ct +++ b/testdata/get__secret__err__with__binary_run.ct @@ -1,16 +1,4 @@ $ fecho cmd echo hello world $ pda set a --secret < cmd $ pda get a --include-binary --run --> FAIL -Error: "a" is marked secret; re-run with --secret to display it -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret +Error: cannot get 'a': marked as secret, run with --secret diff --git a/testdata/get__secret__err__with__run.ct b/testdata/get__secret__err__with__run.ct index be8b212..67e2d25 100644 --- a/testdata/get__secret__err__with__run.ct +++ b/testdata/get__secret__err__with__run.ct @@ -1,16 +1,4 @@ $ fecho cmd echo hello world $ pda set a --secret < cmd $ pda get a --run --> FAIL -Error: "a" is marked secret; re-run with --secret to display it -Usage: - pda get KEY[@DB] [flags] - -Aliases: - get, g - -Flags: - -h, --help help for get - -b, --include-binary include binary data in text output - --no-template directly output template syntax - -c, --run execute the result as a shell command - --secret display values marked as secret +Error: cannot get 'a': marked as secret, run with --secret diff --git a/testdata/help__ok.ct b/testdata/help__ok.ct index fb5709c..a007bd6 100644 --- a/testdata/help__ok.ct +++ b/testdata/help__ok.ct @@ -14,6 +14,7 @@ Usage: Available Commands: completion Generate the autocompletion script for the specified shell + cp Make a copy of a key. del Delete a key. Optionally specify a db. del-db Delete a database. dump Dump all key/value pairs as NDJSON @@ -21,6 +22,7 @@ Available Commands: help Help about any command list List the contents of a db. list-dbs List all dbs. + mv Move a key between (or within) databases. restore Restore key/value pairs from an NDJSON dump set Set a value for a key by passing VALUE or Stdin. Optionally specify a db. @@ -42,6 +44,7 @@ Usage: Available Commands: completion Generate the autocompletion script for the specified shell + cp Make a copy of a key. del Delete a key. Optionally specify a db. del-db Delete a database. dump Dump all key/value pairs as NDJSON @@ -49,6 +52,7 @@ Available Commands: help Help about any command list List the contents of a db. list-dbs List all dbs. + mv Move a key between (or within) databases. restore Restore key/value pairs from an NDJSON dump set Set a value for a key by passing VALUE or Stdin. Optionally specify a db. diff --git a/testdata/root__ok.ct b/testdata/root__ok.ct index 90e63c1..3f898ee 100644 --- a/testdata/root__ok.ct +++ b/testdata/root__ok.ct @@ -13,6 +13,7 @@ Usage: Available Commands: completion Generate the autocompletion script for the specified shell + cp Make a copy of a key. del Delete a key. Optionally specify a db. del-db Delete a database. dump Dump all key/value pairs as NDJSON @@ -20,6 +21,7 @@ Available Commands: help Help about any command list List the contents of a db. list-dbs List all dbs. + mv Move a key between (or within) databases. restore Restore key/value pairs from an NDJSON dump set Set a value for a key by passing VALUE or Stdin. Optionally specify a db. diff --git a/testdata/set__err__with__invalid-ttl.ct b/testdata/set__err__with__invalid-ttl.ct index 9935ca4..a27ea1d 100644 --- a/testdata/set__err__with__invalid-ttl.ct +++ b/testdata/set__err__with__invalid-ttl.ct @@ -1,12 +1,2 @@ $ pda set a b --ttl 3343r --> FAIL Error: invalid argument "3343r" for "-t, --ttl" flag: time: unknown unit "r" in duration "3343r" -Usage: - pda set KEY[@DB] [VALUE] [flags] - -Aliases: - set, s - -Flags: - -h, --help help for set - --secret Mark the stored value as a secret - -t, --ttl duration Expire the key after the provided duration (e.g. 24h, 30m)