Skip to content

Commit e5c6e14

Browse files
committed
opt: make invalid isolation error more readable in tests
The error message when using an invalid `isolation` option in an opt test now prints a more readable message. It previously read: invalid isolation level (must be found in map[ReadCommitted:2 Serializable:0 Snapshot:1]): foo And it now reads: invalid isolation level "foo", must be one of [Serializable Snapshot ReadCommitted] Release note: None
1 parent 7571549 commit e5c6e14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/sql/opt/testutils/opttester/opt_tester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ func (f *Flags) Set(arg datadriven.CmdArg) error {
11641164
level, ok := isolation.Level_value[arg.Vals[0]]
11651165
if !ok {
11661166
return fmt.Errorf(
1167-
"invalid isolation level (must be found in %v): %v", isolation.Level_value, arg.Vals[0],
1167+
"invalid isolation level %q, must be one of %s", arg.Vals[0], isolation.Levels(),
11681168
)
11691169
}
11701170
f.TxnIsoLevel = isolation.Level(level)

0 commit comments

Comments
 (0)