-
Notifications
You must be signed in to change notification settings - Fork 5
Added an integtest to demonstrate user-specified control applications... #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f3a19ef
Initial changes to integtests to react to changes in the integrationt…
d5ce74a
minor cleanup in basic_multi_app_test.py
b658b64
Merge remote-tracking branch 'origin/develop' into kbiery/multi_ctrl_…
6803e65
Restored the pmshell:ps command in the basic_multi_app_test.py test
7f21c2a
moved the drunc:disable-triggers command earlier than the pmshell:ps …
102db1c
Merge remote-tracking branch 'origin/develop' into kbiery/multi_ctrl_…
e0b6b31
added some comments for the DAQSessionIngredients in basic_multi_app_…
01d03de
renamed basic_multi_app_test.py as basic_multiapp_test.py
9ab3ae9
Removed debug statement from integ_test_utils.py
2904e75
Added some introduction text to the top of basic_multiapp_test.py
1d550b9
Merge remote-tracking branch 'origin/develop' into kbiery/multi_ctrl_…
46c307b
Modified process_manager_test.py so that it is less strict about find…
4b1683e
Updated the failure_mode_* integration tests to make use of the 'comp…
f5a7258
Merge remote-tracking branch 'origin/develop' into kbiery/multi_ctrl_…
daf4f09
Merge branch 'develop' into kbiery/multi_ctrl_proc_support
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,168 @@ | ||
| # 05-Aug-2026, KAB: the goal of this test is to validate and demonstrate the use of multiple | ||
| # user-specified applications running in the DAQ session that is part of this test. | ||
| # | ||
| # This integtest was created by copying the small_footprint_quick_test from the daqsystemtest | ||
| # repo and converting the assignment of the run control commands to make use of the new | ||
| # "daq_session_ingredients" special integtest variable. | ||
| # | ||
| import pytest | ||
| import urllib.request | ||
|
|
||
| from integrationtest.data_classes import * | ||
| import integrationtest.data_file_checks as data_file_checks | ||
| import integrationtest.log_file_checks as log_file_checks | ||
| import integrationtest.resource_validation as resource_validation | ||
| import integrationtest.utility_functions as utility_functions | ||
| from integrationtest.get_pytest_tmpdir import get_pytest_tmpdir | ||
| from integrationtest.verbosity_helper import IntegtestVerbosityLevels | ||
|
Check failure on line 17 in src/drunc/integtest/basic_multiapp_test.py
|
||
| from daqconf.utils import find_free_port | ||
|
|
||
| import functools | ||
| print = functools.partial(print, flush=True) # always flush print() output | ||
|
|
||
| pytest_plugins = "integrationtest.integrationtest_drunc" | ||
|
|
||
| # Values that help determine the running conditions | ||
| number_of_data_producers = 1 | ||
| run_duration = 20 # seconds | ||
|
|
||
| # Default values for validation parameters | ||
| expected_number_of_data_files = 1 | ||
| check_for_logfile_errors = True | ||
| expected_event_count = run_duration | ||
| expected_event_count_tolerance = 2 | ||
| wibeth_frag_params = { | ||
| "fragment_type_description": "WIBEth", | ||
| "fragment_type": "WIBEth", | ||
| "expected_fragment_count": number_of_data_producers, | ||
| "min_size_bytes": 14472, | ||
| "max_size_bytes": 21672, | ||
| } | ||
| triggercandidate_frag_params = { | ||
| "fragment_type_description": "Trigger Candidate", | ||
| "fragment_type": "Trigger_Candidate", | ||
| "expected_fragment_count": 1, | ||
| "min_size_bytes": 128, | ||
| "max_size_bytes": 216, | ||
| } | ||
| hsi_frag_params = { | ||
| "fragment_type_description": "HSI", | ||
| "fragment_type": "Hardware_Signal", | ||
| "expected_fragment_count": 1, | ||
| "min_size_bytes": 100, | ||
| "max_size_bytes": 100, | ||
| } | ||
| ignored_logfile_problems = { | ||
| "connectionservice": [ | ||
| "Searching for connections matching uid_regex<errored_frames_q> and data_type Unknown" | ||
| ], | ||
| "-controller": [ | ||
| "Worker with pid \\d+ was terminated due to signal 1", | ||
| "Connection '.*' not found on the application registry", | ||
| ], | ||
| "connectivity-service": [ | ||
| "errorlog: -", | ||
| ], | ||
| } | ||
|
|
||
| # Determine if this computer has enough resources for these tests | ||
| resource_validator = resource_validation.ResourceValidator() | ||
| resource_validator.cpu_count_needs(4, 8) # 2 for each data source plus 2 more for everything else | ||
| resource_validator.free_memory_needs(4, 6) # 33% more than what we observe being used ('free -h') | ||
| actual_output_path = get_pytest_tmpdir() | ||
| resource_validator.free_disk_space_needs(actual_output_path, 1) # more than what we observe | ||
|
|
||
| # The arguments to pass to the config generator, excluding the json | ||
| # output directory (the test framework handles that) | ||
|
|
||
| conf_dict = integtest_params_for_generated_dunedaq_config() | ||
| conf_dict.object_databases = ["config/daqsystemtest/integrationtest-objects.data.xml"] | ||
| conf_dict.dro_map_config.n_streams = number_of_data_producers | ||
| conf_dict.op_env = "integtest" | ||
| conf_dict.config_session_name = "smallfootprint" | ||
| conf_dict.tpg_enabled = False | ||
| utility_functions.enable_fake_hsi_trigger(conf_dict, trigger_rate=1.0) | ||
|
|
||
| conf_dict.config_substitutions.append( | ||
| attribute_substitution(obj_class="LatencyBuffer", updates={"size": 50000}) | ||
| ) | ||
|
|
||
| confgen_arguments = {"SmallFootprint": conf_dict} | ||
|
|
||
| # The commands to run in dunerc and the process manager shell | ||
| dunerc_commands_1 = ( | ||
| "boot conf start --run-number 101 wait 1 enable-triggers wait ".split() | ||
| + [str(run_duration)] + ["disable-triggers"] | ||
| ) | ||
| dunerc_commands_2 = ( | ||
| "drain-dataflow stop-trigger-sources stop wait 2 scrap terminate".split() | ||
| ) | ||
| pmshell_command = ["ps"] | ||
|
|
||
| # Find a free network port to use for the process manager | ||
| pm_port = find_free_port(50020, 52000) | ||
|
|
||
| # The command lines that should be used to start the applications | ||
| procmsg_startup_commands = ["drunc-process-manager", "<proc_mgr_choice>", str(pm_port)] | ||
| pmapp = DAQSessionApp("pm", procmsg_startup_commands) | ||
|
|
||
| pmshell_startup_commands = ["drunc-process-manager-shell", f"grpc://localhost:{pm_port}"] | ||
| pmshellapp = DAQSessionApp("pmshell", pmshell_startup_commands) | ||
|
|
||
| drunc_startup_commands = ["drunc-unified-shell", f"grpc://localhost:{pm_port}", "<config_data_file>", "<config_session_name>", "<daq_session_name>"] | ||
| druncapp = DAQSessionApp("drunc", drunc_startup_commands) | ||
|
|
||
| # Packaging up the commands into DAQCommandSets | ||
| cmd_set_1 = DAQCommandSet("drunc", dunerc_commands_1, CommandWaitParameters(style=CommandWaitStyle.ECHO)) | ||
| cmd_set_2 = DAQCommandSet("pmshell", pmshell_command, CommandWaitParameters(style=CommandWaitStyle.TIME)) | ||
| cmd_set_3 = DAQCommandSet("drunc", dunerc_commands_2, CommandWaitParameters(style=CommandWaitStyle.ECHO)) | ||
|
|
||
| # Putting everything together into a DAQSessionIngredients object | ||
| app_list = [ pmapp, pmshellapp, druncapp ] | ||
| cmd_set_list = [ cmd_set_1, cmd_set_2, cmd_set_3 ] | ||
| dsi = DAQSessionIngredients(app_list, cmd_set_list) | ||
|
|
||
| # Declare the special variable that tells the integrationtest infrastructure what we want to run | ||
| daq_session_ingredients = {"MultiRCAppSession": dsi} | ||
|
|
||
|
|
||
| # The tests themselves | ||
|
|
||
|
|
||
| def test_dunerc_success(run_dunerc, caplog): | ||
| # checks for run control success, problems during pytest setup, etc. | ||
| utility_functions.basic_checks(run_dunerc, caplog, print_test_name=False) | ||
|
|
||
|
|
||
| def test_log_files(run_dunerc): | ||
| if check_for_logfile_errors: | ||
| # Check that there are no warnings or errors in the log files | ||
| assert log_file_checks.logs_are_error_free( | ||
| run_dunerc.log_files, True, True, ignored_logfile_problems, | ||
| verbosity_helper=run_dunerc.verbosity_helper | ||
| ) | ||
|
|
||
|
|
||
| def test_data_files(run_dunerc): | ||
| # Run some tests on the output data file | ||
| assert len(run_dunerc.data_files) == expected_number_of_data_files | ||
|
|
||
| fragment_check_list = [triggercandidate_frag_params, hsi_frag_params] | ||
| fragment_check_list.append(wibeth_frag_params) # WIBEth | ||
|
|
||
| all_ok = True | ||
| for idx in range(len(run_dunerc.data_files)): | ||
| data_file = data_file_checks.DataFile(run_dunerc.data_files[idx], run_dunerc.verbosity_helper) | ||
| all_ok &= data_file_checks.sanity_check(data_file) | ||
| all_ok &= data_file_checks.check_file_attributes(data_file) | ||
| all_ok &= data_file_checks.check_event_count( | ||
| data_file, expected_event_count, expected_event_count_tolerance | ||
| ) | ||
| for jdx in range(len(fragment_check_list)): | ||
| all_ok &= data_file_checks.check_fragment_count( | ||
| data_file, fragment_check_list[jdx] | ||
| ) | ||
| all_ok &= data_file_checks.check_fragment_sizes( | ||
| data_file, fragment_check_list[jdx] | ||
| ) | ||
| assert all_ok | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a quick comment on this before I forget
#868 (recently merged) has introduced a bunch of new tests to drunc.
When this PR gets updated with respect to develop, can you also do the necessary find/replace on the new tests as well?