Skip to content

Commit 147c996

Browse files
committed
test(share): standardise with latest changes [skip ci]
* Automated using myii/ssf-formula#288
1 parent 0760ad5 commit 147c996

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

test/integration/share/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ The `system` library provides easy access to system dependent information:
1313
- `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective
1414
- `system.platform[:family]` provide a family name for Arch and Gentoo
1515
- `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows`
16-
- `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo and Windows:
16+
- `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo, openSUSE and Windows:
1717
- `Arch` is always `base-latest`
1818
- `Amazon Linux` release `2018` is resolved as `1`
1919
- `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`)
20+
- `openSUSE` is resolved as `tumbleweed` if the `platform[:release]` is in date format
2021
- `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version
2122
- `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example)

test/integration/share/libraries/system.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def build_platform_name
4545
end
4646
end
4747

48-
# rubocop:disable Metrics/MethodLength
48+
# rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
4949
def build_platform_release
5050
case inspec.platform[:name]
5151
when 'amazon'
@@ -55,6 +55,10 @@ def build_platform_release
5555
'base-latest'
5656
when 'gentoo'
5757
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
58+
when 'opensuse'
59+
# rubocop:disable Style/NumericLiterals,Layout/LineLength
60+
inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release]
61+
# rubocop:enable Style/NumericLiterals,Layout/LineLength
5862
when 'windows_8.1_pro'
5963
'8.1'
6064
when 'windows_server_2019_datacenter'
@@ -63,15 +67,10 @@ def build_platform_release
6367
inspec.platform[:release]
6468
end
6569
end
66-
# rubocop:enable Metrics/MethodLength
70+
# rubocop:enable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
6771

6872
def derive_gentoo_init_system
69-
case inspec.command('systemctl').exist?
70-
when true
71-
'sysd'
72-
else
73-
'sysv'
74-
end
73+
inspec.command('systemctl').exist? ? 'sysd' : 'sysv'
7574
end
7675

7776
def build_platform_finger

0 commit comments

Comments
 (0)