From 0953089d5d50294859cf03f682a073f3d2cdb033 Mon Sep 17 00:00:00 2001 From: emmanuel zychla Date: Fri, 29 May 2026 10:46:57 +0200 Subject: [PATCH 1/6] test: add E2E robot framework integration tests BRSED-1342 --- .cspell/project-words.txt | 4 + integration-tests/README.md | 54 ++++++ integration-tests/run.sh | 48 +++++ .../scenarios/common/alumet_keywords.robot | 166 +++++++++++++++++ .../scenarios/installation.robot | 141 ++++++++++++++ integration-tests/scenarios/plugin-perf.robot | 116 ++++++++++++ integration-tests/scenarios/plugin-rapl.robot | 173 ++++++++++++++++++ .../resources/help-config-option.txt | 10 + .../scenarios/resources/help-exec-option.txt | 11 ++ .../scenarios/resources/help-option.txt | 39 ++++ .../resources/help-plugins-option.txt | 11 ++ .../scenarios/resources/help-watch-option.txt | 9 + 12 files changed, 782 insertions(+) create mode 100644 integration-tests/README.md create mode 100755 integration-tests/run.sh create mode 100644 integration-tests/scenarios/common/alumet_keywords.robot create mode 100644 integration-tests/scenarios/installation.robot create mode 100644 integration-tests/scenarios/plugin-perf.robot create mode 100644 integration-tests/scenarios/plugin-rapl.robot create mode 100644 integration-tests/scenarios/resources/help-config-option.txt create mode 100644 integration-tests/scenarios/resources/help-exec-option.txt create mode 100644 integration-tests/scenarios/resources/help-option.txt create mode 100644 integration-tests/scenarios/resources/help-plugins-option.txt create mode 100644 integration-tests/scenarios/resources/help-watch-option.txt diff --git a/.cspell/project-words.txt b/.cspell/project-words.txt index 0541f5d2..e886d26b 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,12 @@ monitorable mpoint neowise niced +noninteractive nvme NVML oarstat oarsub +otpaas pagetables paradoxe PERFMON @@ -65,6 +68,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..384cf0e5 --- /dev/null +++ b/integration-tests/README.md @@ -0,0 +1,54 @@ +# Alumet integration tests + +This folder contains all script files and scenarios for testing alumet on bare metal. + +The scenarios ( a test suite) 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. +Each test is tag allowing to exclude tests to during the execution with robot framework. + +Before executing the tests, you need to install robot framework. +After you need to initialize the robot framework environment: + +```bash + source ~/venv-robot/bin/activate +(venv-robot) [zychlae@carbon0 integration_tests]$ +``` + +A script run.sh allows to execute the robot framework tests on a target node. + +Then you can execute your test: + +```bash +============================================================================== +Plugin-Rapl :: Alumet test plugin rapl +============================================================================== +Test connection on target node | PASS | +------------------------------------------------------------------------------ +install alumet | PASS | +------------------------------------------------------------------------------ +run plugins socket-control csv rapl | PASS | +------------------------------------------------------------------------------ +check alumet running | PASS | +------------------------------------------------------------------------------ +check metric rapl_consumed_energy_J resource cpu_package domain pa... ..metric value read: 29.18206787109375 +check metric rapl_consumed_energy_J resource cpu_package domain pa... | PASS | +------------------------------------------------------------------------------ +check metric rapl_consumed_energy_J resource cpu_package domain pa... ..metric value read: 52.879150390625 +check metric rapl_consumed_energy_J resource cpu_package domain pa... | PASS | +------------------------------------------------------------------------------ +check metric rapl_consumed_energy_J resource dram domain dram ..metric value read: 3.3978118896484375 +check metric rapl_consumed_energy_J resource dram domain dram | PASS | +------------------------------------------------------------------------------ +check metric rapl_consumed_energy_J resource dram domain dram_total ..metric value read: 6.769805908203125 +check metric rapl_consumed_energy_J resource dram domain dram_total | PASS | +------------------------------------------------------------------------------ +stop alumet | PASS | +------------------------------------------------------------------------------ +Check alumet not running | PASS | +------------------------------------------------------------------------------ +Plugin-Rapl :: Alumet test plugin rapl | PASS | +10 tests, 10 passed, 0 failed +============================================================================== +``` + +The robot framework generates a report and log file in html format. \ No newline at end of file diff --git a/integration-tests/run.sh b/integration-tests/run.sh new file mode 100755 index 00000000..0344179e --- /dev/null +++ b/integration-tests/run.sh @@ -0,0 +1,48 @@ +#!/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 +# +################################################################################################ + +#set -x + +# 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-1 +ALUMET_DISTRIBUTION=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 : CPU, GPU, LOW, HIGH + +echo "Start running tests at: $(date)" + +robot -v "NODE:localhost" \ + -v "USERNAME:$USERNAME" \ + -v "KEY:$KEY" \ + -v "NODE:$NODE" \ + -v "HOME_TEST:$HOME_TEST" \ + -v "ALUMET_VERSION:$ALUMET_VERSION" \ + -v "ALUMET_DISTRIBUTION:$ALUMET_DISTRIBUTION" \ + --metadata "Test are executed on node $NODE" \ + scenarios/plugin-rapl.robot + +echo "End running tests at: $(date)" + +# other tags defined on tests that can be exclude + # --exclude CPU \ + # --exclude GPU \ + # --exclude LOW \ + # --exclude HIGH \ \ 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..6a68d0b2 --- /dev/null +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -0,0 +1,166 @@ +*** Settings *** +Library OperatingSystem +Library SSHLibrary + +*** Variables *** + + +*** Keywords *** + +######################################################################################################## +# Compare values +# Compare 2 values with a precision of N decimals +# input parameters: +# value1 +# value2 +# +# return parameter: +# boolean: true if value1 = value2 according the precision +# +######################################################################################################## +Compare Values + [Arguments] ${value1} ${value2} ${NbDecimal} + + ${precision}= Evaluate 10 ** -${NbDecimal} + ${diff}= Evaluate abs(round(${value1}, ${NbDecimal}) - round(${value2}, ${NbDecimal})) + ${diff_str}= Evaluate str(${diff}) + Log To Console difference: ${diff_str} + + ${result}= Evaluate ${diff} < ${precision} + + [Return] ${result} + +######################################################################################################## +# Compare values percent +# Compare 2 values with a precision of N decimals +# input parameters: +# value1 +# value2 +# +# 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 on 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 Alumet Node + [Arguments] ${Command} + + Open Connection 172.16.118.53 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} + + +######################################################################################################## +# Install Alumet +# Connect to a target node and execute a command on this node +# 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 +# +######################################################################################################## +Install Alumet + + ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb + + [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} + + # the metric resource_kind is on 4th column + # ${output}= Execute Command Alumet Node grep ${metric} alumet-output.csv | grep ${domain} | awk -F ';' '{print $4}' + ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $8 == "${domain}" { OFS="|"; print $4 }' + ${output}= Execute Command Alumet 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 +# 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} ${consumer_kind} ${domain} + + # the metric value is on 3rd column + ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $8 == "${domain}" && $4 == "${consumer_kind}" { OFS="|"; print $3 }' + ${output}= Execute Command Alumet Node grep ${metric} alumet-output.csv | grep ${domain} | awk -F ';' '{print $3}' | sed -n '1p' + Log To Console metric value read: ${output} + + [Return] ${output} \ 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..c74c782e --- /dev/null +++ b/integration-tests/scenarios/installation.robot @@ -0,0 +1,141 @@ +*** 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 *** +Display current date + ${date}= Get Time result_format=%Y-%m-%d %H:%M:%S + Log To Console Current date : ${date} + +*** Variables *** + +# variables related to JOB submission +# ${Command}= ${HOME_TEST}/tools/cpu_load.sh 10 + +*** Test Cases *** +Test connection on target node + [Tags] + + Open Connection 172.16.118.53 alias=jumphost + Login With Public Key ${USERNAME} ${KEY} + + Open Connection ${NODE} + + Login With Public Key ${USERNAME} ${KEY} + ... jumphost_index_or_alias=jumphost + + + ${output}= Execute Command hostname + Log Output Result of SSH : ${output} + + Close All Connections + + +*** Test Cases *** +install alumet + [Tags] + + ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb + Log Result stdout : ${output} + + ${result}= Execute Command Alumet 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] + + ${output}= Execute Command Alumet Node which alumet-agent + Log Result stdout : ${output} + + Should Contain ${output} /usr/bin/alumet-agent + +*** Test Cases *** +help option + [Tags] + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-option.txt + + ${output}= Execute Command Alumet Node alumet-agent -h + Log Result stdout : ${output} + + # Should Contain ${output} Usage + # Should Contain ${output} Commands + # Should Contain ${output} Options + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help exec option + [Tags] + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-exec-option.txt + + ${output}= Execute Command Alumet Node alumet-agent exec -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help plugins option + [Tags] + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-plugins-option.txt + + ${output}= Execute Command Alumet Node alumet-agent plugins -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help watch option + [Tags] + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-watch-option.txt + + ${output}= Execute Command Alumet Node alumet-agent watch -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +help config option + [Tags] + + ${file_content}= OperatingSystem.Get File scenarios/resources/help-config-option.txt + + ${output}= Execute Command Alumet Node alumet-agent config -h + Log Result stdout : ${output} + + Should Be Equal As Strings ${file_content} ${output} + +*** Test Cases *** +config regen + [Tags] + + ${output}= Execute Command Alumet Node alumet-agent config regen + Log Result stdout : ${output} + + Should Contain ${output} Default configuration file written to: /etc/alumet/alumet-config.toml + +*** Test Cases *** +uninstall alumet + [Tags] + + # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now + # Log Result stdout : ${output} + + + + + diff --git a/integration-tests/scenarios/plugin-perf.robot b/integration-tests/scenarios/plugin-perf.robot new file mode 100644 index 00000000..3ecaf2f1 --- /dev/null +++ b/integration-tests/scenarios/plugin-perf.robot @@ -0,0 +1,116 @@ +*** Settings *** +Documentation Alumet test plugin perf +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 60 seconds + +*** Keywords *** +Display current date + ${date}= Get Time result_format=%Y-%m-%d %H:%M:%S + Log To Console Current date : ${date} + +*** Variables *** + +# variables related to JOB submission +# ${Command}= ${HOME_TEST}/tools/cpu_load.sh 10 + +*** Test Cases *** +Test connection on target node + [Tags] + + Open Connection 172.16.118.53 alias=jumphost + Login With Public Key ${USERNAME} ${KEY} + + Open Connection ${NODE} + + Login With Public Key ${USERNAME} ${KEY} + ... jumphost_index_or_alias=jumphost + + + ${output}= Execute Command hostname + Log Output Result of SSH : ${output} + + Close All Connections + + +*** Test Cases *** +install alumet + [Tags] + + ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb + Log Result stdout : ${output} + + ${result}= Execute Command Alumet Node apt list --installed alumet-agent + Log Result stdout : ${result} + + Should Contain ${result} alumet + should Contain ${result} ${ALUMET_VERSION} + + +*** Test Cases *** +run plugin csv perf + [Tags] + + ${output}= Execute Command Alumet Node alumet-agent --plugins csv,perf,socket-control > /tmp/alumet.log 2>&1 & + Sleep 3s + + ${output_alumet}= Execute Command Alumet Node cat /tmp/alumet.log + # ${output}= Execute Command Alumet Node date; ls -l + 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} perf v0.1.0 + +*** Test Cases *** +check alumet running + [Tags] + + ${output}= Execute Command Alumet Node ls alumet-control.sock + Log Result stdout : ${output} + + Should Contain ${output} alumet-control.sock + + ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + Log Result stdout : ${output} + + Should Contain ${output} /usr/lib/alumet-agent --plugins csv,perf,socket-control + +*** Test Cases *** +stop alumet + [Tags] + + ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + Log Result stdout : ${output} + # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now + # Log Result stdout : ${output} + + ${output}= Execute Command Alumet Node ls alumet-control.sock + + Should Not Contain ${output} alumet-control.sock + +*** Test Cases *** +Check alumet not running + [Tags] + + ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + Log Result stdout : ${output} + # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now + # Log Result stdout : ${output} + + ${output}= Execute Command Alumet Node ls alumet-control.sock + + Should Not Contain ${output} alumet-control.sock + + ${output}= Execute Command Alumet 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..9b9499b8 --- /dev/null +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -0,0 +1,173 @@ +*** Settings *** +Documentation Alumet test plugin rapl +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 60 seconds + +*** Keywords *** +Display current date + ${date}= Get Time result_format=%Y-%m-%d %H:%M:%S + Log To Console Current date : ${date} + +*** Variables *** + +# variables related to JOB submission +# ${Command}= ${HOME_TEST}/tools/cpu_load.sh 10 + +*** Test Cases *** +Test connection on target node + [Tags] + + Open Connection 172.16.118.53 alias=jumphost + Login With Public Key ${USERNAME} ${KEY} + + Open Connection ${NODE} + + Login With Public Key ${USERNAME} ${KEY} + ... jumphost_index_or_alias=jumphost + + + ${output}= Execute Command hostname + Log Output Result of SSH : ${output} + + Close All Connections + + +*** Test Cases *** +install alumet + [Tags] + + ${output}= Install Alumet + # ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb + Log Result stdout : ${output} + + ${result}= Execute Command Alumet Node apt list --installed alumet-agent + Log Result stdout : ${result} + + Should Contain ${result} alumet + should Contain ${result} ${ALUMET_VERSION} + + +*** Test Cases *** +run plugins socket-control csv rapl + [Tags] + + ${output}= Execute Command Alumet Node alumet-agent --plugins csv,rapl,socket-control > /tmp/alumet.log 2>&1 & + Sleep 3s + + ${output_alumet}= Execute Command Alumet Node cat /tmp/alumet.log + # ${output}= Execute Command Alumet Node date; ls -l + 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] + + ${output}= Execute Command Alumet Node ls alumet-control.sock + Log Result stdout : ${output} + + Should Contain ${output} alumet-control.sock + + ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + Log Result stdout : ${output} + + Should Contain ${output} /usr/lib/alumet-agent --plugins csv,rapl,socket-control + +*** Test Cases *** +check metric rapl_consumed_energy_J resource cpu_package domain package + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + # read the csv output file, resource_kind domain package + ${output}= Read resource_kind rapl_consumed_energy_J package + + Should Contain ${output} cpu_package + + # read the csv output file, metric value + ${output}= Read value rapl_consumed_energy_J cpu_package package + + Should Be True ${output} !=0.0 + +*** Test Cases *** +check metric rapl_consumed_energy_J resource cpu_package domain package_total + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + # read the csv output file, resource_kind domain package + ${output}= Read resource_kind rapl_consumed_energy_J package_total + + Should Contain ${output} local_machine + + # read the csv output file, metric value + ${output}= Read value rapl_consumed_energy_J local_machine package_total + + Should Be True ${output} !=0.0 + +*** Test Cases *** +check metric rapl_consumed_energy_J resource dram domain dram + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + # read the csv output file, resource_kind domain dram + ${output}= Read resource_kind rapl_consumed_energy_J dram + + Should Contain ${output} dram + + # read the csv output file, metric value + ${output}= Read value rapl_consumed_energy_J dram dram + + Should Be True ${output} !=0.0 + +*** Test Cases *** +check metric rapl_consumed_energy_J resource dram domain dram_total + [Tags] INPUT_PLUGIN RAPL_PLUGIN + + # read the csv output file, resource_kind domain dram + ${output}= Read resource_kind rapl_consumed_energy_J dram_total + + Should Contain ${output} local_machine + + # read the csv output file, metric value + ${output}= Read value rapl_consumed_energy_J local_machine dram_total + + Should Be True ${output} !=0.0 + +*** Test Cases *** +stop alumet + [Tags] + + ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + Log Result stdout : ${output} + # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now + # Log Result stdout : ${output} + + ${output}= Execute Command Alumet Node ls alumet-control.sock + + Should Not Contain ${output} alumet-control.sock + +*** Test Cases *** +Check alumet not running + [Tags] + + ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + Log Result stdout : ${output} + # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now + # Log Result stdout : ${output} + + ${output}= Execute Command Alumet Node ls alumet-control.sock + + Should Not Contain ${output} alumet-control.sock + + ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + + Should Not Contain ${output} alumet-agent + + 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 From 98b6fa872cfd44e9af5387a536994afa1b70cf7d Mon Sep 17 00:00:00 2001 From: emmanuel zychla Date: Fri, 29 May 2026 14:39:04 +0200 Subject: [PATCH 2/6] test: add download alumet package and copy to remote host BRSEED-1342 --- integration-tests/run.sh | 8 ++- .../scenarios/common/alumet_keywords.robot | 63 ++++++++++++++++++- .../scenarios/installation.robot | 7 +-- integration-tests/scenarios/plugin-rapl.robot | 27 ++------ 4 files changed, 74 insertions(+), 31 deletions(-) diff --git a/integration-tests/run.sh b/integration-tests/run.sh index 0344179e..1d30538c 100755 --- a/integration-tests/run.sh +++ b/integration-tests/run.sh @@ -2,7 +2,9 @@ ################################################################################################ # 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 +# NODE: target node for executing robot framework test suites +# ALUMET_VERSION: alumet version to test +# ALUMET_DISTRIBUTION: alumet distribution to test # ################################################################################################ @@ -15,8 +17,8 @@ KEY=${HOME}/.ssh/id_rsa HOME_TEST=$(pwd) # version of Alumet to installed -ALUMET_VERSION=0.9.4-1 -ALUMET_DISTRIBUTION=amd64_ubuntu_22.04 +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 diff --git a/integration-tests/scenarios/common/alumet_keywords.robot b/integration-tests/scenarios/common/alumet_keywords.robot index 6a68d0b2..00aa1998 100644 --- a/integration-tests/scenarios/common/alumet_keywords.robot +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -94,7 +94,7 @@ Execute Command Alumet Node ######################################################################################################## # Install Alumet -# Connect to a target node and execute a command on this node +# Connect to a target node and install alumet # input parameters: # None # @@ -105,11 +105,70 @@ Execute Command Alumet Node # ${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 - ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb + # 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 172.16.118.53 alias=jumphost + Login With Public Key ${USERNAME} ${KEY} + + Open Connection ${NODE} + + Login With Public Key ${USERNAME} ${KEY} + ... jumphost_index_or_alias=jumphost + + # copy linux package on remote host + Put File alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + + # install alumet package + ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + + # check il installation ok + ${result}= Execute Command Alumet 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}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt purge -y alumet-agent + + ${result}= Execute Command Alumet Node apt list --installed alumet-agent + + Should Not Contain ${result} alumet [Return] ${output} diff --git a/integration-tests/scenarios/installation.robot b/integration-tests/scenarios/installation.robot index c74c782e..b4461bb7 100644 --- a/integration-tests/scenarios/installation.robot +++ b/integration-tests/scenarios/installation.robot @@ -42,7 +42,7 @@ Test connection on target node install alumet [Tags] - ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb + ${output}= Install Alumet Log Result stdout : ${output} ${result}= Execute Command Alumet Node apt list --installed alumet-agent @@ -132,9 +132,8 @@ config regen uninstall alumet [Tags] - # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now - # Log Result stdout : ${output} - + UnInstall Alumet + diff --git a/integration-tests/scenarios/plugin-rapl.robot b/integration-tests/scenarios/plugin-rapl.robot index 9b9499b8..be07f200 100644 --- a/integration-tests/scenarios/plugin-rapl.robot +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -5,14 +5,13 @@ Library SSHLibrary Library String Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot -Suite Setup Log Test are running on cluster: ${NODE} level=INFO +Suite Setup Install Alumet +Suite Teardown UnInstall Alumet Test timeout 60 seconds *** Keywords *** -Display current date - ${date}= Get Time result_format=%Y-%m-%d %H:%M:%S - Log To Console Current date : ${date} + *** Variables *** @@ -37,22 +36,6 @@ Test connection on target node Close All Connections - -*** Test Cases *** -install alumet - [Tags] - - ${output}= Install Alumet - # ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb - Log Result stdout : ${output} - - ${result}= Execute Command Alumet Node apt list --installed alumet-agent - Log Result stdout : ${result} - - Should Contain ${result} alumet - should Contain ${result} ${ALUMET_VERSION} - - *** Test Cases *** run plugins socket-control csv rapl [Tags] @@ -72,7 +55,7 @@ run plugins socket-control csv rapl *** Test Cases *** check alumet running - [Tags] + [Tags] INPUT_PLUGIN RAPL_PLUGIN ${output}= Execute Command Alumet Node ls alumet-control.sock Log Result stdout : ${output} @@ -129,7 +112,7 @@ check metric rapl_consumed_energy_J resource dram domain dram *** Test Cases *** check metric rapl_consumed_energy_J resource dram domain dram_total [Tags] INPUT_PLUGIN RAPL_PLUGIN - + # read the csv output file, resource_kind domain dram ${output}= Read resource_kind rapl_consumed_energy_J dram_total From 1614c9a706e6792859670b25e9b4a1b57f8113a2 Mon Sep 17 00:00:00 2001 From: emmanuel zychla Date: Fri, 29 May 2026 17:01:24 +0200 Subject: [PATCH 3/6] test: define Check Metric keyword and use it as template BRSEED-1342 --- integration-tests/README.md | 30 ++++--- .../scenarios/common/alumet_keywords.robot | 31 ++++++- integration-tests/scenarios/plugin-rapl.robot | 88 ++++++------------- 3 files changed, 74 insertions(+), 75 deletions(-) diff --git a/integration-tests/README.md b/integration-tests/README.md index 384cf0e5..619db49d 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -2,9 +2,9 @@ This folder contains all script files and scenarios for testing alumet on bare metal. -The scenarios ( a test suite) are located in scenarios folder. Robot framework is used to perform automatically the tests. Each suite test is a set of tests. +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. -Each test is tag allowing to exclude tests to during the execution with robot framework. +Each test can have one or several tags allowing to exclude tests to during the execution with robot framework. Before executing the tests, you need to install robot framework. After you need to initialize the robot framework environment: @@ -19,36 +19,38 @@ A script run.sh allows to execute the robot framework tests on a target node. Then you can execute your test: ```bash + ============================================================================== Plugin-Rapl :: Alumet test plugin rapl ============================================================================== Test connection on target node | PASS | ------------------------------------------------------------------------------ -install alumet | PASS | ------------------------------------------------------------------------------- run plugins socket-control csv rapl | PASS | ------------------------------------------------------------------------------ check alumet running | PASS | ------------------------------------------------------------------------------ -check metric rapl_consumed_energy_J resource cpu_package domain pa... ..metric value read: 29.18206787109375 -check metric rapl_consumed_energy_J resource cpu_package domain pa... | PASS | +Check Rapl Metrics package metric value read: 26.535888671875 +Check Rapl Metrics package | PASS | ------------------------------------------------------------------------------ -check metric rapl_consumed_energy_J resource cpu_package domain pa... ..metric value read: 52.879150390625 -check metric rapl_consumed_energy_J resource cpu_package domain pa... | PASS | +Check Rapl Metrics package_total metric value read: 48.0457763671875 +Check Rapl Metrics package_total | PASS | ------------------------------------------------------------------------------ -check metric rapl_consumed_energy_J resource dram domain dram ..metric value read: 3.3978118896484375 -check metric rapl_consumed_energy_J resource dram domain dram | PASS | +Check Rapl Metrics dram metric value read: 3.331390380859375 +Check Rapl Metrics dram | PASS | ------------------------------------------------------------------------------ -check metric rapl_consumed_energy_J resource dram domain dram_total ..metric value read: 6.769805908203125 -check metric rapl_consumed_energy_J resource dram domain dram_total | PASS | +Check Rapl Metrics dram_total metric value read: 6.8105316162109375 +Check Rapl Metrics dram_total | PASS | ------------------------------------------------------------------------------ stop alumet | PASS | ------------------------------------------------------------------------------ Check alumet not running | PASS | ------------------------------------------------------------------------------ Plugin-Rapl :: Alumet test plugin rapl | PASS | -10 tests, 10 passed, 0 failed +9 tests, 9 passed, 0 failed ============================================================================== ``` -The robot framework generates a report and log file in html format. \ No newline at end of file +The robot framework generates a report and log file in html format. + +To write a new test suite for an input plugin, you must be used the Check Metric keyword as a template. +You can take example with the plugin-rapl.robot. diff --git a/integration-tests/scenarios/common/alumet_keywords.robot b/integration-tests/scenarios/common/alumet_keywords.robot index 00aa1998..c7221a49 100644 --- a/integration-tests/scenarios/common/alumet_keywords.robot +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -222,4 +222,33 @@ Read value ${output}= Execute Command Alumet Node grep ${metric} alumet-output.csv | grep ${domain} | awk -F ';' '{print $3}' | sed -n '1p' Log To Console metric value read: ${output} - [Return] ${output} \ No newline at end of file + [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 +# consumer_kind: consumer 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} ${consumer_kind} ${domain} + + ${output}= Read resource_kind ${metric} ${domain} + Should Contain ${output} ${consumer_kind} + + ${output}= Read value ${metric} ${consumer_kind} ${domain} + Should Be True ${output} !=0.0 \ No newline at end of file diff --git a/integration-tests/scenarios/plugin-rapl.robot b/integration-tests/scenarios/plugin-rapl.robot index be07f200..ed96bba9 100644 --- a/integration-tests/scenarios/plugin-rapl.robot +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -4,6 +4,7 @@ Library OperatingSystem Library SSHLibrary Library String Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot +# Test Template Check Metric Suite Setup Install Alumet Suite Teardown UnInstall Alumet @@ -38,7 +39,7 @@ Test connection on target node *** Test Cases *** run plugins socket-control csv rapl - [Tags] + [Tags] INPUT_PLUGIN RAPL_PLUGIN ${output}= Execute Command Alumet Node alumet-agent --plugins csv,rapl,socket-control > /tmp/alumet.log 2>&1 & Sleep 3s @@ -68,64 +69,33 @@ check alumet running Should Contain ${output} /usr/lib/alumet-agent --plugins csv,rapl,socket-control *** Test Cases *** -check metric rapl_consumed_energy_J resource cpu_package domain package - [Tags] INPUT_PLUGIN RAPL_PLUGIN - - # read the csv output file, resource_kind domain package - ${output}= Read resource_kind rapl_consumed_energy_J package - - Should Contain ${output} cpu_package - - # read the csv output file, metric value - ${output}= Read value rapl_consumed_energy_J cpu_package package - - Should Be True ${output} !=0.0 - -*** Test Cases *** -check metric rapl_consumed_energy_J resource cpu_package domain package_total - [Tags] INPUT_PLUGIN RAPL_PLUGIN - - # read the csv output file, resource_kind domain package - ${output}= Read resource_kind rapl_consumed_energy_J package_total - - Should Contain ${output} local_machine - - # read the csv output file, metric value - ${output}= Read value rapl_consumed_energy_J local_machine package_total - - Should Be True ${output} !=0.0 - -*** Test Cases *** -check metric rapl_consumed_energy_J resource dram domain dram - [Tags] INPUT_PLUGIN RAPL_PLUGIN - - # read the csv output file, resource_kind domain dram - ${output}= Read resource_kind rapl_consumed_energy_J dram - - Should Contain ${output} dram - - # read the csv output file, metric value - ${output}= Read value rapl_consumed_energy_J dram dram - - Should Be True ${output} !=0.0 - -*** Test Cases *** -check metric rapl_consumed_energy_J resource dram domain dram_total - [Tags] INPUT_PLUGIN RAPL_PLUGIN - - # read the csv output file, resource_kind domain dram - ${output}= Read resource_kind rapl_consumed_energy_J dram_total - - Should Contain ${output} local_machine - - # read the csv output file, metric value - ${output}= Read value rapl_consumed_energy_J local_machine dram_total - - Should Be True ${output} !=0.0 +Check Rapl Metrics package + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${consumer_kind} ${domain} + rapl_consumed_energy_J cpu_package package + +Check Rapl Metrics package_total + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${consumer_kind} ${domain} + rapl_consumed_energy_J local_machine package_total + +Check Rapl Metrics dram + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${consumer_kind} ${domain} + rapl_consumed_energy_J dram dram + +Check Rapl Metrics dram_total + [Template] Check Metric + [Tags] INPUT_PLUGIN RAPL_PLUGIN + # ${metric} ${consumer_kind} ${domain} + rapl_consumed_energy_J local_machine dram_total *** Test Cases *** stop alumet - [Tags] + [Tags] INPUT_PLUGIN RAPL_PLUGIN ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - Log Result stdout : ${output} @@ -138,7 +108,7 @@ stop alumet *** Test Cases *** Check alumet not running - [Tags] + [Tags] INPUT_PLUGIN RAPL_PLUGIN ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - Log Result stdout : ${output} @@ -151,6 +121,4 @@ Check alumet not running ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} - Should Not Contain ${output} alumet-agent - - + Should Not Contain ${output} alumet-agent \ No newline at end of file From 549223472042188305cd645ca0f417e3a987ad32 Mon Sep 17 00:00:00 2001 From: emmanuel zychla Date: Wed, 3 Jun 2026 11:34:48 +0200 Subject: [PATCH 4/6] test: update tests related to plugin perf BRSEED-1342 --- integration-tests/run.sh | 8 +-- .../scenarios/common/alumet_keywords.robot | 47 ++++++++++++--- .../scenarios/installation.robot | 20 +++---- integration-tests/scenarios/plugin-perf.robot | 57 ++++++++++++------- integration-tests/scenarios/plugin-rapl.robot | 16 +++--- integration-tests/scenarios/tools/cpu_load.sh | 40 +++++++++++++ 6 files changed, 135 insertions(+), 53 deletions(-) create mode 100755 integration-tests/scenarios/tools/cpu_load.sh diff --git a/integration-tests/run.sh b/integration-tests/run.sh index 1d30538c..e10621c5 100755 --- a/integration-tests/run.sh +++ b/integration-tests/run.sh @@ -39,12 +39,10 @@ robot -v "NODE:localhost" \ -v "ALUMET_VERSION:$ALUMET_VERSION" \ -v "ALUMET_DISTRIBUTION:$ALUMET_DISTRIBUTION" \ --metadata "Test are executed on node $NODE" \ - scenarios/plugin-rapl.robot + scenarios/ echo "End running tests at: $(date)" # other tags defined on tests that can be exclude - # --exclude CPU \ - # --exclude GPU \ - # --exclude LOW \ - # --exclude HIGH \ \ No newline at end of file + # --exclude RAPL_PLUGIN \ + # --exclude INSTALLATION \ \ No newline at end of file diff --git a/integration-tests/scenarios/common/alumet_keywords.robot b/integration-tests/scenarios/common/alumet_keywords.robot index c7221a49..402b5bbd 100644 --- a/integration-tests/scenarios/common/alumet_keywords.robot +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -170,6 +170,20 @@ UnInstall Alumet Should Not Contain ${result} alumet + # remove alumet package file on target node + ${result}= Execute Command Alumet Node rm alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* + + ${result}= Execute Command Alumet 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 + [Return] ${output} ######################################################################################################## @@ -189,11 +203,19 @@ UnInstall Alumet # ######################################################################################################## Read resource_kind - [Arguments] ${metric} ${domain} + [Arguments] ${metric} ${domain}=${EMPTY} + + # the metric resource_kind is on 4th column # ${output}= Execute Command Alumet Node grep ${metric} alumet-output.csv | grep ${domain} | awk -F ';' '{print $4}' - ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $8 == "${domain}" { OFS="|"; print $4 }' + + 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}= Execute Command Alumet Node ${command} [Return] ${output} @@ -203,6 +225,7 @@ Read resource_kind # 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: @@ -215,11 +238,17 @@ Read resource_kind # ######################################################################################################## Read value - [Arguments] ${metric} ${consumer_kind} ${domain} + [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 - ${command}= Set variable grep ${metric} alumet-output.csv | awk -F ';' ' $8 == "${domain}" && $4 == "${consumer_kind}" { OFS="|"; print $3 }' - ${output}= Execute Command Alumet Node grep ${metric} alumet-output.csv | grep ${domain} | awk -F ';' '{print $3}' | sed -n '1p' + ${output}= Execute Command Alumet Node ${command} Log To Console metric value read: ${output} [Return] ${output} @@ -232,7 +261,7 @@ Read value # # input parameters: # metric: metric name to parse -# consumer_kind: consumer kind +# resource_kind: resource kind # domain: domain name # # Return parameters: @@ -245,10 +274,10 @@ Read value # ######################################################################################################## Check Metric - [Arguments] ${metric} ${consumer_kind} ${domain} + [Arguments] ${metric} ${resource_kind} ${domain}=${EMPTY} ${output}= Read resource_kind ${metric} ${domain} - Should Contain ${output} ${consumer_kind} + Should Contain ${output} ${resource_kind} - ${output}= Read value ${metric} ${consumer_kind} ${domain} + ${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 index b4461bb7..a615fb8d 100644 --- a/integration-tests/scenarios/installation.robot +++ b/integration-tests/scenarios/installation.robot @@ -21,7 +21,7 @@ Display current date *** Test Cases *** Test connection on target node - [Tags] + [Tags] INSTALLATION Open Connection 172.16.118.53 alias=jumphost Login With Public Key ${USERNAME} ${KEY} @@ -40,7 +40,7 @@ Test connection on target node *** Test Cases *** install alumet - [Tags] + [Tags] INSTALLATION ${output}= Install Alumet Log Result stdout : ${output} @@ -53,7 +53,7 @@ install alumet *** Test Cases *** which alumet-agent - [Tags] + [Tags] INSTALLATION ${output}= Execute Command Alumet Node which alumet-agent Log Result stdout : ${output} @@ -62,7 +62,7 @@ which alumet-agent *** Test Cases *** help option - [Tags] + [Tags] INSTALLATION ${file_content}= OperatingSystem.Get File scenarios/resources/help-option.txt @@ -77,7 +77,7 @@ help option *** Test Cases *** help exec option - [Tags] + [Tags] INSTALLATION ${file_content}= OperatingSystem.Get File scenarios/resources/help-exec-option.txt @@ -88,7 +88,7 @@ help exec option *** Test Cases *** help plugins option - [Tags] + [Tags] INSTALLATION ${file_content}= OperatingSystem.Get File scenarios/resources/help-plugins-option.txt @@ -99,7 +99,7 @@ help plugins option *** Test Cases *** help watch option - [Tags] + [Tags] INSTALLATION ${file_content}= OperatingSystem.Get File scenarios/resources/help-watch-option.txt @@ -110,7 +110,7 @@ help watch option *** Test Cases *** help config option - [Tags] + [Tags] INSTALLATION ${file_content}= OperatingSystem.Get File scenarios/resources/help-config-option.txt @@ -121,7 +121,7 @@ help config option *** Test Cases *** config regen - [Tags] + [Tags] INSTALLATION ${output}= Execute Command Alumet Node alumet-agent config regen Log Result stdout : ${output} @@ -130,7 +130,7 @@ config regen *** Test Cases *** uninstall alumet - [Tags] + [Tags] INSTALLATION UnInstall Alumet diff --git a/integration-tests/scenarios/plugin-perf.robot b/integration-tests/scenarios/plugin-perf.robot index 3ecaf2f1..fbc17ad1 100644 --- a/integration-tests/scenarios/plugin-perf.robot +++ b/integration-tests/scenarios/plugin-perf.robot @@ -5,7 +5,9 @@ Library SSHLibrary Library String Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot -Suite Setup Log Test are running on cluster: ${NODE} level=INFO +Suite Setup Install Alumet +Suite Teardown UnInstall Alumet +# Suite Setup Log Test are running on cluster: ${NODE} level=INFO Test timeout 60 seconds @@ -37,26 +39,18 @@ Test connection on target node Close All Connections - *** Test Cases *** -install alumet - [Tags] - - ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}_${ALUMET_DISTRIBUTION}.deb - Log Result stdout : ${output} - - ${result}= Execute Command Alumet Node apt list --installed alumet-agent - Log Result stdout : ${result} - - Should Contain ${result} alumet - should Contain ${result} ${ALUMET_VERSION} +run cpu_load + [Tags] INPUT_PLUGIN PERF_PLUGIN + ${output}= Execute Command Alumet Node nohup ./cpu_load.sh 20 > /dev/null 2>&1 & + Sleep 3s *** Test Cases *** run plugin csv perf - [Tags] + [Tags] INPUT_PLUGIN PERF_PLUGIN - ${output}= Execute Command Alumet Node alumet-agent --plugins csv,perf,socket-control > /tmp/alumet.log 2>&1 & + ${output}= Execute Command Alumet Node alumet-agent --plugins csv,perf,socket-control watch "$(cat cpu_load.sh.pid)" > /tmp/alumet.log 2>&1 & Sleep 3s ${output_alumet}= Execute Command Alumet Node cat /tmp/alumet.log @@ -71,7 +65,7 @@ run plugin csv perf *** Test Cases *** check alumet running - [Tags] + [Tags] INPUT_PLUGIN PERF_PLUGIN ${output}= Execute Command Alumet Node ls alumet-control.sock Log Result stdout : ${output} @@ -83,22 +77,43 @@ check alumet running Should Contain ${output} /usr/lib/alumet-agent --plugins csv,perf,socket-control +*** 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 *** stop alumet - [Tags] + [Tags] INPUT_PLUGIN PERF_PLUGIN ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - Log Result stdout : ${output} - # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now - # Log Result stdout : ${output} - + ${output}= Execute Command Alumet Node ls alumet-control.sock Should Not Contain ${output} alumet-control.sock *** Test Cases *** Check alumet not running - [Tags] + [Tags] INPUT_PLUGIN PERF_PLUGIN ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - Log Result stdout : ${output} diff --git a/integration-tests/scenarios/plugin-rapl.robot b/integration-tests/scenarios/plugin-rapl.robot index ed96bba9..aa863a98 100644 --- a/integration-tests/scenarios/plugin-rapl.robot +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -69,28 +69,28 @@ check alumet running Should Contain ${output} /usr/lib/alumet-agent --plugins csv,rapl,socket-control *** Test Cases *** -Check Rapl Metrics package +Check Rapl Metric package [Template] Check Metric [Tags] INPUT_PLUGIN RAPL_PLUGIN - # ${metric} ${consumer_kind} ${domain} + # ${metric} ${resource_kind} ${domain} rapl_consumed_energy_J cpu_package package -Check Rapl Metrics package_total +Check Rapl Metric package_total [Template] Check Metric [Tags] INPUT_PLUGIN RAPL_PLUGIN - # ${metric} ${consumer_kind} ${domain} + # ${metric} ${resource_kind} ${domain} rapl_consumed_energy_J local_machine package_total -Check Rapl Metrics dram +Check Rapl Metric dram [Template] Check Metric [Tags] INPUT_PLUGIN RAPL_PLUGIN - # ${metric} ${consumer_kind} ${domain} + # ${metric} ${resource_kind} ${domain} rapl_consumed_energy_J dram dram -Check Rapl Metrics dram_total +Check Rapl Metric dram_total [Template] Check Metric [Tags] INPUT_PLUGIN RAPL_PLUGIN - # ${metric} ${consumer_kind} ${domain} + # ${metric} ${resource_kind} ${domain} rapl_consumed_energy_J local_machine dram_total *** Test Cases *** 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 From 31515afb8a3efdfb94c7a2847abc37ebda34c689 Mon Sep 17 00:00:00 2001 From: emmanuel zychla Date: Thu, 4 Jun 2026 17:18:14 +0200 Subject: [PATCH 5/6] test: add __init__.robot file that include Suite Setup Teardown BRSEED-1342 --- .cspell/project-words.txt | 1 + integration-tests/README.md | 125 ++++++++++++++++-- integration-tests/run.sh | 5 +- integration-tests/scenarios/__init__.robot | 6 + .../scenarios/common/alumet_keywords.robot | 6 + .../scenarios/installation.robot | 13 +- integration-tests/scenarios/plugin-perf.robot | 5 +- integration-tests/scenarios/plugin-rapl.robot | 6 +- 8 files changed, 133 insertions(+), 34 deletions(-) create mode 100644 integration-tests/scenarios/__init__.robot diff --git a/.cspell/project-words.txt b/.cspell/project-words.txt index e886d26b..1ea68898 100644 --- a/.cspell/project-words.txt +++ b/.cspell/project-words.txt @@ -41,6 +41,7 @@ monitorable mpoint neowise niced +nohup noninteractive nvme NVML diff --git a/integration-tests/README.md b/integration-tests/README.md index 619db49d..aacc1d89 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -1,9 +1,39 @@ # Alumet integration tests This folder contains all script files and scenarios for testing alumet on bare metal. +The structure of files is: + +```bash + +├── 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. +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 to exclude tests to during the execution with robot framework. Before executing the tests, you need to install robot framework. @@ -14,14 +44,81 @@ After you need to initialize the robot framework environment: (venv-robot) [zychlae@carbon0 integration_tests]$ ``` -A script run.sh allows to execute the robot framework tests on a target node. +A script run.sh allows to execute the robot framework tests on a target node and with a target alumet 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 | +------------------------------------------------------------------------------ +help option | PASS | +------------------------------------------------------------------------------ +help exec option | PASS | +------------------------------------------------------------------------------ +help plugins option | PASS | +------------------------------------------------------------------------------ +help watch option | PASS | +------------------------------------------------------------------------------ +help config option | PASS | +------------------------------------------------------------------------------ +config regen | FAIL | +'' does not contain 'Default configuration file written to: /etc/alumet/alumet-config.toml' +------------------------------------------------------------------------------ +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 | +------------------------------------------------------------------------------ +Check Perf Metric perf_hardware_CACHE_MISSES metric value read: 0 +Check Perf Metric perf_hardware_CACHE_MISSES | FAIL | +'0 !=0.0' should be true. +------------------------------------------------------------------------------ +Check Perf Metric perf_hardware_BRANCH_MISSES metric value read: 26 +Check Perf Metric perf_hardware_BRANCH_MISSES | PASS | +------------------------------------------------------------------------------ +stop alumet | PASS | +------------------------------------------------------------------------------ +Check alumet not running | PASS | +------------------------------------------------------------------------------ +Scenarios.Plugin-Perf :: Alumet test plugin perf | FAIL | +9 tests, 8 passed, 1 failed ============================================================================== -Plugin-Rapl :: Alumet test plugin rapl +Scenarios.Plugin-Rapl :: Alumet test plugin rapl ============================================================================== Test connection on target node | PASS | ------------------------------------------------------------------------------ @@ -29,25 +126,27 @@ run plugins socket-control csv rapl | PASS | ------------------------------------------------------------------------------ check alumet running | PASS | ------------------------------------------------------------------------------ -Check Rapl Metrics package metric value read: 26.535888671875 -Check Rapl Metrics package | PASS | +Check Rapl Metric package metric value read: 22.81256103515625 +Check Rapl Metric package | PASS | ------------------------------------------------------------------------------ -Check Rapl Metrics package_total metric value read: 48.0457763671875 -Check Rapl Metrics package_total | PASS | +Check Rapl Metric package_total metric value read: 43.15618896484375 +Check Rapl Metric package_total | PASS | ------------------------------------------------------------------------------ -Check Rapl Metrics dram metric value read: 3.331390380859375 -Check Rapl Metrics dram | PASS | +Check Rapl Metric dram metric value read: 2.7979583740234375 +Check Rapl Metric dram | PASS | ------------------------------------------------------------------------------ -Check Rapl Metrics dram_total metric value read: 6.8105316162109375 -Check Rapl Metrics dram_total | PASS | +Check Rapl Metric dram_total metric value read: 5.789459228515625 +Check Rapl Metric dram_total | PASS | ------------------------------------------------------------------------------ stop alumet | PASS | ------------------------------------------------------------------------------ Check alumet not running | PASS | ------------------------------------------------------------------------------ -Plugin-Rapl :: Alumet test plugin rapl | PASS | +Scenarios.Plugin-Rapl :: Alumet test plugin rapl | PASS | 9 tests, 9 passed, 0 failed ============================================================================== +Scenarios | FAIL | +27 tests, 25 passed, 2 failed ``` The robot framework generates a report and log file in html format. diff --git a/integration-tests/run.sh b/integration-tests/run.sh index e10621c5..eb5598b2 100755 --- a/integration-tests/run.sh +++ b/integration-tests/run.sh @@ -27,7 +27,7 @@ ALUMET_DISTRIBUTION=1_amd64_ubuntu_22.04 source "$HOME"/venv-robot/bin/activate # you can exclude some tests using option --exclude following by TAG name -# Available TAGs are : CPU, GPU, LOW, HIGH +# Available TAGs are : RAPL_PLUGIN, PERF_PLUGIN, INPUT_PLUGIN, INSTALLATION echo "Start running tests at: $(date)" @@ -38,11 +38,12 @@ robot -v "NODE:localhost" \ -v "HOME_TEST:$HOME_TEST" \ -v "ALUMET_VERSION:$ALUMET_VERSION" \ -v "ALUMET_DISTRIBUTION:$ALUMET_DISTRIBUTION" \ - --metadata "Test are executed on node $NODE" \ + --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 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..6c7a256a --- /dev/null +++ b/integration-tests/scenarios/__init__.robot @@ -0,0 +1,6 @@ +*** Settings *** +Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot + +Suite Setup Install Alumet +Suite Teardown UnInstall Alumet + diff --git a/integration-tests/scenarios/common/alumet_keywords.robot b/integration-tests/scenarios/common/alumet_keywords.robot index 402b5bbd..06dd69a8 100644 --- a/integration-tests/scenarios/common/alumet_keywords.robot +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -128,6 +128,9 @@ Install Alumet # 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}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb @@ -170,6 +173,9 @@ UnInstall Alumet Should Not Contain ${result} alumet + # remove alumet-output.csv file + ${result}= Execute Command Alumet Node rm alumet-output.csv + # remove alumet package file on target node ${result}= Execute Command Alumet Node rm alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* diff --git a/integration-tests/scenarios/installation.robot b/integration-tests/scenarios/installation.robot index a615fb8d..78a739b8 100644 --- a/integration-tests/scenarios/installation.robot +++ b/integration-tests/scenarios/installation.robot @@ -42,8 +42,8 @@ Test connection on target node install alumet [Tags] INSTALLATION - ${output}= Install Alumet - Log Result stdout : ${output} + # Alumet is already installed by Suite Setup + # we check only if installed version is right ${result}= Execute Command Alumet Node apt list --installed alumet-agent Log Result stdout : ${result} @@ -126,14 +126,7 @@ config regen ${output}= Execute Command Alumet Node alumet-agent config regen Log Result stdout : ${output} - Should Contain ${output} Default configuration file written to: /etc/alumet/alumet-config.toml - -*** Test Cases *** -uninstall alumet - [Tags] INSTALLATION - - UnInstall Alumet - + 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 index fbc17ad1..fdf8133b 100644 --- a/integration-tests/scenarios/plugin-perf.robot +++ b/integration-tests/scenarios/plugin-perf.robot @@ -5,9 +5,6 @@ Library SSHLibrary Library String Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot -Suite Setup Install Alumet -Suite Teardown UnInstall Alumet -# Suite Setup Log Test are running on cluster: ${NODE} level=INFO Test timeout 60 seconds @@ -23,7 +20,7 @@ Display current date *** Test Cases *** Test connection on target node - [Tags] + [Tags] INPUT_PLUGIN PERF_PLUGIN Open Connection 172.16.118.53 alias=jumphost Login With Public Key ${USERNAME} ${KEY} diff --git a/integration-tests/scenarios/plugin-rapl.robot b/integration-tests/scenarios/plugin-rapl.robot index aa863a98..1f70db21 100644 --- a/integration-tests/scenarios/plugin-rapl.robot +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -5,10 +5,6 @@ Library SSHLibrary Library String Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot # Test Template Check Metric - -Suite Setup Install Alumet -Suite Teardown UnInstall Alumet - Test timeout 60 seconds *** Keywords *** @@ -21,7 +17,7 @@ Test timeout 60 seconds *** Test Cases *** Test connection on target node - [Tags] + [Tags] INPUT_PLUGIN RAPL_PLUGIN Open Connection 172.16.118.53 alias=jumphost Login With Public Key ${USERNAME} ${KEY} From 8701e64db8e14924e37b9cc143c18dcb206476d8 Mon Sep 17 00:00:00 2001 From: emmanuel zychla Date: Fri, 5 Jun 2026 17:55:02 +0200 Subject: [PATCH 6/6] test: update according the PR comments BRSEED-1342 --- integration-tests/README.md | 59 ++++----------- integration-tests/run.sh | 12 ++- integration-tests/scenarios/__init__.robot | 2 + .../scenarios/common/alumet_keywords.robot | 73 +++++++------------ .../scenarios/installation.robot | 37 +++------- integration-tests/scenarios/plugin-perf.robot | 57 ++------------- integration-tests/scenarios/plugin-rapl.robot | 40 ++++------ 7 files changed, 81 insertions(+), 199 deletions(-) diff --git a/integration-tests/README.md b/integration-tests/README.md index aacc1d89..9ab807fe 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -3,7 +3,7 @@ This folder contains all script files and scenarios for testing alumet on bare metal. The structure of files is: -```bash +```text ├── README.md ├── run.sh @@ -32,19 +32,19 @@ The current version contains the following robot framework files: - 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_ +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 to exclude tests to during the execution with robot framework. +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. -After you need to initialize the robot framework environment: +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 +source ~/venv-robot/bin/activate (venv-robot) [zychlae@carbon0 integration_tests]$ ``` -A script run.sh allows to execute the robot framework tests on a target node and with a target alumet release and distribution. For that, you can modify the variables in run.sh script: +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 @@ -57,8 +57,6 @@ ALUMET_VERSION=0.9.4 ALUMET_DISTRIBUTION=1_amd64_ubuntu_22.04 ``` - - Then you can execute your test: ```bash @@ -75,18 +73,7 @@ install alumet | PASS | ------------------------------------------------------------------------------ which alumet-agent | PASS | ------------------------------------------------------------------------------ -help option | PASS | ------------------------------------------------------------------------------- -help exec option | PASS | ------------------------------------------------------------------------------- -help plugins option | PASS | ------------------------------------------------------------------------------- -help watch option | PASS | ------------------------------------------------------------------------------- -help config option | PASS | ------------------------------------------------------------------------------- -config regen | FAIL | -'' does not contain 'Default configuration file written to: /etc/alumet/alumet-config.toml' +[...] ------------------------------------------------------------------------------ Scenarios.Installation :: Alumet installation / uninstallation | FAIL | 9 tests, 8 passed, 1 failed @@ -104,16 +91,7 @@ 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 | ------------------------------------------------------------------------------ -Check Perf Metric perf_hardware_CACHE_MISSES metric value read: 0 -Check Perf Metric perf_hardware_CACHE_MISSES | FAIL | -'0 !=0.0' should be true. ------------------------------------------------------------------------------- -Check Perf Metric perf_hardware_BRANCH_MISSES metric value read: 26 -Check Perf Metric perf_hardware_BRANCH_MISSES | PASS | ------------------------------------------------------------------------------- -stop alumet | PASS | ------------------------------------------------------------------------------- -Check alumet not running | PASS | +[...] ------------------------------------------------------------------------------ Scenarios.Plugin-Perf :: Alumet test plugin perf | FAIL | 9 tests, 8 passed, 1 failed @@ -129,18 +107,7 @@ check alumet running | PASS | Check Rapl Metric package metric value read: 22.81256103515625 Check Rapl Metric package | PASS | ------------------------------------------------------------------------------ -Check Rapl Metric package_total metric value read: 43.15618896484375 -Check Rapl Metric package_total | PASS | ------------------------------------------------------------------------------- -Check Rapl Metric dram metric value read: 2.7979583740234375 -Check Rapl Metric dram | PASS | ------------------------------------------------------------------------------- -Check Rapl Metric dram_total metric value read: 5.789459228515625 -Check Rapl Metric dram_total | PASS | ------------------------------------------------------------------------------- -stop alumet | PASS | ------------------------------------------------------------------------------- -Check alumet not running | PASS | +[...] ------------------------------------------------------------------------------ Scenarios.Plugin-Rapl :: Alumet test plugin rapl | PASS | 9 tests, 9 passed, 0 failed @@ -149,7 +116,7 @@ Scenarios | FAIL | 27 tests, 25 passed, 2 failed ``` -The robot framework generates a report and log file in html format. +Robot framework generates a report and a log file in html format. -To write a new test suite for an input plugin, you must be used the Check Metric keyword as a template. -You can take example with the plugin-rapl.robot. +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 index eb5598b2..57ec4e49 100755 --- a/integration-tests/run.sh +++ b/integration-tests/run.sh @@ -10,8 +10,12 @@ #set -x -# credentials used to logon on the target node +# 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) @@ -31,10 +35,10 @@ source "$HOME"/venv-robot/bin/activate echo "Start running tests at: $(date)" -robot -v "NODE:localhost" \ +robot -v "NODE:$NODE" \ + -v "GATEWAY:$GATEWAY" \ -v "USERNAME:$USERNAME" \ -v "KEY:$KEY" \ - -v "NODE:$NODE" \ -v "HOME_TEST:$HOME_TEST" \ -v "ALUMET_VERSION:$ALUMET_VERSION" \ -v "ALUMET_DISTRIBUTION:$ALUMET_DISTRIBUTION" \ @@ -44,6 +48,8 @@ robot -v "NODE:localhost" \ 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 index 6c7a256a..d9948b96 100644 --- a/integration-tests/scenarios/__init__.robot +++ b/integration-tests/scenarios/__init__.robot @@ -4,3 +4,5 @@ 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 index 06dd69a8..ca664642 100644 --- a/integration-tests/scenarios/common/alumet_keywords.robot +++ b/integration-tests/scenarios/common/alumet_keywords.robot @@ -8,40 +8,18 @@ Library SSHLibrary *** Keywords *** ######################################################################################################## -# Compare values -# Compare 2 values with a precision of N decimals +# 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 - [Arguments] ${value1} ${value2} ${NbDecimal} - - ${precision}= Evaluate 10 ** -${NbDecimal} - ${diff}= Evaluate abs(round(${value1}, ${NbDecimal}) - round(${value2}, ${NbDecimal})) - ${diff_str}= Evaluate str(${diff}) - Log To Console difference: ${diff_str} - - ${result}= Evaluate ${diff} < ${precision} - - [Return] ${result} - -######################################################################################################## -# Compare values percent -# Compare 2 values with a precision of N decimals -# input parameters: -# value1 -# value2 -# -# return parameter: -# boolean: true if value1 = value2 according the precision -# -######################################################################################################## -Compare Values percent +Compare Values Percent [Arguments] ${value1} ${value2} ${percent} ${diff}= Evaluate abs(${value1}-${value2})/${value1}*100 @@ -49,7 +27,7 @@ Compare Values percent [Return] ${result} ######################################################################################################## -# Execute command on target node +# 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 @@ -63,10 +41,10 @@ Compare Values percent # ${KEY} : ssh key to open the ssh connection # ######################################################################################################## -Execute Command Alumet Node +Execute Command Target Node [Arguments] ${Command} - Open Connection 172.16.118.53 alias=jumphost + Open Connection ${GATEWAY} alias=jumphost Login With Public Key ${USERNAME} ${KEY} Open Connection ${NODE} @@ -89,8 +67,7 @@ Execute Command Alumet Node Close All Connections - [Return] ${stdout} - + [Return] ${stdout} ${stderr} ######################################################################################################## # Install Alumet @@ -117,7 +94,7 @@ Install Alumet Run Keyword If ${exists}==False Fail 'Error downloading alumet package file. Test suite is stopped' - Open Connection 172.16.118.53 alias=jumphost + Open Connection ${GATEWAY} alias=jumphost Login With Public Key ${USERNAME} ${KEY} Open Connection ${NODE} @@ -125,6 +102,8 @@ Install Alumet 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 @@ -132,10 +111,10 @@ Install Alumet Put File scenarios/tools/cpu_load.sh cpu_load.sh # install alumet package - ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt install -y ./alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb + ${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}= Execute Command Alumet Node apt list --installed alumet-agent + ${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 @@ -167,29 +146,33 @@ Install Alumet ######################################################################################################## UnInstall Alumet - ${output}= Execute Command Alumet Node sudo DEBIAN_FRONTEND=noninteractive apt purge -y alumet-agent + ${output} ${stderr}= Execute Command Target Node sudo DEBIAN_FRONTEND=noninteractive apt purge -y alumet-agent - ${result}= Execute Command Alumet Node apt list --installed alumet-agent + ${result} ${stderr}= Execute Command Target Node apt list --installed alumet-agent Should Not Contain ${result} alumet # remove alumet-output.csv file - ${result}= Execute Command Alumet Node rm alumet-output.csv + ${result} ${stderr}= Execute Command Target Node rm alumet-output.csv # remove alumet package file on target node - ${result}= Execute Command Alumet Node rm alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* + ${result} ${stderr}= Execute Command Target Node rm alumet-agent_${ALUMET_VERSION}-${ALUMET_DISTRIBUTION}.deb* - ${result}= Execute Command Alumet Node ls -l 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} ######################################################################################################## @@ -211,18 +194,14 @@ UnInstall Alumet Read resource_kind [Arguments] ${metric} ${domain}=${EMPTY} - - # the metric resource_kind is on 4th column - # ${output}= Execute Command Alumet Node grep ${metric} alumet-output.csv | grep ${domain} | awk -F ';' '{print $4}' - 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}= Execute Command Alumet Node ${command} + ${output} ${stderr}= Execute Command Target Node ${command} [Return] ${output} @@ -254,7 +233,7 @@ Read value # the metric value is on 3rd column - ${output}= Execute Command Alumet Node ${command} + ${output} ${stderr}= Execute Command Target Node ${command} Log To Console metric value read: ${output} [Return] ${output} diff --git a/integration-tests/scenarios/installation.robot b/integration-tests/scenarios/installation.robot index 78a739b8..16f5f626 100644 --- a/integration-tests/scenarios/installation.robot +++ b/integration-tests/scenarios/installation.robot @@ -10,9 +10,6 @@ Suite Setup Log Test are running on cluster: ${NODE} level=INFO Test timeout 180 seconds *** Keywords *** -Display current date - ${date}= Get Time result_format=%Y-%m-%d %H:%M:%S - Log To Console Current date : ${date} *** Variables *** @@ -23,21 +20,9 @@ Display current date Test connection on target node [Tags] INSTALLATION - Open Connection 172.16.118.53 alias=jumphost - Login With Public Key ${USERNAME} ${KEY} - - Open Connection ${NODE} - - Login With Public Key ${USERNAME} ${KEY} - ... jumphost_index_or_alias=jumphost - - - ${output}= Execute Command hostname + ${output} ${stderr}= Execute Command Target Node hostname Log Output Result of SSH : ${output} - Close All Connections - - *** Test Cases *** install alumet [Tags] INSTALLATION @@ -45,7 +30,7 @@ install alumet # Alumet is already installed by Suite Setup # we check only if installed version is right - ${result}= Execute Command Alumet Node apt list --installed alumet-agent + ${result} ${stderr}= Execute Command Target Node apt list --installed alumet-agent Log Result stdout : ${result} Should Contain ${result} alumet @@ -55,7 +40,7 @@ install alumet which alumet-agent [Tags] INSTALLATION - ${output}= Execute Command Alumet Node which alumet-agent + ${output} ${stderr}= Execute Command Target Node which alumet-agent Log Result stdout : ${output} Should Contain ${output} /usr/bin/alumet-agent @@ -66,13 +51,9 @@ help option ${file_content}= OperatingSystem.Get File scenarios/resources/help-option.txt - ${output}= Execute Command Alumet Node alumet-agent -h + ${output} ${stderr}= Execute Command Target Node alumet-agent -h Log Result stdout : ${output} - # Should Contain ${output} Usage - # Should Contain ${output} Commands - # Should Contain ${output} Options - Should Be Equal As Strings ${file_content} ${output} *** Test Cases *** @@ -81,7 +62,7 @@ help exec option ${file_content}= OperatingSystem.Get File scenarios/resources/help-exec-option.txt - ${output}= Execute Command Alumet Node alumet-agent exec -h + ${output} ${stderr}= Execute Command Target Node alumet-agent exec -h Log Result stdout : ${output} Should Be Equal As Strings ${file_content} ${output} @@ -92,7 +73,7 @@ help plugins option ${file_content}= OperatingSystem.Get File scenarios/resources/help-plugins-option.txt - ${output}= Execute Command Alumet Node alumet-agent plugins -h + ${output} ${stderr}= Execute Command Target Node alumet-agent plugins -h Log Result stdout : ${output} Should Be Equal As Strings ${file_content} ${output} @@ -103,7 +84,7 @@ help watch option ${file_content}= OperatingSystem.Get File scenarios/resources/help-watch-option.txt - ${output}= Execute Command Alumet Node alumet-agent watch -h + ${output} ${stderr}= Execute Command Target Node alumet-agent watch -h Log Result stdout : ${output} Should Be Equal As Strings ${file_content} ${output} @@ -114,7 +95,7 @@ help config option ${file_content}= OperatingSystem.Get File scenarios/resources/help-config-option.txt - ${output}= Execute Command Alumet Node alumet-agent config -h + ${output} ${stderr}= Execute Command Target Node alumet-agent config -h Log Result stdout : ${output} Should Be Equal As Strings ${file_content} ${output} @@ -123,7 +104,7 @@ help config option config regen [Tags] INSTALLATION - ${output}= Execute Command Alumet Node alumet-agent config regen + ${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 index fdf8133b..63a71e4d 100644 --- a/integration-tests/scenarios/plugin-perf.robot +++ b/integration-tests/scenarios/plugin-perf.robot @@ -9,9 +9,6 @@ Resource ${HOME_TEST}/scenarios/common/alumet_keywords.robot Test timeout 60 seconds *** Keywords *** -Display current date - ${date}= Get Time result_format=%Y-%m-%d %H:%M:%S - Log To Console Current date : ${date} *** Variables *** @@ -22,57 +19,39 @@ Display current date Test connection on target node [Tags] INPUT_PLUGIN PERF_PLUGIN - Open Connection 172.16.118.53 alias=jumphost - Login With Public Key ${USERNAME} ${KEY} - - Open Connection ${NODE} - - Login With Public Key ${USERNAME} ${KEY} - ... jumphost_index_or_alias=jumphost - - - ${output}= Execute Command hostname + ${output} ${stderr}= Execute Command Target Node hostname Log Output Result of SSH : ${output} - Close All Connections - *** Test Cases *** run cpu_load [Tags] INPUT_PLUGIN PERF_PLUGIN - ${output}= Execute Command Alumet Node nohup ./cpu_load.sh 20 > /dev/null 2>&1 & + ${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}= Execute Command Alumet Node alumet-agent --plugins csv,perf,socket-control watch "$(cat cpu_load.sh.pid)" > /tmp/alumet.log 2>&1 & + ${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}= Execute Command Alumet Node cat /tmp/alumet.log - # ${output}= Execute Command Alumet Node date; ls -l + ${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} 2 plugins started Should Contain ${output_alumet} csv v0.2.0 - Should Contain ${output_alumet} socket-control v0.2.1 Should Contain ${output_alumet} perf v0.1.0 *** Test Cases *** check alumet running [Tags] INPUT_PLUGIN PERF_PLUGIN - ${output}= Execute Command Alumet Node ls alumet-control.sock - Log Result stdout : ${output} - - Should Contain ${output} alumet-control.sock - - ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + ${output} ${stderr}= Execute Command Target Node ps -f -u ${USERNAME} Log Result stdout : ${output} - Should Contain ${output} /usr/lib/alumet-agent --plugins csv,perf,socket-control + Should Contain ${output} /usr/lib/alumet-agent --plugins csv,perf *** Test Cases *** Check Perf Metric perf_hardware_REF_CPU_CYCLES @@ -95,33 +74,13 @@ Check Perf Metric perf_hardware_BRANCH_MISSES # ${metric} ${resource_kind} ${domain} perf_hardware_BRANCH_MISSES local_machine - -*** Test Cases *** -stop alumet - [Tags] INPUT_PLUGIN PERF_PLUGIN - - ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - - Log Result stdout : ${output} - - ${output}= Execute Command Alumet Node ls alumet-control.sock - Should Not Contain ${output} alumet-control.sock - *** Test Cases *** Check alumet not running [Tags] INPUT_PLUGIN PERF_PLUGIN - ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - - Log Result stdout : ${output} - # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now - # Log Result stdout : ${output} - - ${output}= Execute Command Alumet Node ls alumet-control.sock - - Should Not Contain ${output} alumet-control.sock - - ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + ${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 index 1f70db21..aa60c4f3 100644 --- a/integration-tests/scenarios/plugin-rapl.robot +++ b/integration-tests/scenarios/plugin-rapl.robot @@ -19,29 +19,17 @@ Test timeout 60 seconds Test connection on target node [Tags] INPUT_PLUGIN RAPL_PLUGIN - Open Connection 172.16.118.53 alias=jumphost - Login With Public Key ${USERNAME} ${KEY} - - Open Connection ${NODE} - - Login With Public Key ${USERNAME} ${KEY} - ... jumphost_index_or_alias=jumphost - - - ${output}= Execute Command hostname + ${output} ${stderr}= Execute Command Target Node hostname Log Output Result of SSH : ${output} - Close All Connections - *** Test Cases *** run plugins socket-control csv rapl [Tags] INPUT_PLUGIN RAPL_PLUGIN - ${output}= Execute Command Alumet Node alumet-agent --plugins csv,rapl,socket-control > /tmp/alumet.log 2>&1 & + ${output} ${stderr}= Execute Command Target Node alumet-agent --plugins csv,rapl,socket-control > /tmp/alumet.log 2>&1 & Sleep 3s - ${output_alumet}= Execute Command Alumet Node cat /tmp/alumet.log - # ${output}= Execute Command Alumet Node date; ls -l + ${output_alumet} ${stderr}= Execute Command Target Node cat /tmp/alumet.log Log Result stdout : ${output_alumet} # Should Contain ${output_alumet} ${expected_started_plugins} @@ -54,16 +42,20 @@ run plugins socket-control csv rapl check alumet running [Tags] INPUT_PLUGIN RAPL_PLUGIN - ${output}= Execute Command Alumet Node ls alumet-control.sock + ${output} ${stderr}= Execute Command Target Node ls alumet-control.sock Log Result stdout : ${output} Should Contain ${output} alumet-control.sock - ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + ${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 @@ -93,12 +85,10 @@ Check Rapl Metric dram_total stop alumet [Tags] INPUT_PLUGIN RAPL_PLUGIN - ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + ${output} ${stderr}= Execute Command Target Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - Log Result stdout : ${output} - # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now - # Log Result stdout : ${output} - ${output}= Execute Command Alumet Node ls alumet-control.sock + ${output} ${stderr}= Execute Command Target Node ls alumet-control.sock Should Not Contain ${output} alumet-control.sock @@ -106,15 +96,13 @@ stop alumet Check alumet not running [Tags] INPUT_PLUGIN RAPL_PLUGIN - ${output}= Execute Command Alumet Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - + ${output}= Execute Command Target Node echo "shutdown" | socat UNIX-CONNECT:alumet-control.sock - Log Result stdout : ${output} - # ${output}= Execute Command Alumet Node sudo apt remove -y --purge alumet-agent/now - # Log Result stdout : ${output} - ${output}= Execute Command Alumet Node ls alumet-control.sock + ${output} ${stderr}= Execute Command Target Node ls alumet-control.sock Should Not Contain ${output} alumet-control.sock - ${output}= Execute Command Alumet Node ps -f -u ${USERNAME} + ${output} ${stderr}= Execute Command Target Node ps -f -u ${USERNAME} Should Not Contain ${output} alumet-agent \ No newline at end of file