-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1727 from input-output-hk/rollback_testing
Add rollback testing
- Loading branch information
Showing
6 changed files
with
639 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
"""Generate topology files for split cluster. | ||
For settings it uses the same env variables as when running the tests. | ||
""" | ||
import argparse | ||
import logging | ||
import sys | ||
from pathlib import Path | ||
|
||
from cardano_node_tests.utils import cluster_nodes | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def get_args() -> argparse.Namespace: | ||
"""Get command line arguments.""" | ||
parser = argparse.ArgumentParser(description=__doc__.split("\n", maxsplit=1)[0]) | ||
parser.add_argument( | ||
"-d", | ||
"--dest-dir", | ||
required=True, | ||
help="Path to destination directory", | ||
) | ||
parser.add_argument( | ||
"-i", | ||
"--instance-num", | ||
required=False, | ||
type=int, | ||
default=0, | ||
help="Instance number in the sequence of cluster instances (default: 0)", | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--offset", | ||
required=False, | ||
type=int, | ||
default=0, | ||
help="Difference in number of nodes in cluster 1 vs cluster 2 (default: 0)", | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def main() -> int: | ||
logging.basicConfig( | ||
format="%(name)s:%(levelname)s:%(message)s", | ||
level=logging.INFO, | ||
) | ||
args = get_args() | ||
|
||
destdir = Path(args.dest_dir) | ||
destdir.mkdir(parents=True, exist_ok=True) | ||
|
||
try: | ||
cluster_nodes.get_cluster_type().cluster_scripts.gen_split_topology_files( | ||
destdir=destdir, | ||
instance_num=args.instance_num, | ||
offset=args.offset, | ||
) | ||
except Exception as exc: | ||
LOGGER.error(str(exc)) | ||
return 1 | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
Oops, something went wrong.