[Pkg-puppet-devel] [facter] 54/352: (Maint) Execute test on all agents using beaker's DSL method

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:31 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 e6d76f8b2926a4830a79647daf18a7b0168c9add
Author: Josh Cooper <josh at puppetlabs.com>
Date:   Thu Dec 5 14:30:53 2013 -0800

    (Maint) Execute test on all agents using beaker's DSL method
    
    Previously, the test was only executing on the first agent host, and it
    attempted to run facter directly, which fails on windows when executing
    via ssh, because facter is a .bat file, not an executable.
    
    This commit updates the test to run on all agent hosts, and it uses
    beaker's built-in DSL method for executing facter, which ultimately
    executes:
    
        cmd /c facter --puppet test_fact1
    
    It also uses beaker's method for passing environment variables to the
    command being executed.
---
 .../ticket_7039_facter_multiple_facts_one_file.rb  | 27 ++++++++++++----------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb b/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb
index 76da065..9a5a3e7 100644
--- a/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb
+++ b/acceptance/tests/ticket_7039_facter_multiple_facts_one_file.rb
@@ -14,18 +14,21 @@ Facter.add(:test_fact2) do
 end
 }
 
-agent1=agents.first
-step "Agent: Create fact file with multiple facts"
-create_remote_file(agent1, '/tmp/test_facts.rb', fact_file )
+agents.each do |agent|
+  step "Agent: Create fact file with multiple facts"
+  dir = agent.tmpdir('facter7039')
+  create_remote_file(agent, "#{dir}/test_facts.rb", fact_file)
+  env = { 'FACTERLIB' => dir }
 
-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_fact1 from #{dir}/test_facts.rb"
+  on(agent, facter('--puppet', 'test_fact1', :environment => env)) 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'
+  step "Agent: Verify test_fact2 from #{dir}/test_facts.rb"
+  on(agent, facter('--puppet', 'test_fact2', :environment => env)) do
+    fail_test "Fact 1 not returned by facter --puppet test_fact2" unless
+      stdout.include? 'test fact 2'
+  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