Skip to content

Commit

Permalink
Change ghaf version format
Browse files Browse the repository at this point in the history
Signed-off-by: Mariia Azbeleva <[email protected]>
  • Loading branch information
azbeleva committed Nov 27, 2023
1 parent 9bdee35 commit 92e2ccb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
7 changes: 6 additions & 1 deletion Robot-Framework/lib/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def verify_shutdown_status(output):
raise Exception("Couldn't parse shutdown status")


def parse_version(output):
def parse_ghaf_version(output):
major, minor = output.split(".")
return major, minor


def parse_nixos_version(output):
versions = output.split(' ')
name = versions[1][1:-1] if len(versions) > 1 else None
major, minor, date, commit = versions[0].split(".")
Expand Down
33 changes: 17 additions & 16 deletions Robot-Framework/resources/ssh_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,15 @@ Check file doesn't exist
Log To Console File ${file_name} doesn't exist

Verify Ghaf Version Format
[Documentation] Check that ghaf-version contains version number in the format:"dd.dd",
... date of commit in format yyyymmdd and 7 symbols of hash commit
${major} ${minor} ${date} ${commit} ${name} Get Version ghaf
[Documentation] Check that ghaf-version contains version number in the format:"dd.dd"
${major} ${minor} Get Ghaf Version
Should Match Regexp ${major} ^\\d{2}$
Should Match Regexp ${minor} ^\\d{2}$
Verify Date Format ${date}
Should Match Regexp ${commit} ^[0-9a-f]{7}$
IF ${name} != None
FAIL Unexpected string in Ghaf version: ${name}
END

Verify Nixos Version Format
[Documentation] Check that nixos-version contains version number in the format:"dd.dd",
... date of commit in format yyyymmdd, 7 symbols of hash commit and version name in brackets
${major} ${minor} ${date} ${commit} ${name} Get Version nixos
${major} ${minor} ${date} ${commit} ${name} Get Nixos Version
Should Match Regexp ${major} ^\\d{2}$
Should Match Regexp ${minor} ^\\d{2}$
Verify Date Format ${date}
Expand All @@ -199,15 +193,22 @@ Verify Nixos Version Format
FAIL Expected NixOS version name, but there is None
END

Get Version
[Documentation] Get version of NixOS or Ghaf system, Examples:
... "ghaf-version" output: 23.05.20230628.92414ab parse result: 23.05, 20230628, 92414ab
Get Ghaf Version
[Documentation] Get version of Ghaf system, Example:
... "ghaf-version" output: 23.05 parse result: 23.05
${output} ${rc} Execute Command ghaf-version return_rc=True
Should Be Equal As Integers ${rc} 0 Couldn't get ghaf version, command return code
Log To Console ghaf-version: ${output}
${major} ${minor} Parse Ghaf Version ${output}
[Return] ${major} ${minor}

Get Nixos Version
[Documentation] Get version of NixOS, Example:
... "nixos-version" output: 23.05.20230625.35130d4 (Stoat) parse result: 23.05, 20230625, 35130d4, Stoat
[Arguments] ${whose}
${output} ${rc} Execute Command ${whose}-version return_rc=True
${output} ${rc} Execute Command nixos-version return_rc=True
Should Be Equal As Integers ${rc} 0 Couldn't get ghaf version, command return code
Log To Console ${whose}-version: ${output}
${major} ${minor} ${date} ${commit} ${name} Parse Version ${output}
Log To Console nixos-version: ${output}
${major} ${minor} ${date} ${commit} ${name} Parse Nixos Version ${output}
[Return] ${major} ${minor} ${date} ${commit} ${name}

Save log
Expand Down

0 comments on commit 92e2ccb

Please sign in to comment.