diff options
author | William Osler <oslerw@fb.com> | 2017-08-05 17:10:28 -0700 |
---|---|---|
committer | William Osler <oslerw@fb.com> | 2017-09-10 11:57:00 -0700 |
commit | 146eb904f7f86897d665ea5f9a82eb9d25762e2d (patch) | |
tree | f06b2505a6618ac54a7f14797bb202005585dea2 /spec | |
parent | 96e32f268ed7fa804cb605ba3d6e9acba74f9d9e (diff) | |
download | ohai-146eb904f7f86897d665ea5f9a82eb9d25762e2d.tar.gz |
Add Arch Linux support to package plugin
Signed-off-by: William Osler <oslerw@fb.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/data/plugins/pacman.output | 51 | ||||
-rw-r--r-- | spec/unit/plugins/packages_spec.rb | 37 |
2 files changed, 88 insertions, 0 deletions
diff --git a/spec/data/plugins/pacman.output b/spec/data/plugins/pacman.output new file mode 100644 index 00000000..382ed1a8 --- /dev/null +++ b/spec/data/plugins/pacman.output @@ -0,0 +1,51 @@ +Name : acl +Version : 2.2.52-3 +Description : Access control list utilities, libraries and headers +Architecture : x86_64 +URL : http://savannah.nongnu.org/projects/acl +Licenses : LGPL +Groups : None +Provides : xfsacl +Depends On : attr>=2.4.46 +Optional Deps : None +Required By : coreutils gettext libarchive logrotate sed shadow systemd tar +Optional For : None +Conflicts With : xfsacl +Replaces : xfsacl +Installed Size : 290.00 KiB +Packager : Bartlomiej Piotrowski <bpiotrowski@archlinux.org> +Build Date : Sun Nov 6 14:03:46 2016 +Install Date : Sun Jul 23 03:25:45 2017 +Install Reason : Installed as a dependency for another package +Install Script : No +Validated By : Signature + +Name : abcde +Version : 2.8.1-2 +Description : Frontend command-line utility that grabs tracks off a CD, encodes them to ogg or mp3 format, and tags them, all in one go +Architecture : any +URL : https://abcde.einval.com/ +Licenses : GPL +Groups : None +Provides : None +Depends On : bash cd-discid wget vorbis-tools python2-eyed3 +Optional Deps : cdparanoia: Paranoia ripping support [installed] + cdrkit: icedax ripping support [installed] + flac: FLAC encoding support [installed] + id3: ID3 v1 tag support + lame: MP3 encoding support [installed] + mp3gain: MP3 normalization support [installed] + perl-musicbrainz-discid: musicbrainz support (AUR) + perl-webservice-musicbrainz: musicbrainz support (AUR) + vorbisgain: Ogg Vorbis normalization support [installed] +Required By : None +Optional For : None +Conflicts With : None +Replaces : None +Installed Size : 334.00 KiB +Packager : Alexander Rødseth <rodseth@gmail.com> +Build Date : Wed Apr 26 02:04:21 2017 +Install Date : Fri May 5 15:36:23 2017 +Install Reason : Explicitly installed +Install Script : No +Validated By : Signature diff --git a/spec/unit/plugins/packages_spec.rb b/spec/unit/plugins/packages_spec.rb index a97c3280..5e5d922f 100644 --- a/spec/unit/plugins/packages_spec.rb +++ b/spec/unit/plugins/packages_spec.rb @@ -102,6 +102,43 @@ describe Ohai::System, "plugin packages" do end end + context "on arch" do + let(:plugin) do + get_plugin("packages").tap do |plugin| + plugin[:platform_family] = "arch" + end + end + + let(:stdout) do + File.read(File.join(SPEC_PLUGIN_PATH, "pacman.output")) + end + + before(:each) do + allow(plugin).to receive(:collect_os).and_return(:linux) + allow(plugin).to receive(:shell_out).with("LANG=C pacman -Qi").and_return(mock_shell_out(0, stdout, "")) + plugin.run + end + + it "calls LANG=C pacman -Qi" do + expect(plugin).to receive(:shell_out) + .with("LANG=C pacman -Qi") + .and_return(mock_shell_out(0, stdout, "")) + plugin.run + end + + it "gets packages and versions/release - normal case" do + expect(plugin[:packages]["acl"][:version]).to eq("2.2.52-3") + expect(plugin[:packages]["acl"][:installdate]).to eq("1500780345") + expect(plugin[:packages]["acl"][:arch]).to eq("x86_64") + end + + it "gets packages and versions/release - multiline optdeps" do + expect(plugin[:packages]["abcde"][:version]).to eq("2.8.1-2") + expect(plugin[:packages]["abcde"][:installdate]).to eq("1493998583") + expect(plugin[:packages]["abcde"][:arch]).to eq("any") + end + end + context "on windows", :windows_only do let(:plugin) do |