summaryrefslogtreecommitdiffstats
path: root/acceptance/tests/apply/virtual
diff options
context:
space:
mode:
authorDominic Maraglia <dmaraglia@gmail.com>2011-04-20 14:58:26 -0700
committerDominic Maraglia <dmaraglia@gmail.com>2011-04-20 14:58:26 -0700
commitac428b9557e2da251e4b51e48de844833ca0aa2a (patch)
treeb3ccc5cf1a0dae6e2662dc61855281dc6ba8e8d5 /acceptance/tests/apply/virtual
parent97e9e5f223cb7baefd52456e2324c592fe415dca (diff)
downloadpuppet-ac428b9557e2da251e4b51e48de844833ca0aa2a.tar.gz
puppet-ac428b9557e2da251e4b51e48de844833ca0aa2a.tar.xz
puppet-ac428b9557e2da251e4b51e48de844833ca0aa2a.zip
Move tests from Puppet-acceptance repo
Diffstat (limited to 'acceptance/tests/apply/virtual')
-rwxr-xr-xacceptance/tests/apply/virtual/should_realize.rb22
-rwxr-xr-xacceptance/tests/apply/virtual/should_realize_complex_query.rb36
-rwxr-xr-xacceptance/tests/apply/virtual/should_realize_many.rb22
-rwxr-xr-xacceptance/tests/apply/virtual/should_realize_query.rb24
-rwxr-xr-xacceptance/tests/apply/virtual/should_realize_query_array.rb24
5 files changed, 128 insertions, 0 deletions
diff --git a/acceptance/tests/apply/virtual/should_realize.rb b/acceptance/tests/apply/virtual/should_realize.rb
new file mode 100755
index 000000000..fd32ad859
--- /dev/null
+++ b/acceptance/tests/apply/virtual/should_realize.rb
@@ -0,0 +1,22 @@
+test_name "should realize"
+out = "/tmp/hosts-#{Time.new.to_i}"
+name = "test-#{Time.new.to_i}-host"
+
+manifest = %Q{
+ @host{'#{name}': ip=>'127.0.0.2', target=>'#{out}', ensure=>present}
+ realize(Host['#{name}'])
+}
+
+step "clean the system ready for testing"
+on agents, "rm -f #{out}"
+
+step "realize the resource on the hosts"
+apply_manifest_on agents, manifest
+
+step "verify the content of the file"
+on(agents, "cat #{out}") do
+ fail_test "missing host definition" unless stdout.include? name
+end
+
+step "final cleanup of the system"
+on agents, "rm -f #{out}"
diff --git a/acceptance/tests/apply/virtual/should_realize_complex_query.rb b/acceptance/tests/apply/virtual/should_realize_complex_query.rb
new file mode 100755
index 000000000..9782bbfac
--- /dev/null
+++ b/acceptance/tests/apply/virtual/should_realize_complex_query.rb
@@ -0,0 +1,36 @@
+test_name "should realize with complex query"
+out = "/tmp/hosts-#{Time.new.to_i}"
+name = "test-#{Time.new.to_i}-host"
+
+manifest = %Q{
+ @host { '#{name}1':
+ ip => '127.0.0.2',
+ target => '#{out}',
+ host_aliases => ['one', 'two', 'three'],
+ ensure => present,
+ }
+ @host { '#{name}2':
+ ip => '127.0.0.3',
+ target => '#{out}',
+ host_aliases => 'two',
+ ensure => present,
+ }
+ Host<| host_aliases == 'two' and ip == '127.0.0.3' |>
+}
+
+step "clean up target system for test"
+on agents, "rm -f #{out}"
+
+step "run the manifest"
+apply_manifest_on agents, manifest
+
+step "verify the file output"
+on(agents, "cat #{out}") do
+ fail_test "second host not found in output" unless
+ stdout.include? "#{name}2"
+ fail_test "first host was found in output" if
+ stdout.include? "#{name}1"
+end
+
+step "clean up system after testing"
+on agents, "rm -f #{out}"
diff --git a/acceptance/tests/apply/virtual/should_realize_many.rb b/acceptance/tests/apply/virtual/should_realize_many.rb
new file mode 100755
index 000000000..8f53caefe
--- /dev/null
+++ b/acceptance/tests/apply/virtual/should_realize_many.rb
@@ -0,0 +1,22 @@
+test_name "test that realize function takes a list"
+out = "/tmp/hosts-#{Time.new.to_i}"
+name = "test-#{Time.new.to_i}-host"
+
+manifest = %Q{
+ @host{'#{name}1': ip=>'127.0.0.2', target=>'#{out}', ensure=>present}
+ @host{'#{name}2': ip=>'127.0.0.2', target=>'#{out}', ensure=>present}
+ realize(Host['#{name}1'], Host['#{name}2'])
+}
+
+
+step "clean up target system for test"
+on agents, "rm -f #{out}"
+
+step "run the manifest"
+apply_manifest_on agents, manifest
+
+step "verify the file output"
+on(agents, "cat #{out}") do
+ fail_test "first host not found in output" unless stdout.include? "#{name}1"
+ fail_test "second host not found in output" unless stdout.include? "#{name}2"
+end
diff --git a/acceptance/tests/apply/virtual/should_realize_query.rb b/acceptance/tests/apply/virtual/should_realize_query.rb
new file mode 100755
index 000000000..24d323373
--- /dev/null
+++ b/acceptance/tests/apply/virtual/should_realize_query.rb
@@ -0,0 +1,24 @@
+test_name "should realize query"
+out = "/tmp/hosts-#{Time.new.to_i}"
+name = "test-#{Time.new.to_i}-host"
+
+manifest = %Q{
+ @host { '#{name}':
+ ip => '127.0.0.2',
+ target => '#{out}',
+ host_aliases => 'alias',
+ ensure => present,
+ }
+ Host<| ip == '127.0.0.2' |>
+}
+
+step "clean up target system for test"
+on agents, "rm -f #{out}"
+
+step "run the manifest"
+apply_manifest_on agents, manifest
+
+step "verify the file output"
+on(agents, "cat #{out}") do
+ fail_test "host not found in output" unless stdout.include? name
+end
diff --git a/acceptance/tests/apply/virtual/should_realize_query_array.rb b/acceptance/tests/apply/virtual/should_realize_query_array.rb
new file mode 100755
index 000000000..137d93b1a
--- /dev/null
+++ b/acceptance/tests/apply/virtual/should_realize_query_array.rb
@@ -0,0 +1,24 @@
+test_name "should realize query array"
+out = "/tmp/hosts-#{Time.new.to_i}"
+name = "test-#{Time.new.to_i}-host"
+
+manifest = %Q{
+ @host { '#{name}':
+ ip => '127.0.0.2',
+ target => '#{out}',
+ host_aliases => ['one', 'two', 'three'],
+ ensure => present,
+ }
+ Host<| host_aliases == 'two' |>
+}
+
+step "clean up target system for test"
+on agents, "rm -f #{out}"
+
+step "run the manifest"
+apply_manifest_on agents, manifest
+
+step "verify the file output"
+on(agents, "cat #{out}") do
+ fail_test "host not found in output" unless stdout.include? name
+end