create-testnet-data: don't fail trying to create irrelevant READMEs #588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog
Context
Fixes #587
When using
create-testnet-data
in IntersectMBO/cardano-node#5646, I was faced with the fact that it was crashing when omitting some flags, because it was trying to create theREADME
for some keys, whose parent directory wasn't being created; because the concerned keys where not requested. This is #587.When fixing that, I also noticed that
create-testnet-data
was looping when neither--stake-delegators
nor--transient--stake-delegators
was specified. This was due to azipWith
call withconcat $ repeat ([])
as an argument (the crux is to pass[]
torepeat
). So this PR also fixes that.On the way, I also noticed that
create-staked
andcreate-testnet-data
were avoiding a division by zero because of laziness. I made this less brittle by avoiding the division by zero explicitly.How to trust this PR
A test is introduced. The test fails before this PR and it succeeds after the PR.
Checklist