Skip to content

Commit

Permalink
Merge branch 'tickets/DM-47444'
Browse files Browse the repository at this point in the history
  • Loading branch information
iagaponenko committed Nov 16, 2024
2 parents adb8215 + 55ddce1 commit 27d2637
Show file tree
Hide file tree
Showing 10 changed files with 591 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ jobs:
./admin/local/cli/qserv --log-level DEBUG itest-http --reload --load-http \
--qserv-image ${{ needs.image-names.outputs.qserv-image }} \
--mariadb-image ${{ needs.image-names.outputs.mariadb-image }}
- name: Run integration tests of ingesting user tables via the HTTP frontend
run: |
./admin/local/cli/qserv --log-level DEBUG itest-http-ingest \
--qserv-image ${{ needs.image-names.outputs.qserv-image }}
- name: Check Qserv containers
if: always()
Expand Down
36 changes: 36 additions & 0 deletions src/admin/python/lsst/qserv/admin/cli/_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,42 @@ def run_integration_tests_http(
)


def run_integration_tests_http_ingest(
run_tests: bool,
keep_results: bool,
tests_yaml: str,
) -> bool:
"""Top level script to run the integration tests of ingesting user tables via the HTTP frontend.
Parameters
----------
run_tests : `bool`
True if the tests should be run. (False can be used to compare
previously generated test outputs.)
keep_results : `bool`
True if the results should be kept after the tests are run.
tests_yaml : `str`
Path to the yaml file that contains the details about running the
tests. The files will be merged, higher index files get priority.
Returns
-------
success : `bool`
`True` if loading succeeded and query outputs were the same as the inputs, otherwise `False`.
"""

with open(tests_yaml) as f:
tests_data = yaml.safe_load(f.read())

if run_tests:
wait_for_czar(tests_data["czar-db-admin-uri"])
wait_for_replication_system(tests_data["replication-controller-uri"])
return itest.run_http_ingest(
http_frontend_uri=tests_data["qserv-http-uri"],
keep_results=keep_results,
)
return True

def prepare_data(
tests_yaml: str
) -> bool:
Expand Down
29 changes: 29 additions & 0 deletions src/admin/python/lsst/qserv/admin/cli/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
option_results_protocol,
option_run,
option_run_tests,
option_keep_results,
options_targs,
option_tests_yaml,
option_unload,
Expand Down Expand Up @@ -428,6 +429,34 @@ def integration_test_http(
sys.exit(0 if results.passed else 1)


@entrypoint.command()
@option_repl_connection(
help=option_repl_connection.keywords["help"]
+ " If provided will wait for the replication system to be responsive before loading data (does not guarantee system readyness)."
)
@option_run_tests()
@option_keep_results()
@option_tests_yaml()
def integration_test_http_ingest(
repl_connection: str,
run_tests: bool,
keep_results: bool,
tests_yaml: str,
) -> None:
"""Run integration tests of the ingesting user tables via the HTTP frontend.
TESTS_YAML is the yaml file path that contains connection information and describes tests to load and run.
"""

results = script.integration_test_http_ingest(
repl_connection=repl_connection,
run_tests=run_tests,
keep_results=keep_results,
tests_yaml=tests_yaml,
)
click.echo(str(results))
sys.exit(0 if results else 1)


@entrypoint.command()
@option_tests_yaml()
Expand Down
6 changes: 6 additions & 0 deletions src/admin/python/lsst/qserv/admin/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ def __call__(self, f: Callable) -> Callable:
default=True,
)

option_keep_results = partial(
click.option,
"--keep-results/--no-keep-results",
help="Keep or delet results after finishing the tests. Defaults to --no-keep-results.",
default=False,
)

option_compare_results = partial(
click.option,
Expand Down
16 changes: 16 additions & 0 deletions src/admin/python/lsst/qserv/admin/cli/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,22 @@ def integration_test_http(
)


def integration_test_http_ingest(
repl_connection: str,
run_tests: bool,
keep_results: bool,
tests_yaml: str,
) -> bool:
if repl_connection is not None:
_do_smig_block(admin_smig_dir, "replica", repl_connection)

return _integration_test.run_integration_tests_http_ingest(
run_tests=run_tests,
keep_results=keep_results,
tests_yaml=tests_yaml,
)


def prepare_data(
tests_yaml: str,
) -> bool:
Expand Down
Loading

0 comments on commit 27d2637

Please sign in to comment.