Project

General

Profile

action #88319

Updated by riafarov about 3 years ago

As a test developer, I want to have flexible data driven way to validate configuration files. 

 We have different scenarios, as config files have different format, some have key-value syntax with `=` symbol, some like chrony.conf or /etc/hosts have lines format. We would rather avoid having test module for each of the config files, as this will lead to duplication of the code. 

 See https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/tests/console/yast2_kdump.pm and https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/tests/console/verify_config_files.pm 

 See for KDUMP https://openqa.suse.de/tests/latest?arch=x86_64&distri=sle&flavor=Online&machine=64bit&test=yast2_ncurses_textmode&version=15-SP3 

 We can either use generic structure to look for the full lines, or support both ways and define key-pair values, which is better visualized. 

 As of now have 2 ways to validate file, one uses `script_output` and other one uses `grep` inside of the system. Both have pros and cons, so we can start with any of those two and act in case we face any issues in future. 

 It has following structure: 
 ``` 
 kdump: 
   - path: /etc/default/grub 
     settings: 
       GRUB_CMDLINE_LINUX_DEFAULT: '.*crashkernel=\d+M.*' 
   - path: /etc/sysconfig/kdump 
     settings: 
       KDUMP_DUMPLEVEL: 31 
       KDUMP_DUMPFORMAT: compressed 
       KDUMP_SAVEDIR: '(file://|)/var/crash' 
       KDUMP_KEEP_OLD_DUMPS: 5 
       KDUMP_IMMEDIATE_REBOOT: 'yes' 
       KDUMP_COPY_KERNEL: 'yes' 
 ``` 

 verify_config_files has following: 
 ``` 
 test_data: 
   configuration_files: 
     - path: /etc/hosts 
       entries: 
         - '10.226.154.19\tnew.entry.de h999uz' 
     - path: /etc/chrony.conf 
       entries: 
         - pool ntp.suse.de iburst 
         - driftfile /var/lib/chrony/drift 
 ```

Back