Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement listMethods for lua generic app #570

Merged
merged 10 commits into from
Nov 19, 2019

Conversation

eddyashton
Copy link
Member

Our listMethods RPC previously just returned the names of all registered handlers. Since the generic lua app (and presumably future similar generic interpreters) use the default endpoint, they don't actually report the supported methods (ie - they don't include LOG_record for the lua logging app). This fixes that.

While doing this I also fiddled with the test_requirements to generate parameterised variants, so we can easily say "this test requires exactly these methods", rather than looking for a specific app. I also added the ensure_reqs meta-decorator to remove some of the boilerplate (ie - to consistently skip if enforce_reqs is False). I'm sure there's some way to reduce the boilerplate even further, but I don't see it straight away.

@eddyashton eddyashton requested a review from a team as a code owner November 19, 2019 11:53
# TODO: Parameterise this decorator once we add a test that requires a
# different number of nodes
def at_least_2_nodes(func):
def ensure_reqs(check_reqs, func):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ghost
Copy link

ghost commented Nov 19, 2019

images

@ghost
Copy link

ghost commented Nov 19, 2019

images

@codecov-io
Copy link

codecov-io commented Nov 19, 2019

Codecov Report

Merging #570 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #570     +/-   ##
=========================================
+ Coverage   78.52%   78.62%   +0.1%     
=========================================
  Files         140      140             
  Lines       10558    10567      +9     
=========================================
+ Hits         8290     8308     +18     
+ Misses       2268     2259      -9
Flag Coverage Δ
#e2e_BFT 51.11% <30%> (+0.21%) ⬆️
#e2e_CFT 73.5% <100%> (+0.12%) ⬆️
#unit_BFT 65.43% <ø> (-0.02%) ⬇️
#unit_CFT 72.75% <17.65%> (-0.1%) ⬇️
Impacted Files Coverage Δ
src/node/rpc/frontend.h 77.75% <100%> (+0.1%) ⬆️
src/apps/luageneric/luageneric.cpp 86.75% <100%> (+1.22%) ⬆️
src/ds/ringbuffer.h 92.35% <0%> (-0.55%) ⬇️
src/host/tcp.h 73.93% <0%> (+0.85%) ⬆️
src/consensus/raft/raft.h 83.86% <0%> (+1.27%) ⬆️

@ghost
Copy link

ghost commented Nov 19, 2019

images

@eddyashton eddyashton merged commit bfbbf5d into microsoft:master Nov 19, 2019
@eddyashton eddyashton deleted the lua_list_methods branch November 19, 2019 12:45
eddyashton added a commit to eddyashton/CCF that referenced this pull request Mar 24, 2020
* Virtualise list_methods, override in luageneric

* Add parametrisable test requirement

* Example usage

* Parametrisable decorators, standard enforcement pattern

* Provide simple lua_generic_app req

* batched test requires specific methods

* Wrapper should forward return value!

* Reduce boilerplate

* Remove temp docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants