Skip to content

Commit

Permalink
test(share): standardise with latest changes [skip ci]
Browse files Browse the repository at this point in the history
* Automated using myii/ssf-formula#288
  • Loading branch information
myii committed Feb 1, 2021
1 parent 4d797fc commit 7df88b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion test/integration/share/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ The `system` library provides easy access to system dependent information:
- `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective
- `system.platform[:family]` provide a family name for Arch and Gentoo
- `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows`
- `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo and Windows:
- `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo, openSUSE and Windows:
- `Arch` is always `base-latest`
- `Amazon Linux` release `2018` is resolved as `1`
- `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`)
- `openSUSE` is resolved as `tumbleweed` if the `platform[:release]` is in date format
- `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version
- `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example)
15 changes: 7 additions & 8 deletions test/integration/share/libraries/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def build_platform_name
end
end

# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
def build_platform_release
case inspec.platform[:name]
when 'amazon'
Expand All @@ -55,6 +55,10 @@ def build_platform_release
'base-latest'
when 'gentoo'
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
when 'opensuse'
# rubocop:disable Style/NumericLiterals,Layout/LineLength
inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release]
# rubocop:enable Style/NumericLiterals,Layout/LineLength
when 'windows_8.1_pro'
'8.1'
when 'windows_server_2019_datacenter'
Expand All @@ -63,15 +67,10 @@ def build_platform_release
inspec.platform[:release]
end
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity

def derive_gentoo_init_system
case inspec.command('systemctl').exist?
when true
'sysd'
else
'sysv'
end
inspec.command('systemctl').exist? ? 'sysd' : 'sysv'
end

def build_platform_finger
Expand Down

0 comments on commit 7df88b9

Please sign in to comment.