Skip to content

Commit

Permalink
fix(testnet_cleanup): update argument requirements
Browse files Browse the repository at this point in the history
- Removed required constraints for address and skey-file arguments to
  retain backwards compatibility
- Added validation to ensure both or neither are provided
- Require address and skey-file arguments when BOOTSTRAP_DIR env
  variable is not set
  • Loading branch information
mkoura committed Nov 21, 2024
1 parent a309cb3 commit 2705c12
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cardano_node_tests/testnet_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ def get_args() -> argparse.Namespace:
parser.add_argument(
"-f",
"--address",
required=True,
help="Faucet address",
)
parser.add_argument(
"-s",
"--skey-file",
required=True,
type=helpers.check_file_arg,
help="Path to faucet skey file",
)
Expand All @@ -58,8 +56,15 @@ def main() -> int:
if not socket_env:
LOGGER.error("The `CARDANO_NODE_SOCKET_PATH` environment variable is not set.")
return 1
if not os.environ.get("BOOTSTRAP_DIR"):
LOGGER.error("The `BOOTSTRAP_DIR` environment variable is not set.")
if bool(args.address) ^ bool(args.skey_file):
LOGGER.error(
"Both address and skey file must be provided, or neither of them should be provided."
)
return 1
if not (args.address or os.environ.get("BOOTSTRAP_DIR")):
LOGGER.error(
"The address must be provided, or `BOOTSTRAP_DIR` environment variable must be set."
)
return 1

state_dir = pl.Path(socket_env).parent
Expand Down

0 comments on commit 2705c12

Please sign in to comment.