diff --git a/.cspell/project-words.txt b/.cspell/project-words.txt index 0541f5d2..1ea68898 100644 --- a/.cspell/project-words.txt +++ b/.cspell/project-words.txt @@ -28,6 +28,7 @@ hwmon indice ITLB jres +jumphost kwollect libdrm libgflags @@ -40,10 +41,13 @@ monitorable mpoint neowise niced +nohup +noninteractive nvme NVML oarstat oarsub +otpaas pagetables paradoxe PERFMON @@ -65,6 +69,7 @@ simplifiable slurm slurmstep slurmstepd +socat statm subconfig sublicensable diff --git a/integration-tests/README.md b/integration-tests/README.md new file mode 100644 index 00000000..9ab807fe --- /dev/null +++ b/integration-tests/README.md @@ -0,0 +1,122 @@ +# Alumet integration tests + +This folder contains all script files and scenarios for testing alumet on bare metal. +The structure of files is: + +```text + +├── README.md +├── run.sh +└── scenarios + ├── common + │   └── alumet_keywords.robot + ├── __init__.robot + ├── installation.robot + ├── plugin-perf.robot + ├── plugin-rapl.robot + ├── resources + │   ├── help-config-option.txt + │   ├── help-exec-option.txt + │   ├── help-option.txt + │   ├── help-plugins-option.txt + │   └── help-watch-option.txt + └── tools + └── cpu_load.sh +``` + +The scenarios (test suites) are located in scenarios folder. Robot framework is used to perform automatically the tests. Each suite test is a set of tests. +The test strategy is to write one robot framework file (a test suite) per alumet plugin and/or per features. + +The current version contains the following robot framework files: +- installation.robot: for testing installation of alumet (uninstallation is tested using the Suite Teardown) +- plugin-perf.robot: for testing perf plugin +- plugin-rapl.robot: for testing rapl plugin. + +The \_\_init\_\_.robot file contains the Suite Setup (Install Alumet) and Teardown (UnInstall Alumet). When this file is present, robot framework executes at the beginning of the tests the keyword `Install Alumet` and at the end of test execution the keyword `UnInstall alumet` + +Each test can have one or several tags allowing the exclusion of tests from being run by robot framework. + +Before executing the tests, you need to install [robot framework](https://docs.robotframework.org/docs/getting_started/testing#install-robot-framework-in-a-virtual-environment). +Then you need to initialize the robot framework virtual environment: + +```bash +source ~/venv-robot/bin/activate +(venv-robot) [zychlae@carbon0 integration_tests]$ +``` + +The script run.sh allows to execute the robot framework tests on a target node and with a target alumet's release and distribution. For that, you can modify the variables in run.sh script: + +```bash +# credentials used to logon on the target node +NODE=otpaas2 +USERNAME=emmanuel +KEY=${HOME}/.ssh/id_rsa +HOME_TEST=$(pwd) +# version of Alumet to installed +ALUMET_VERSION=0.9.4 +ALUMET_DISTRIBUTION=1_amd64_ubuntu_22.04 +``` + +Then you can execute your test: + +```bash +./run.sh +Start running tests at: Thu Jun 4 17:06:14 CEST 2026 +============================================================================== +Scenarios +============================================================================== +Scenarios.Installation :: Alumet installation / uninstallation +============================================================================== +Test connection on target node | PASS | +------------------------------------------------------------------------------ +install alumet | PASS | +------------------------------------------------------------------------------ +which alumet-agent | PASS | +------------------------------------------------------------------------------ +[...] +------------------------------------------------------------------------------ +Scenarios.Installation :: Alumet installation / uninstallation | FAIL | +9 tests, 8 passed, 1 failed +============================================================================== +Scenarios.Plugin-Perf :: Alumet test plugin perf +============================================================================== +Test connection on target node | PASS | +------------------------------------------------------------------------------ +run cpu_load | PASS | +------------------------------------------------------------------------------ +run plugin csv perf | PASS | +------------------------------------------------------------------------------ +check alumet running | PASS | +------------------------------------------------------------------------------ +Check Perf Metric perf_hardware_REF_CPU_CYCLES metric value read: 17688 +Check Perf Metric perf_hardware_REF_CPU_CYCLES | PASS | +------------------------------------------------------------------------------ +[...] +------------------------------------------------------------------------------ +Scenarios.Plugin-Perf :: Alumet test plugin perf | FAIL | +9 tests, 8 passed, 1 failed +============================================================================== +Scenarios.Plugin-Rapl :: Alumet test plugin rapl +============================================================================== +Test connection on target node | PASS | +------------------------------------------------------------------------------ +run plugins socket-control csv rapl | PASS | +------------------------------------------------------------------------------ +check alumet running | PASS | +------------------------------------------------------------------------------ +Check Rapl Metric package metric value read: 22.81256103515625 +Check Rapl Metric package | PASS | +------------------------------------------------------------------------------ +[...] +------------------------------------------------------------------------------ +Scenarios.Plugin-Rapl :: Alumet test plugin rapl | PASS | +9 tests, 9 passed, 0 failed +============================================================================== +Scenarios | FAIL | +27 tests, 25 passed, 2 failed +``` + +Robot framework generates a report and a log file in html format. + +To write a new test suite for an input plugin, you must use the `Check Metric` keyword to validate the csv output file. +You use plugin-rapl.robot as an example. diff --git a/integration-tests/run.sh b/integration-tests/run.sh new file mode 100755 index 00000000..57ec4e49 --- /dev/null +++ b/integration-tests/run.sh @@ -0,0 +1,55 @@ +#!/bin/bash +################################################################################################ +# this script launch robot framework tests on a target node +# Environment variables to set or modify: +# NODE: target node for executing robot framework test suites +# ALUMET_VERSION: alumet version to test +# ALUMET_DISTRIBUTION: alumet distribution to test +# +################################################################################################ + +#set -x + +# target node to install alumet +NODE=otpaas2 +# gateway or jumphost to connect to the target node +# it could be an alias name or IP address +GATEWAY=172.16.118.53 +# credentials used to logon on the target node +USERNAME=emmanuel +KEY=${HOME}/.ssh/id_rsa +HOME_TEST=$(pwd) + +# version of Alumet to installed +ALUMET_VERSION=0.9.4 +ALUMET_DISTRIBUTION=1_amd64_ubuntu_22.04 + + +# Before executed the tests, we need to activate robot framework with the following command +# we deactivate the CI check on file $HOME/venv-robot/bin/activate +# shellcheck disable=SC1091 +source "$HOME"/venv-robot/bin/activate + +# you can exclude some tests using option --exclude following by TAG name +# Available TAGs are : RAPL_PLUGIN, PERF_PLUGIN, INPUT_PLUGIN, INSTALLATION + +echo "Start running tests at: $(date)" + +robot -v "NODE:$NODE" \ + -v "GATEWAY:$GATEWAY" \ + -v "USERNAME:$USERNAME" \ + -v "KEY:$KEY" \ + -v "HOME_TEST:$HOME_TEST" \ + -v "ALUMET_VERSION:$ALUMET_VERSION" \ + -v "ALUMET_DISTRIBUTION:$ALUMET_DISTRIBUTION" \ + --metadata "Test are executed on node $NODE with alumet $ALUMET_VERSION $ALUMET_DISTRIBUTION" \ + scenarios/ + +echo "End running tests at: $(date)" + +# other tags defined on tests that can be exclude + # --exclude INSTALLATION \ + # --exclude PERF_PLUGIN \ + # --exclude INPUT_PLUGIN \ + # --exclude RAPL_PLUGIN \ + # --exclude INSTALLATION \ \ No newline at end of file diff --git a/integration-tests/scenarios/__init__.robot b/integration-tests/scenarios/__init__.robot new file mode 100644 index 00000000..d9948b96 --- /dev/null +++ b/integration-tests/scenarios/__init__.robot @@ -0,0 +1,8 @@ +*** Settings *** +Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot + +Suite Setup Install Alumet +Suite Teardown UnInstall Alumet + + +*** Variables *** \ No newline at end of file diff --git a/integration-tests/scenarios/common/alumet_keywords.robot b/integration-tests/scenarios/common/alumet_keywords.robot new file mode 100644 index 00000000..ca664642 --- /dev/null +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -0,0 +1,268 @@ +*** Settings *** +Library OperatingSystem +Library SSHLibrary + +*** Variables *** + + +*** Keywords *** + +######################################################################################################## +# Compare values Percent +# Compare 2 values with a precision expressed as a % +# input parameters: +# value1 +# value2 +# precision in % +# +# return parameter: +# boolean: true if value1 = value2 according the precision +# +######################################################################################################## +Compare Values Percent + [Arguments] ${value1} ${value2} ${percent} + + ${diff}= Evaluate abs(${value1}-${value2})/${value1}*100 + ${result}= Evaluate ${diff} < ${percent} + + [Return] ${result} +######################################################################################################## +# Execute Command Target Node +# Connect to a target node and execute a command on this node +# input parameters: +# Command: the command to execute on remote host +# +# Return parameters: +# stdout of the command executed +# +# Note that to connect to login, the following variables must be set as global: +# ${NODE} : Node where alumet is installed +# ${USERNAME} : username to open the ssh connection +# ${KEY} : ssh key to open the ssh connection +# +######################################################################################################## +Execute Command Target Node + [Arguments] ${Command} + + Open Connection ${GATEWAY} alias=jumphost + Login With Public Key ${USERNAME} ${KEY} + + Open Connection ${NODE} + + Login With Public Key ${USERNAME} ${KEY} + ... jumphost_index_or_alias=jumphost + + + ${stdout} ${stderr} ${rc}= Execute Command ${Command} + ... timeout=30s + ... return_stdout=True + ... return_stderr=True + ... return_rc=True + # ... output_during_execution=True # to get more debug information uncomment this line + + Log Result stdout : ${stdout} + Log Result stderr : ${stderr} + Log Result return code : ${rc} + + + Close All Connections + + [Return] ${stdout} ${stderr} + +######################################################################################################## +# Install Alumet +# Connect to a target node and install alumet +# input parameters: +# None +# +# Return parameters: +# stdout of the command executed +# +# Note that to connect to login, the following variables must be set as global: +# ${NODE} : Node where alumet is installed +# ${USERNAME} : username to open the ssh connection +# ${KEY} : ssh key to open the ssh connection +# ${ALUMET_VERSION} : alumet version +# ${ALUMET_DISTRIBUTION} : alumet distribution +# +######################################################################################################## +Install Alumet + + # first download the right linux package file, exit test suite if download error + ${output}= Run wget https://github.com/alumet-dev/alumet/releases/download/v${ALUMET_VERSION}/alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + ${exists}= Run Keyword And Return Status OperatingSystem.File Should Exist alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + Run Keyword If ${exists}==False Fail 'Error downloading alumet package file. Test suite is stopped' + + + Open Connection ${GATEWAY} alias=jumphost + Login With Public Key ${USERNAME} ${KEY} + + Open Connection ${NODE} + + Login With Public Key ${USERNAME} ${KEY} + ... jumphost_index_or_alias=jumphost + + # create tmp directory to put all required files on target node + + # copy linux package on remote host + Put File alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + + # copy tools files + Put File scenarios/tools/cpu_load.sh cpu_load.sh + + # install alumet package + ${output} ${stderr}= Execute Command Target Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + + # check il installation ok + ${result} ${stderr}= Execute Command Target Node apt list --installed alumet-agent + + # cancel test suite if installation failed + ${exists}= Run Keyword And Return Status Should Contain ${result} alumet + Run Keyword If ${exists}==False Fail 'Error installing alumet. Test suite is stopped' + + ${exists}= Run Keyword And Return Status should Contain ${result} ${ALUMET_VERSION} + Run Keyword If ${exists}==False Fail 'Error installing alumet. Test suite is stopped' + + Close All Connections + + [Return] ${output} + +######################################################################################################## +# UnInstall Alumet +# Connect to a target node and uninstall alumet +# input parameters: +# None +# +# Return parameters: +# stdout of the command executed +# +# Note that to connect to login, the following variables must be set as global: +# ${NODE} : Node where alumet is installed +# ${USERNAME} : username to open the ssh connection +# ${KEY} : ssh key to open the ssh connection +# ${ALUMET_VERSION} : alumet version +# ${ALUMET_DISTRIBUTION} : alumet distribution +# +######################################################################################################## +UnInstall Alumet + + ${output} ${stderr}= Execute Command Target Node sudo DEBIAN_FRONTEND=noninteractive apt purge -y alumet-agent + + ${result} ${stderr}= Execute Command Target Node apt list --installed alumet-agent + + Should Not Contain ${result} alumet + + # remove alumet-output.csv file + ${result} ${stderr}= Execute Command Target Node rm alumet-output.csv + + # remove alumet package file on target node + ${result} ${stderr}= Execute Command Target Node rm alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* + + ${result} ${stderr}= Execute Command Target Node ls -l alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* + + Should Not Contain ${result} alumet + + # remove alumet package file downloaded locally + ${result}= Run rm alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* + ${result}= Run ls -l alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* + Should Contain ${result} cannot access + + # remove cpu_load.* + ${result} ${stderr}= Execute Command Target Node rm cpu_load.* + ${result} ${stderr}= Execute Command Target Node ls -l cpu_load.* + Should Contain ${stderr} cannot access + + + [Return] ${output} + +######################################################################################################## +# Read resource_kind column +# Connect to a target node and read the column resource_kind of alumet-output.csv file. +# input parameters: +# metric: metric name to parse +# domain: domain name +# +# Return parameters: +# stdout of the command executed +# +# Note that to connect to login, the following variables must be set as global: +# ${NODE} : Node where alumet is installed +# ${USERNAME} : username to open the ssh connection +# ${KEY} : ssh key to open the ssh connection +# +######################################################################################################## +Read resource_kind + [Arguments] ${metric} ${domain}=${EMPTY} + + # the metric resource_kind is on 4th column + IF '${domain}' != '' + ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $8 == "${domain}" { OFS="|"; print $4 }' + ELSE + ${command}= Set variable grep ${metric} alumet-output.csv + END + + ${output} ${stderr}= Execute Command Target Node ${command} + + [Return] ${output} + +######################################################################################################## +# Read value column +# Connect to a target node and read the metric value on the first line of alumet-output.csv file. +# input parameters: +# metric: metric name to parse +# resource_kind: resource kind name +# domain: domain name +# +# Return parameters: +# stdout metric value +# +# Note that to connect to login, the following variables must be set as global: +# ${NODE} : Node where alumet is installed +# ${USERNAME} : username to open the ssh connection +# ${KEY} : ssh key to open the ssh connection +# +######################################################################################################## +Read value + [Arguments] ${metric} ${resource_kind} ${domain}=${EMPTY} + + IF '${domain}' != '' + ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $8 == "${domain}" && $4 == "${resource_kind}" { OFS="|"; print $3 }' | sed -n '1p' + ELSE + ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $4 == "${resource_kind}" { OFS="|"; print $3 }' | sed -n '1p' + END + + + # the metric value is on 3rd column + ${output} ${stderr}= Execute Command Target Node ${command} + Log To Console metric value read: ${output} + + [Return] ${output} + +######################################################################################################## +# check Metric +# Connect to a target node and check metric using the 2 keywords: +# Read resource_kind +# Read Value +# +# input parameters: +# metric: metric name to parse +# resource_kind: resource kind +# domain: domain name +# +# Return parameters: +# stdout metric value +# +# Note that to connect to login, the following variables must be set as global: +# ${NODE} : Node where alumet is installed +# ${USERNAME} : username to open the ssh connection +# ${KEY} : ssh key to open the ssh connection +# +######################################################################################################## +Check Metric + [Arguments] ${metric} ${resource_kind} ${domain}=${EMPTY} + + ${output}= Read resource_kind ${metric} ${domain} + Should Contain ${output} ${resource_kind} + + ${output}= Read value ${metric} ${resource_kind} ${domain} + Should Be True ${output} !=0.0 \ No newline at end of file diff --git a/integration-tests/scenarios/installation.robot b/integration-tests/scenarios/installation.robot new file mode 100644 index 00000000..16f5f626 --- /dev/null +++ b/integration-tests/scenarios/installation.robot @@ -0,0 +1,114 @@ +*** Settings *** +Documentation Alumet installation / uninstallation +Library OperatingSystem +Library SSHLibrary +Library String +Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot + +Suite Setup Log Test are running on cluster: ${NODE} level=INFO + +Test timeout 180 seconds + +*** Keywords *** + +*** Variables *** + +# variables related to JOB submission +# ${Command}= ${HOME_TEST}/tools/cpu_load.sh 10 + +*** Test Cases *** +Test connection on target node + [Tags] INSTALLATION + + ${output} ${stderr}= Execute Command Target Node hostname + Log Output Result of SSH : ${output} + +*** Test Cases *** +install alumet + [Tags] INSTALLATION + + # Alumet is already installed by Suite Setup + # we check only if installed version is right + + ${result} ${stderr}= Execute Command Target Node apt list --installed alumet-agent + Log Result stdout : ${result} + + Should Contain ${result} alumet + should Contain ${result} ${ALUMET_VERSION} + +*** Test Cases *** +which alumet-agent + [Tags] INSTALLATION + + ${output} ${stderr}= Execute Command Target Node which alumet-agent + Log Result stdout : ${output} + + Should Contain ${output} /usr/bin/alumet-agent + +*** Test Cases *** +help option + [Tags] INSTALLATION + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-option.txt + + ${output} ${stderr}= Execute Command Target Node alumet-agent -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help exec option + [Tags] INSTALLATION + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-exec-option.txt + + ${output} ${stderr}= Execute Command Target Node alumet-agent exec -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help plugins option + [Tags] INSTALLATION + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-plugins-option.txt + + ${output} ${stderr}= Execute Command Target Node alumet-agent plugins -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help watch option + [Tags] INSTALLATION + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-watch-option.txt + + ${output} ${stderr}= Execute Command Target Node alumet-agent watch -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help config option + [Tags] INSTALLATION + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-config-option.txt + + ${output} ${stderr}= Execute Command Target Node alumet-agent config -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +config regen + [Tags] INSTALLATION + + ${output} ${stderr}= Execute Command Target Node alumet-agent config regen + Log Result stdout : ${output} + + Should Contain ${output} Default configuration file written to: /etc/alumet/alumet-config.toml + + + + diff --git a/integration-tests/scenarios/plugin-perf.robot b/integration-tests/scenarios/plugin-perf.robot new file mode 100644 index 00000000..63a71e4d --- /dev/null +++ b/integration-tests/scenarios/plugin-perf.robot @@ -0,0 +1,87 @@ +*** Settings *** +Documentation Alumet test plugin perf +Library OperatingSystem +Library SSHLibrary +Library String +Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot + + +Test timeout 60 seconds + +*** Keywords *** + +*** Variables *** + +# variables related to JOB submission +# ${Command}= ${HOME_TEST}/tools/cpu_load.sh 10 + +*** Test Cases *** +Test connection on target node + [Tags] INPUT_PLUGIN PERF_PLUGIN + + ${output} ${stderr}= Execute Command Target Node hostname + Log Output Result of SSH : ${output} + +*** Test Cases *** +run cpu_load + [Tags] INPUT_PLUGIN PERF_PLUGIN + + ${output} ${stderr}= Execute Command Target Node nohup ./cpu_load.sh 20 > /dev/null 2>&1 & + Sleep 3s + +*** Test Cases *** +run plugin csv perf + [Tags] INPUT_PLUGIN PERF_PLUGIN + + ${output} ${stderr}= Execute Command Target Node alumet-agent --plugins csv,perf watch "$(cat cpu_load.sh.pid)" > /tmp/alumet.log 2>&1 & + Sleep 3s + + ${output_alumet} ${stderr}= Execute Command Target Node cat /tmp/alumet.log + Log Result stdout : ${output_alumet} + + # Should Contain ${output_alumet} ${expected_started_plugins} + Should Contain ${output_alumet} 2 plugins started + Should Contain ${output_alumet} csv v0.2.0 + Should Contain ${output_alumet} perf v0.1.0 + +*** Test Cases *** +check alumet running + [Tags] INPUT_PLUGIN PERF_PLUGIN + + ${output} ${stderr}= Execute Command Target Node ps -f -u ${USERNAME} + Log Result stdout : ${output} + + Should Contain ${output} /usr/lib/alumet-agent --plugins csv,perf + +*** Test Cases *** +Check Perf Metric perf_hardware_REF_CPU_CYCLES + [Template] Check Metric + [Tags] INPUT_PLUGIN PERF_PLUGIN + + # ${metric} ${resource_kind} ${domain} + perf_hardware_REF_CPU_CYCLES local_machine + +Check Perf Metric perf_hardware_CACHE_MISSES + [Template] Check Metric + [Tags] INPUT_PLUGIN PERF_PLUGIN + + # ${metric} ${resource_kind} ${domain} + perf_hardware_CACHE_MISSES local_machine + +Check Perf Metric perf_hardware_BRANCH_MISSES + [Template] Check Metric + [Tags] INPUT_PLUGIN PERF_PLUGIN + + # ${metric} ${resource_kind} ${domain} + perf_hardware_BRANCH_MISSES local_machine + + +*** Test Cases *** +Check alumet not running + [Tags] INPUT_PLUGIN PERF_PLUGIN + + ${output} ${stderr}= Execute Command Target Node ps -f -u ${USERNAME} + + Should Not Contain ${output} alumet-agent + + diff --git a/integration-tests/scenarios/plugin-rapl.robot b/integration-tests/scenarios/plugin-rapl.robot new file mode 100644 index 00000000..aa60c4f3 --- /dev/null +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -0,0 +1,108 @@ +*** Settings *** +Documentation Alumet test plugin rapl +Library OperatingSystem +Library SSHLibrary +Library String +Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot +# Test Template Check Metric +Test timeout 60 seconds + +*** Keywords *** + + +*** Variables *** + +# variables related to JOB submission +# ${Command}= ${HOME_TEST}/tools/cpu_load.sh 10 + +*** Test Cases *** +Test connection on target node + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + ${output} ${stderr}= Execute Command Target Node hostname + Log Output Result of SSH : ${output} + +*** Test Cases *** +run plugins socket-control csv rapl + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + ${output} ${stderr}= Execute Command Target Node alumet-agent --plugins csv,rapl,socket-control > /tmp/alumet.log 2>&1 & + Sleep 3s + + ${output_alumet} ${stderr}= Execute Command Target Node cat /tmp/alumet.log + Log Result stdout : ${output_alumet} + + # Should Contain ${output_alumet} ${expected_started_plugins} + Should Contain ${output_alumet} 3 plugins started + Should Contain ${output_alumet} csv v0.2.0 + Should Contain ${output_alumet} socket-control v0.2.1 + Should Contain ${output_alumet} rapl v0.3.1 + +*** Test Cases *** +check alumet running + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + ${output} ${stderr}= Execute Command Target Node ls alumet-control.sock + Log Result stdout : ${output} + + Should Contain ${output} alumet-control.sock + + ${output} ${stderr}= Execute Command Target Node ps -f -u ${USERNAME} + Log Result stdout : ${output} + + Should Contain ${output} /usr/lib/alumet-agent --plugins csv,rapl,socket-control + + ${result}= Compare values percent 100 105 8 + + Should Be True ${result} + +*** Test Cases *** +Check Rapl Metric package + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${resource_kind} ${domain} + rapl_consumed_energy_J cpu_package package + +Check Rapl Metric package_total + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${resource_kind} ${domain} + rapl_consumed_energy_J local_machine package_total + +Check Rapl Metric dram + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${resource_kind} ${domain} + rapl_consumed_energy_J dram dram + +Check Rapl Metric dram_total + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${resource_kind} ${domain} + rapl_consumed_energy_J local_machine dram_total + +*** Test Cases *** +stop alumet + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + ${output} ${stderr}= Execute Command Target Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + Log Result stdout : ${output} + + ${output} ${stderr}= Execute Command Target Node ls alumet-control.sock + + Should Not Contain ${output} alumet-control.sock + +*** Test Cases *** +Check alumet not running + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + ${output}= Execute Command Target Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + Log Result stdout : ${output} + + ${output} ${stderr}= Execute Command Target Node ls alumet-control.sock + + Should Not Contain ${output} alumet-control.sock + + ${output} ${stderr}= Execute Command Target Node ps -f -u ${USERNAME} + + Should Not Contain ${output} alumet-agent \ No newline at end of file diff --git a/integration-tests/scenarios/resources/help-config-option.txt b/integration-tests/scenarios/resources/help-config-option.txt new file mode 100644 index 00000000..f53a006b --- /dev/null +++ b/integration-tests/scenarios/resources/help-config-option.txt @@ -0,0 +1,10 @@ +Manipulate the configuration + +Usage: alumet-agent config + +Commands: + regen Regenerate the configuration file and stop + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help \ No newline at end of file diff --git a/integration-tests/scenarios/resources/help-exec-option.txt b/integration-tests/scenarios/resources/help-exec-option.txt new file mode 100644 index 00000000..0b32d649 --- /dev/null +++ b/integration-tests/scenarios/resources/help-exec-option.txt @@ -0,0 +1,11 @@ +Execute a command and observe its process + +Usage: alumet-agent exec [OPTIONS] [ARGS]... + +Arguments: + The program to run + [ARGS]... Arguments to the program + +Options: + --ignore-exit-code If set, don't propagate the exit code of the executed program + -h, --help Print help (see more with '--help') \ No newline at end of file diff --git a/integration-tests/scenarios/resources/help-option.txt b/integration-tests/scenarios/resources/help-option.txt new file mode 100644 index 00000000..ff6a11dc --- /dev/null +++ b/integration-tests/scenarios/resources/help-option.txt @@ -0,0 +1,39 @@ +Alumet standard agent: measure energy and performance metrics + +Usage: alumet-agent [OPTIONS] [COMMAND] + +Commands: + run Run the agent and monitor the system + exec Execute a command and observe its process + watch Watch a PID and observe it until its end + config Manipulate the configuration + plugins Get plugins information + help Print this message or the help of the given subcommand(s) + +Options: + --config + Path to the config file [env: ALUMET_CONFIG=/etc/alumet/alumet-config.toml] [default: alumet-config.toml] + --no-default-config + If set, the config file must exist, otherwise the agent will fail to start with an error + --config-override + Config options overrides + --plugins + List of plugins to enable, separated by commas, ex. `csv,rapl` + --max-update-interval + Maximum amount of time between two updates of the sources' commands + --source-channel-size + How many `MeasurementBuffer`s can be stored in the channel that sources write to + --normal-worker-threads + How many "normal" worker threads to spawn [env: ALUMET_NORMAL_THREADS=] + --priority-worker-threads + How many "high-priority" worker threads to spawn [env: ALUMET_PRIORITY_THREADS=] + --output-file + Path to the output file (CSV plugin) + --relay-out + Address and port of the server to connect to with the relay client (relay-client plugin) + --relay-in + Address and/or port that the relay server should listen to (relay-server plugin) + -h, --help + Print help (see more with '--help') + -V, --version + Print version \ No newline at end of file diff --git a/integration-tests/scenarios/resources/help-plugins-option.txt b/integration-tests/scenarios/resources/help-plugins-option.txt new file mode 100644 index 00000000..a6a09779 --- /dev/null +++ b/integration-tests/scenarios/resources/help-plugins-option.txt @@ -0,0 +1,11 @@ +Get plugins information + +Usage: alumet-agent plugins [OPTIONS] + +Commands: + list Print the available plugins + help Print this message or the help of the given subcommand(s) + +Options: + --status Reads the agent config to get the status (enabled/disabled) of each plugin + -h, --help Print help \ No newline at end of file diff --git a/integration-tests/scenarios/resources/help-watch-option.txt b/integration-tests/scenarios/resources/help-watch-option.txt new file mode 100644 index 00000000..7946b156 --- /dev/null +++ b/integration-tests/scenarios/resources/help-watch-option.txt @@ -0,0 +1,9 @@ +Watch a PID and observe it until its end + +Usage: alumet-agent watch + +Arguments: + The PID to watch + +Options: + -h, --help Print help \ No newline at end of file diff --git a/integration-tests/scenarios/tools/cpu_load.sh b/integration-tests/scenarios/tools/cpu_load.sh new file mode 100755 index 00000000..03b4c242 --- /dev/null +++ b/integration-tests/scenarios/tools/cpu_load.sh @@ -0,0 +1,40 @@ +#!/bin/bash +################################################################################################ +# This script executes a very simple loop for cpu load. +# It calculate the Fibonacci suite: sigma 0 to N during the input period in seconds. +# +# It takes 1 input argument: +# 1. duration jobs in seconds +################################################################################################ +export HOST=$(hostname) +date +echo "PID $0: $$" +echo "$$" > $0.pid +echo "running load script on host: $HOST" + +if [ $# -lt 1 ] + then + echo "Parameters required :" + echo "Missing input parameter: duration of load script in seconds" + exit 2 +fi + + +N=$1 + +i=0 +result=0 + +start=$(date +%s) # start timestamp (seconds since Epoch) + +while (( $(date +%s) - start < N )); do + # ---- below the cpu load code ---- + i=$((i+1)) + result=$(($result+i)) + echo -e "$(date +%T): \u03A3 $i = $result" + tput cuu1 + # ------------------------- +done + +echo -e "\n \u03A3 $i = $result" +echo -e "\n $(date)" \ No newline at end of file