summaryrefslogtreecommitdiffstats
path: root/acceptance/tests
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-05-31 15:37:30 -0700
committerNick Lewis <nick@puppetlabs.com>2011-05-31 15:37:30 -0700
commit97927e321d1e24554ad21b92ef4afb1bd64c0167 (patch)
treedf2f82066114918911670749887812674e4a72e1 /acceptance/tests
parent59173268a5c6525a4a5df55b362775d07bc6b52d (diff)
parent9404a7a3bb8da660e26897d052cdd03c291fb0bb (diff)
downloadfacter-master.tar.gz
facter-master.tar.xz
facter-master.zip
Merge branch 'ticket/master/7670'HEADmaster
Diffstat (limited to 'acceptance/tests')
-rw-r--r--acceptance/tests/operatingsystem_detection_after_clear_on_ubuntu.rb18
-rw-r--r--acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb31
2 files changed, 49 insertions, 0 deletions
diff --git a/acceptance/tests/operatingsystem_detection_after_clear_on_ubuntu.rb b/acceptance/tests/operatingsystem_detection_after_clear_on_ubuntu.rb
new file mode 100644
index 0000000..3c7c4d9
--- /dev/null
+++ b/acceptance/tests/operatingsystem_detection_after_clear_on_ubuntu.rb
@@ -0,0 +1,18 @@
+test_name "#7670: Facter should properly detect operatingsystem on Ubuntu after a clear"
+
+script_contents = <<-OS_DETECT
+ require 'facter'
+ Facter['operatingsystem'].value
+ Facter.clear
+ exit Facter['operatingsystem'].value == 'Ubuntu'
+OS_DETECT
+
+script_name = "/tmp/facter_os_detection_test_#{$$}"
+
+agents.each do |agent|
+ next unless agent['platform'].include? 'ubuntu'
+
+ create_remote_file(agent, script_name, script_contents)
+
+ on(agent, "ruby #{script_name}")
+end
diff --git a/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb b/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb
new file mode 100644
index 0000000..fb78628
--- /dev/null
+++ b/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb
@@ -0,0 +1,31 @@
+test_name "#7039: Facter having issue handling multiple facts in a single file"
+
+fact_file= %q{
+Facter.add(:test_fact1) do
+ setcode do
+ "test fact 1"
+ end
+end
+
+Facter.add(:test_fact2) do
+ setcode do
+ "test fact 2"
+ end
+end
+}
+
+agent1=agents.first
+step "Agent: Create fact file with multiple facts"
+create_remote_file(agent1, '/tmp/test_facts.rb', fact_file )
+
+step "Agent: Verify test_fact1 from /tmp/test_facts.rb"
+on(agent1, "export FACTERLIB=/tmp && facter --puppet test_fact1") do
+ fail_test "Fact 1 not returned by facter --puppet test_fact1" unless
+ stdout.include? 'test fact 1'
+end
+
+step "Agent: Verify test_fact2 from /tmp/test_facts.rb"
+on(agent1, "export FACTERLIB=/tmp && facter --puppet test_fact2") do
+ fail_test "Fact 1 not returned by facter --puppet test_fact2" unless
+ stdout.include? 'test fact 2'
+end