def test_reset_chain(project, write_project_file): data_dir = get_data_dir(project.project_dir, 'test-chain') ensure_path_exists(data_dir) chaindata_dir = get_chaindata_dir(data_dir) dapp_dir = get_dapp_dir(data_dir) nodekey_path = get_nodekey_path(data_dir) geth_ipc_path = get_geth_ipc_path(data_dir) ensure_path_exists(chaindata_dir) ensure_path_exists(dapp_dir) write_project_file(nodekey_path) write_project_file(geth_ipc_path) # sanity check assert os.path.exists(data_dir) assert os.path.exists(chaindata_dir) assert os.path.exists(dapp_dir) assert os.path.exists(nodekey_path) assert os.path.exists(geth_ipc_path) reset_chain(data_dir) assert os.path.exists(data_dir) assert not os.path.exists(chaindata_dir) assert not os.path.exists(dapp_dir) assert not os.path.exists(nodekey_path) assert not os.path.exists(geth_ipc_path)
def test_reset_chain(project, write_project_file): data_dir = get_data_dir(project.project_dir, 'test-chain') ensure_path_exists(data_dir) chaindata_dir = get_chaindata_dir(data_dir) dapp_dir = get_dapp_dir(data_dir) nodekey_path = get_nodekey_path(data_dir) geth_ipc_path = get_geth_ipc_path(data_dir) ensure_path_exists(chaindata_dir) ensure_path_exists(dapp_dir) write_project_file(nodekey_path) write_project_file(geth_ipc_path) # sanity check assert os.path.exists(data_dir) assert os.path.exists(chaindata_dir) assert os.path.exists(dapp_dir) assert os.path.exists(nodekey_path) assert os.path.exists(geth_ipc_path) reset_chain(data_dir) assert os.path.exists(data_dir) assert not os.path.exists(chaindata_dir) assert not os.path.exists(dapp_dir) assert not os.path.exists(nodekey_path) assert not os.path.exists(geth_ipc_path)
def chain_reset(ctx, chain_name, confirm): """ Reset a chain removing all chain data and resetting it to it's genesis state.. """ project = ctx.obj['PROJECT'] if confirm: confirmation_message = ( "Are you sure you want to reset blockchain {0}: {1}".format( chain_name, project.get_blockchain_data_dir(chain_name), )) if not click.confirm(confirmation_message): raise ctx.abort() reset_chain(project.get_blockchain_data_dir(chain_name))
def chain_reset(ctx, chain_name, confirm): """ Reset a chain removing all chain data and resetting it to it's genesis state.. """ project = ctx.obj['PROJECT'] if confirm: confirmation_message = ( "Are you sure you want to reset blockchain {0}: {1}".format( chain_name, project.get_blockchain_data_dir(chain_name), ) ) if not click.confirm(confirmation_message): raise ctx.abort() reset_chain(project.get_blockchain_data_dir(chain_name))