You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "chewbranca (via GitHub)" <gi...@apache.org> on 2023/12/04 18:02:06 UTC

[PR] Ensure all config get's throw on no ets table [couchdb]

chewbranca opened a new pull request, #4894:
URL: https://github.com/apache/couchdb/pull/4894

   This fixes https://github.com/apache/couchdb/issues/4890 by ensuring that the type coercion get wrappers in `config:get_*` perform the call to `config:get/3` outside of the `try-catch` block intended to catch type coercion exceptions.


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure all config get's throw on no ets table [couchdb]

Posted by "chewbranca (via GitHub)" <gi...@apache.org>.
chewbranca commented on PR #4894:
URL: https://github.com/apache/couchdb/pull/4894#issuecomment-1839862757

   Hmmm... the failures in that build seem to be isolated to just `chttpd_db` for the most part, and the build only took 13 minutes, I suspect there will be many more failures. In the case here, I see we're already meck'ing `config:get/3` https://github.com/apache/couchdb/blob/main/src/chttpd/src/chttpd_db.erl#L2612 which _should_ work, unless meck only intercedes public invocations of the module, rather than an internal invocation from get_integer. You can see we're hitting `{config_meck_original, get, 3}` in the stacktrace despite that test being covered by the setup clause linked above mecking `config:get/3`:
   
   ```
   18:15:58  chttpd_db:2687 -t_should_throw_on_invalid_n/0-fun-1-
   18:15:58  ----------------------------------------------------
   18:15:58  
   18:15:58  ::in function chttpd_db:'-t_should_throw_on_invalid_n/0-fun-1-'/0 (src/chttpd_db.erl, line 2690)
   18:15:58  in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
   18:15:58  in call from eunit_proc:run_test/1 (eunit_proc.erl, line 531)
   18:15:58  in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 356)
   18:15:58  in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 514)
   18:15:58  in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 456)
   18:15:58  in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 346)
   18:15:58  in call from eunit_proc:run_group/2 (eunit_proc.erl, line 570)
   18:15:58  **error:{assertException,
   18:15:58      [{module,chttpd_db},
   18:15:58       {line,2690},
   18:15:58       {expression,"parse_shards_opt ( Req )"},
   18:15:58       {pattern,"{ throw , { bad_request , Err } , [...] }"},
   18:15:58       {unexpected_exception,
   18:15:58           {error,badarg,
   18:15:58               [{ets,lookup,
   18:15:58                    [config,{"cluster","n"}],
   18:15:58                    [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
   18:15:58                {config_meck_original,get,3,
   18:15:58                    [{file,"src/config.erl"},{line,163}]},
   18:15:58                {config_meck_original,get_integer,3,
   18:15:58                    [{file,"src/config.erl"},{line,71}]},
   18:15:58                {chttpd_db,parse_shards_opt,1,
   18:15:58                    [{file,"src/chttpd_db.erl"},{line,1951}]},
   18:15:58                {chttpd_db,'-t_should_throw_on_invalid_n/0-fun-1-',0,
   18:15:58                    [{file,"src/chttpd_db.erl"},{line,2690}]},
   18:15:58                {eunit_test,run_testfun,1,[{file,"eunit_test.erl"},{line,71}]},
   18:15:58                {eunit_proc,run_test,1,[{file,"eunit_proc.erl"},{line,531}]},
   18:15:58                {config,get_integer,["cluster","n",3],[]}]}}]}
   ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure all config get's throw on no ets table [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva closed pull request #4894: Ensure all config get's throw on no ets table
URL: https://github.com/apache/couchdb/pull/4894


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure all config get's throw on no ets table [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4894:
URL: https://github.com/apache/couchdb/pull/4894#issuecomment-1839291517

   For the failing tests we'd probably want to either mock config get or make sure config app is started.


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure all config get's throw on no ets table [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4894:
URL: https://github.com/apache/couchdb/pull/4894#issuecomment-2892060627

   I think this might be outdated, config doesn't use ets tables any longer so the `badarg` error shouldn't have ambiguity of coming from a missing ets or from a badly typed value:  
   
   https://github.com/apache/couchdb/blob/15f9d42f7f64b18ad7cc4c26e6c206a47fad83af/src/config/src/config.erl#L592-L595
   
   That will never fail with a `badarg`


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ensure all config get's throw on no ets table [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on PR #4894:
URL: https://github.com/apache/couchdb/pull/4894#issuecomment-6149251294

   Closing as we don't use ets tables any longer (#4890 )


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org