From 4d4780b7be611611363f0ef62a0a9174e26975ea Mon Sep 17 00:00:00 2001 From: Sylvain Gaudan Date: Thu, 24 Oct 2024 16:18:25 +0200 Subject: [PATCH] add test for clone --- arlas/cli/index.py | 1 + arlas/cli/service.py | 2 +- scripts/tests.sh | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arlas/cli/index.py b/arlas/cli/index.py index 49f5023..1a937d9 100644 --- a/arlas/cli/index.py +++ b/arlas/cli/index.py @@ -112,6 +112,7 @@ def data( Service.index_hits(config, index=index, file_path=file, bulk_size=bulk, count=count) i = i + 1 + @indices.command(help="Generate the mapping based on the data") def mapping( file: str = typer.Argument(help="Path to the file conaining the data. Format: NDJSON"), diff --git a/arlas/cli/service.py b/arlas/cli/service.py index ee8922a..85922d5 100644 --- a/arlas/cli/service.py +++ b/arlas/cli/service.py @@ -135,7 +135,7 @@ def list_collections(arlas: str) -> list[list[str]]: ]) return table - def list_indices(arlas: str, keeponly: None) -> list[list[str]]: + def list_indices(arlas: str, keeponly: str = None) -> list[list[str]]: data = json.loads(Service.__es__(arlas, "_cat/indices?format=json")) table = [["name", "status", "count", "size"]] for index in data: diff --git a/scripts/tests.sh b/scripts/tests.sh index bd96a96..5f9734e 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -96,6 +96,15 @@ else exit 1 fi +# ---------------------------------------------------------- +echo "TEST clone index" +if python3.10 -m arlas.cli.cli --config-file /tmp/arlas_cli.yaml indices --config tests clone courses courses2 | grep courses | grep " 200 "; then + echo "OK: hundred hits found" +else + echo "ERROR: hits not found" + exit 1 +fi + # ---------------------------------------------------------- echo "TEST add collection"