-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: Implement lighthouse beacon service #394
feat: Implement lighthouse beacon service #394
Conversation
5942aea
to
1e2168d
Compare
@scottbot95 nice work! Thanks again for taking the time to contribute! As one extra request, do you think can you add some light tests to check the module works properly (like for example we have done for prysm)? |
I am going on vacation soon so I might not get to it for a week or two, but I could certainly look into some tests |
@scottbot95 OK, we can merge this PR and add tests after |
I'm in no rush to merge this personally. Do whatever you feel is best for the project. |
This PR as it is provides value ;) (if there's any bug we can sort it out later) |
I started taking a look at writing some tests for this and it looks like the existing prysm tests basically just check that the nix module evaluates to a valid systemd config. The only assertion that we have is that the unit enters the active state, but since the service type is I'm happy to add some tests, but I'd like to add something of a little more value if possible. I'm not really sure what the best thing to do here is though. Perhaps just call |
@scottbot95 yeah, you're right about the When I was working on the problem, instead, I decided to implement multiple strategies to check the service was starting correctly, but also double-checking that the ports were open and checking if the logs contained anything related to an error message. Below you can see a completely invented example of what I'm describing. We can take that approach and improve the testing based on that. As the code of the tests is pure Python we can do more clever checks. What do you think? testScript = {nodes, ...}: ''
def wait_for_units(node, units):
for unit in units:
node.wait_for_unit(unit)
def check_ports(node, ports):
for port in ports:
node.wait_for_open_port(port)
start_all()
# Service Status
wait_for_units(portal, [ "bitcoind.service", "geth.service"])
client.wait_for_unit("multi-user.target")
# Port Accessibility
check_ports(portal, [9001, 9002, 18500])
# Data Persistence
portal.succeed("test -f /var/lib/geth/chain/wallet.db")
# Error Logs
portal.fail("journalctl -u geth.service | grep -i 'error'")
''; |
This approach seems pretty good. Checking ports/logs/files is probably the only things we can realistically check for. We could probably also come up with a message to expect from in logs. In the case of the Lighthouse Validator, we could probably search for |
Implement services for Lighthouse Beacon Node and Validator Client.
I feel like the only particularly controversial thing in this PR is making the network default to the name of the beacon/validator service.
Resolves #20