nickva commented on PR #5941:
URL: https://github.com/apache/couchdb/pull/5941#issuecomment-4129129350
Thank you for your contribution @Karthikeya1500 that looks like a bug in the
command error handling, indeed!
Let's add a test for this behavior to ensure we get some coverage. Since
eunit tests are a bit tricky to figure out, see if this snippet would work:
```diff
diff --git i/src/couch/test/eunit/couch_js_tests.erl
w/src/couch/test/eunit/couch_js_tests.erl
index 29b303ffb..ecc37d25c 100644
--- i/src/couch/test/eunit/couch_js_tests.erl
+++ w/src/couch/test/eunit/couch_js_tests.erl
@@ -38,7 +38,8 @@ couch_js_test_() ->
?TDEF(should_allow_js_string_mutations),
?TDEF(should_bump_timing_and_call_stats),
?TDEF(should_exit_on_internal_error, 60),
- ?TDEF(should_use_bigint)
+ ?TDEF(should_use_bigint),
+ ?TDEF(should_handle_invalid_command)
])
}
}.
@@ -465,6 +466,11 @@ should_use_bigint(_) ->
?assertThrow({compilation_error, _}, prompt(Proc,
[<<"add_fun">>, Src]))
end.
+should_handle_invalid_command(_) ->
+ Proc = couch_query_servers:get_os_process(<<"javascript">>),
+ BadCmd = [<<"bad">>, <<"foo">>],
+ ?assertThrow({unknown_command,<<"unknown command 'bad'">>},
prompt(Proc, BadCmd)).
+
sample_time(Stat) ->
couch_stats:sample([couchdb, query_server, time, Stat]).
```
Just curious, how did you find it? Are you building a custom indexing layer?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]