chore(testdata): updates test expectations to match new error messaging
This commit is contained in:
parent
06e09df829
commit
def2941128
10 changed files with 22 additions and 173 deletions
|
|
@ -81,7 +81,10 @@ func del(cmd *cobra.Command, args []string) error {
|
||||||
if err := tx.Delete(k); errors.Is(err, badger.ErrKeyNotFound) {
|
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': No such key", args[0])
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("cannot remove '%s': %v", args[0], err)
|
return fmt.Errorf("cannot remove '%s': %v", args[0], err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
14
testdata/get__missing__err.ct
vendored
14
testdata/get__missing__err.ct
vendored
|
|
@ -1,14 +1,2 @@
|
||||||
$ pda get foobar --> FAIL
|
$ pda get foobar --> FAIL
|
||||||
Error: Key not found
|
Error: cannot get 'foobar': 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
|
|
||||||
|
|
|
||||||
104
testdata/get__missing__err__with__any.ct
vendored
104
testdata/get__missing__err__with__any.ct
vendored
|
|
@ -5,100 +5,10 @@ $ pda get foobar --include-binary --run --secret --> FAIL
|
||||||
$ pda get foobar --run --> FAIL
|
$ pda get foobar --run --> FAIL
|
||||||
$ pda get foobar --run --secret --> FAIL
|
$ pda get foobar --run --secret --> FAIL
|
||||||
$ pda get foobar --secret --> FAIL
|
$ pda get foobar --secret --> FAIL
|
||||||
Error: Key not found
|
Error: cannot get 'foobar': Key not found
|
||||||
Usage:
|
Error: cannot get 'foobar': Key not found
|
||||||
pda get KEY[@DB] [flags]
|
Error: cannot get 'foobar': Key not found
|
||||||
|
Error: cannot get 'foobar': Key not found
|
||||||
Aliases:
|
Error: cannot get 'foobar': Key not found
|
||||||
get, g
|
Error: cannot get 'foobar': Key not found
|
||||||
|
Error: cannot get 'foobar': Key not found
|
||||||
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
|
|
||||||
|
|
|
||||||
14
testdata/get__secret__err.ct
vendored
14
testdata/get__secret__err.ct
vendored
|
|
@ -1,15 +1,3 @@
|
||||||
$ pda set a b --secret
|
$ pda set a b --secret
|
||||||
$ pda get a --> FAIL
|
$ pda get a --> FAIL
|
||||||
Error: "a" is marked secret; re-run with --secret to display it
|
Error: cannot get 'a': marked as secret, run with --secret
|
||||||
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
|
|
||||||
|
|
|
||||||
14
testdata/get__secret__err__with__binary.ct
vendored
14
testdata/get__secret__err__with__binary.ct
vendored
|
|
@ -1,16 +1,4 @@
|
||||||
$ fecho cmd echo hello world
|
$ fecho cmd echo hello world
|
||||||
$ pda set a --secret < cmd
|
$ pda set a --secret < cmd
|
||||||
$ pda get a --include-binary --> FAIL
|
$ pda get a --include-binary --> FAIL
|
||||||
Error: "a" is marked secret; re-run with --secret to display it
|
Error: cannot get 'a': marked as secret, run with --secret
|
||||||
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
|
|
||||||
|
|
|
||||||
14
testdata/get__secret__err__with__binary_run.ct
vendored
14
testdata/get__secret__err__with__binary_run.ct
vendored
|
|
@ -1,16 +1,4 @@
|
||||||
$ fecho cmd echo hello world
|
$ fecho cmd echo hello world
|
||||||
$ pda set a --secret < cmd
|
$ pda set a --secret < cmd
|
||||||
$ pda get a --include-binary --run --> FAIL
|
$ pda get a --include-binary --run --> FAIL
|
||||||
Error: "a" is marked secret; re-run with --secret to display it
|
Error: cannot get 'a': marked as secret, run with --secret
|
||||||
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
|
|
||||||
|
|
|
||||||
14
testdata/get__secret__err__with__run.ct
vendored
14
testdata/get__secret__err__with__run.ct
vendored
|
|
@ -1,16 +1,4 @@
|
||||||
$ fecho cmd echo hello world
|
$ fecho cmd echo hello world
|
||||||
$ pda set a --secret < cmd
|
$ pda set a --secret < cmd
|
||||||
$ pda get a --run --> FAIL
|
$ pda get a --run --> FAIL
|
||||||
Error: "a" is marked secret; re-run with --secret to display it
|
Error: cannot get 'a': marked as secret, run with --secret
|
||||||
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
|
|
||||||
|
|
|
||||||
4
testdata/help__ok.ct
vendored
4
testdata/help__ok.ct
vendored
|
|
@ -14,6 +14,7 @@ Usage:
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
completion Generate the autocompletion script for the specified shell
|
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 Delete a key. Optionally specify a db.
|
||||||
del-db Delete a database.
|
del-db Delete a database.
|
||||||
dump Dump all key/value pairs as NDJSON
|
dump Dump all key/value pairs as NDJSON
|
||||||
|
|
@ -21,6 +22,7 @@ Available Commands:
|
||||||
help Help about any command
|
help Help about any command
|
||||||
list List the contents of a db.
|
list List the contents of a db.
|
||||||
list-dbs List all dbs.
|
list-dbs List all dbs.
|
||||||
|
mv Move a key between (or within) databases.
|
||||||
restore Restore key/value pairs from an NDJSON dump
|
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.
|
set Set a value for a key by passing VALUE or Stdin. Optionally specify a db.
|
||||||
|
|
||||||
|
|
@ -42,6 +44,7 @@ Usage:
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
completion Generate the autocompletion script for the specified shell
|
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 Delete a key. Optionally specify a db.
|
||||||
del-db Delete a database.
|
del-db Delete a database.
|
||||||
dump Dump all key/value pairs as NDJSON
|
dump Dump all key/value pairs as NDJSON
|
||||||
|
|
@ -49,6 +52,7 @@ Available Commands:
|
||||||
help Help about any command
|
help Help about any command
|
||||||
list List the contents of a db.
|
list List the contents of a db.
|
||||||
list-dbs List all dbs.
|
list-dbs List all dbs.
|
||||||
|
mv Move a key between (or within) databases.
|
||||||
restore Restore key/value pairs from an NDJSON dump
|
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.
|
set Set a value for a key by passing VALUE or Stdin. Optionally specify a db.
|
||||||
|
|
||||||
|
|
|
||||||
2
testdata/root__ok.ct
vendored
2
testdata/root__ok.ct
vendored
|
|
@ -13,6 +13,7 @@ Usage:
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
completion Generate the autocompletion script for the specified shell
|
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 Delete a key. Optionally specify a db.
|
||||||
del-db Delete a database.
|
del-db Delete a database.
|
||||||
dump Dump all key/value pairs as NDJSON
|
dump Dump all key/value pairs as NDJSON
|
||||||
|
|
@ -20,6 +21,7 @@ Available Commands:
|
||||||
help Help about any command
|
help Help about any command
|
||||||
list List the contents of a db.
|
list List the contents of a db.
|
||||||
list-dbs List all dbs.
|
list-dbs List all dbs.
|
||||||
|
mv Move a key between (or within) databases.
|
||||||
restore Restore key/value pairs from an NDJSON dump
|
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.
|
set Set a value for a key by passing VALUE or Stdin. Optionally specify a db.
|
||||||
|
|
||||||
|
|
|
||||||
10
testdata/set__err__with__invalid-ttl.ct
vendored
10
testdata/set__err__with__invalid-ttl.ct
vendored
|
|
@ -1,12 +1,2 @@
|
||||||
$ pda set a b --ttl 3343r --> FAIL
|
$ pda set a b --ttl 3343r --> FAIL
|
||||||
Error: invalid argument "3343r" for "-t, --ttl" flag: time: unknown unit "r" in duration "3343r"
|
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)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue