Skip to content

Implement test command monitor#57

Open
okt-osadakov wants to merge 7 commits into
oktetlabs:mainfrom
okt-osadakov:user/ark-oleg/test_command_monitor
Open

Implement test command monitor#57
okt-osadakov wants to merge 7 commits into
oktetlabs:mainfrom
okt-osadakov:user/ark-oleg/test_command_monitor

Conversation

@okt-osadakov

Copy link
Copy Markdown

This branch is used to add new feature "test" command monitor. The main idea of this feature is to run a common test in parallel with another tests.

For example we can:

  • run a stress test in parallel with generic function tests or
  • collect statistics on test side using this monitor or
  • something else.

To enable this feature we should add <command_monitor> with <script> to package.xml, e.g:

<session>
    <command_monitor>
        <script name="test_monitor"/>
    </command_monitor>
    ...

Testing done:

.../run.sh --cfg=localhost --tester-run=ts/monitors
...
--->>> Starting Logger...done
--->>> Starting RCF...done
--->>> Starting Configurator...done
--->>> Start Tester
Starting package ts
Starting test prologue                        pass
Starting package monitors
Starting test trivial                         pass
Starting test trivial                         pass
Starting test trivial                         pass
Starting test trivial                         pass
Starting test trivial                         pass
Done package monitors pass
Done package ts pass
--->>> Shutdown Configurator...done
--->>> Flush Logs
--->>> Shutdown RCF...done
--->>> Shutdown Logger...done
--->>> Logs conversion...done

Run (total)                               6
  Passed, as expected                     5
  Failed, as expected                     0
  Passed unexpectedly                     1
  Failed unexpectedly                     0
  Aborted (no useful result)              0
  New (expected result is not known)      0
Not Run (total)                         154
  Skipped, as expected                    0
  Skipped unexpectedly                    0

The second test contains the following log:

7	RING	trivial		Self	00:44:15.319	Test iteration #0
8	RING	trivial		Self	00:44:15.319	Sleeping 100 milliseconds: between test iteration
9	RING	test_mon	Self	00:44:15.390	Test iteration #4
10	RING	test_mon	Self	00:44:15.390	Sleeping 100 milliseconds: between test iteration
11	RING	trivial		Self	00:44:15.419	Test iteration #1
12	RING	trivial		Self	00:44:15.419	Sleeping 100 milliseconds: between test iteration
13	RING	test_mon	Self	00:44:15.490	Test iteration #5
14	RING	test_mon	Self	00:44:15.490	Sleeping 100 milliseconds: between test iteration

This log contains two independent Entity Names (one from test another from monitor) with independent test iteration counters.

@okt-osadakov okt-osadakov force-pushed the user/ark-oleg/test_command_monitor branch from 767e106 to 76466ce Compare October 29, 2024 10:15
Comment thread engine/tester/config_parse.c Outdated
Comment thread engine/tester/config_parse.c
Comment thread engine/tester/config_parse.c
Comment thread engine/tester/config_parse.c
Comment thread engine/tester/config_parse.c
Comment thread engine/tester/tester_cmd_monitor.c
Comment thread engine/tester/tester_cmd_monitor.c Outdated
Comment thread engine/tester/config_parse.c
Comment thread engine/tester/config_parse.c
@ol-dmitryiz

Copy link
Copy Markdown
Contributor

I am not sure commit log is right for the third commit.

"Currently we have only log messages and syntax to have script node inside
command_monitor node from any package.xml..."

Perhaps you wanted to say that you add support for this new syntax?

Comment thread engine/tester/config_parse.c
Comment thread engine/tester/tester_cmd_monitor.c Outdated
@ol-andrewr ol-andrewr self-assigned this Dec 23, 2024
Handle correctly command node at the end of command_monitor node.
Before this change we will have:
> monitor_process(): unexpected node name 'command' encountered

with the following command_monitor node in package.xml:
> <command_monitor>
>     <command>.../monitor</command>
> </command_monitor>

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
Add type to command monitor description to support more monitors. For example
we can use the same structure to start command monitor as a test in parallel
with another tests.

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
This patch adds only log messages and syntax to have script node inside
command_monitor node from any package.xml, e.g:

>    <session>
>        <command_monitor>
>            <script name="test_monitor"/>
>        </command_monitor>
>        ...

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
Use tester_cfg to generate full command for test command monitor.

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
Implement ability to start test based command monitor. Tester starts this
monitor with TE_LOG_ID_UNDEFINED as te_test_id. This is useful to merge log
from this monitor inside tests running in parallel.

But the default behaviour of TEST_START is to stop the test for this ID.
So you have to update your test to take it into account.

At the end of related session tester will send SIGUSR1 signal to this monitor.

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
Use te_test_name to check that test without te_test_id is a monitor.
Test based command monitor uses TE_LOG_ID_UNDEFINED to add logs from this
monitor inside tests running in parallel. But the default behaviour of
TEST_START is to stop the test for this ID.

But any command monitor has a special name ("tester_monitorX" where X is the
ordinal number of monitor). We can use this name to avoid EXIT_FAILURE for
monitors.

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
Create monitors package to validate command monitors.
In fact currently we have two independent types:
- TA: to run on test agent;
- TEST: to run in parallel with the common tests.

This patch contains only couple runs to validate the command monitor behavior
with TEST type.

Signed-off-by: Oleg Sadakov <Oleg.Sadakov@arknetworks.am>
@okt-osadakov okt-osadakov force-pushed the user/ark-oleg/test_command_monitor branch from 76466ce to 29addf4 Compare October 7, 2025 06:58
@okt-kostik

Copy link
Copy Markdown
Contributor

Any feedback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants