[Pkg-puppet-devel] [facter] 91/180: (#19293) Unit tests for openbsd kernelrelease fact

Stig Sandbeck Mathisen ssm at debian.org
Mon Jun 30 15:06:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 1e967b54ebd8b2ad8f6f3ec8291334f9df1307cb
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Wed Jun 12 11:24:08 2013 -0700

    (#19293) Unit tests for openbsd kernelrelease fact
---
 spec/fixtures/unit/kernelrelease/openbsd-5.3         |  2 ++
 spec/fixtures/unit/kernelrelease/openbsd-5.3-current |  3 +++
 spec/unit/kernelrelease_spec.rb                      | 16 ++++++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/spec/fixtures/unit/kernelrelease/openbsd-5.3 b/spec/fixtures/unit/kernelrelease/openbsd-5.3
new file mode 100644
index 0000000..181030d
--- /dev/null
+++ b/spec/fixtures/unit/kernelrelease/openbsd-5.3
@@ -0,0 +1,2 @@
+OpenBSD 5.3 (GENERIC.MP) #2: Fri May 17 15:54:55 CEST 2013
+root at binpatch-53-i386.mtier.org:/home/jasper/binpatchng/work-binpatch53-i386/src/sys/arch/i386/compile/GENERIC.MP
diff --git a/spec/fixtures/unit/kernelrelease/openbsd-5.3-current b/spec/fixtures/unit/kernelrelease/openbsd-5.3-current
new file mode 100644
index 0000000..c1b4913
--- /dev/null
+++ b/spec/fixtures/unit/kernelrelease/openbsd-5.3-current
@@ -0,0 +1,3 @@
+OpenBSD 5.3-current (GENERIC.MP) #130: Wed Jun 5 15:15:03 MDT 2013
+deraadt at amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
+
diff --git a/spec/unit/kernelrelease_spec.rb b/spec/unit/kernelrelease_spec.rb
index d0a5133..39f7cfa 100644
--- a/spec/unit/kernelrelease_spec.rb
+++ b/spec/unit/kernelrelease_spec.rb
@@ -50,4 +50,20 @@ describe "Kernel release fact" do
       Facter.fact(:kernelrelease).value.should == "test_kernel"
     end
   end
+
+  describe 'on OpenBSD' do
+    before do
+      Facter.fact(:kernel).stubs(:value).returns :openbsd
+    end
+
+    it 'parses 5.3-current sysctl output' do
+      Facter::Util::Resolution.expects(:exec).with("/sbin/sysctl -n kern.version").returns(my_fixture_read('openbsd-5.3-current'))
+      Facter.value(:kernelrelease).should == '5.3-current'
+    end
+
+    it 'parses 5.3 sysctl output' do
+      Facter::Util::Resolution.expects(:exec).with("/sbin/sysctl -n kern.version").returns(my_fixture_read('openbsd-5.3'))
+      Facter.value(:kernelrelease).should == '5.3'
+    end
+  end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list