Automated Tests: Possible with shell scripts?

René Bleisch accounts at climate.unibe.ch
Thu Apr 14 11:27:22 CEST 2016


Hi Stefan,
I'm using the test feature.
If I understand you correctly, your script is named 
"/srv/fai/config/tests/BASE".
This will not work, as "task_test" checks for class-wise folders with 
scripts in it (like "task_configure" does it in /srv/fai/config/scripts/).
You have to create a folder for your class and put your scripts in it:
   "/srv/fai/config/tests/BASE/my_test_script".

You can definitely use bash scripts (I also do it).

Further, I guess "test.log" is only created if something goes wrong*.
As for all other tasks, the main information is logged to fai.log (here 
a snippet from my tests):

Calling task_tests
Executing    shell: WORKSTATION/10-test-installation
WORKSTATION/10-test-installation OK.

If the script generates further output to standard output (e.g. with 
echo "xy"), it goes to "shell.log"

Cheers
René

* after having a look on "task_test" function in "/usr/lib/fai/subroutines"

On 04/14/2016 10:58 AM, ROSSBACH Stefan wrote:
> Hi,
>
> we are currently 2 people developing and bugfixing our installations. We are planning to establish a continuous integration with a "Jenkins run".
> For that, I need the possibility to create automated tests that are able to test the installed configuration.
>
> As far as I understood, FAI offers this possibility with the "tests" task. Unfortunately, I am not able to bring this to work in my configuration.
> In the examples folder, there is a sample with a FAIBASE_TEST. My Base class is called "BASE". My idea was then to just copy the samples to my own "tests" folder and to rename the sample script to "BASE_TEST" (which is my base class).
> Unfortunately, this did not work. No test.log file was created. (To be more exact, there was no clue in the logfiles that the test was executed)
>
> Also, I think that not many people use the feature of FAI to have automated tests. All what I found via google was the very small section in the fai guide (which did not help me due to its shortness).
>
> So, to sum it up, I have two questions:
> - What did I wrong when I created the /srv/fai/config/tests folder and copied and renamed the sample tests to this folder?
> - Is it possible to have shell scripts or python scripts as tests? I am having a hard time to understand the pearl scripts ;)
>
> Cheers,
> Stefan
-------------- n?chster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20160414/de4f96b6/attachment.html>


More information about the linux-fai mailing list