Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting more variables via command line #219

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leivos-unikie
Copy link
Collaborator

@leivos-unikie leivos-unikie commented Jan 28, 2025

The purpose of this PR is to bring more flexibility into manual use of ci-test-automation and to make local smoke testing faster. Fully automated setups should not be affected.

CONFIG_PATH (path to test_config.json) can be given via command line. If not given it defaults to the current path.

If CONFIG_PATH is set to None reading config file variables will be ignored which allows setting target IP address from command line. This makes local testing more straightforward, not having to create or modify test_config.json.

Prevents Set Variables from overwriting password (given via cmd line) if /run/secrets/dut-pass does not exist.

Steps to run smoke tests locally from ghaf-host:

ssh to ghaf-host
cd /home
sudo su
git clone https://github.com/leivos-unikie/ci-test-automation.git
cd ci-test-automation/Robot-Framework/test-suites
nix develop
git checkout optional_config
robot -v CONFIG_PATH:None -v DEVICE:Lenovo-X1 -v DEVICE_IP_ADDRESS:127.0.0.1 -v PASSWORD:ghaf -i lenovo-x1ANDpre-merge ./

I ran also with
robot -v CONFIG_PATH:None -v DEVICE:Lenovo-X1 -v DEVICE_IP_ADDRESS:127.0.0.1 -v PASSWORD:ghaf -i lenovo-x1ANDbat -i lenovo-x1ANDgui-apps ./
after setting wifi credentials to /run/secrets and all test cases passed except timesync test (in current state it assumes unchanged time on the machine running robot framework).

If CONFIG_PATH is set to None reading config file
variables will be ignored which allows setting target
IP address from command line. This makes local smoke
testing more straightforward.

Prevent Set Variables from overwriting password if
given via cmd line.
Signed-off-by: Samuli Leivo <[email protected]>
@milva-unikie
Copy link
Collaborator

Great start! I tested this by running the tests from ghaf host on Lenovo-X1. Few comments:

  • ssh command should be ssh ghaf@ghaf-host-debug and nix develop is missing
  • If you have created your user as something else than testuser tests won't work unless you go and change the username/password in variables.robot
  • At the end tests log out and results in terminal are lost
  • No easy way to check report.html

@leivos-unikie
Copy link
Collaborator Author

Thanks for trying this out. My suggestions to these.

* ssh command should be `ssh ghaf@ghaf-host-debug` and `nix develop` is missing

The first step was meant generally somehow connecting to ghaf-host either from gui-vm or from separate machine over network.

* If you have created your user as something else than testuser tests won't work unless you go and change the username/password in variables.robot

Or is it replacing your previously set user with the testuser?

* At the end tests log out and results in terminal are lost

We could skip all automated Logouts if CONFIG_PATH is set to None.

* No easy way to check report.html

I checked that is actually possible to open the report with chrome if first copying the report files to chrome-vm:/tmp and giving them appuser:users ownership. Or then copying to other machine for study... but this is not very smooth. I try to automate sending the results for chrome to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants