summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-13 20:55:13 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-13 20:55:13 +0000
commita6e367e5989d0646c2f53c2de839893be76988cb (patch)
tree188239cf15caa5f0a31caf32c8f68e86159b8ce5 /test
parentc8b64014f1018dd437d1a0bd17db96b312e8af8a (diff)
Changing host and port aliases to also create Puppet aliases. This involved futzing around with the attr* methods in Type.rb, to make sure states are always checked first.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@823 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/types/host.rb21
-rwxr-xr-xtest/types/port.rb4
2 files changed, 20 insertions, 5 deletions
diff --git a/test/types/host.rb b/test/types/host.rb
index 4c3c6d142..b79c38e16 100755
--- a/test/types/host.rb
+++ b/test/types/host.rb
@@ -38,7 +38,7 @@ class TestHost < Test::Unit::TestCase
host = Puppet.type(:host).create(
:name => "culain",
:ip => "192.168.0.3",
- :aliases => "puppet"
+ :alias => "puppet"
)
}
@@ -90,17 +90,32 @@ class TestHost < Test::Unit::TestCase
# This was a hard bug to track down.
assert_instance_of(String, host.is(:ip))
- host[:aliases] = %w{madstop kirby yayness}
+ host[:alias] = %w{madstop kirby yayness}
assert_events([:host_changed], host)
end
+ def test_aliasisstate
+ assert_equal(:state, @hosttype.attrtype(:alias))
+ end
+
def test_multivalues
host = mkhost
assert_raise(Puppet::Error) {
- host[:aliases] = "puppetmasterd yayness"
+ host[:alias] = "puppetmasterd yayness"
}
end
+
+ def test_puppetalias
+ host = mkhost()
+
+ assert_nothing_raised {
+ host[:alias] = "testing"
+ }
+
+ same = host.class["testing"]
+ assert(same, "Could not retrieve by alias")
+ end
end
# $Id$
diff --git a/test/types/port.rb b/test/types/port.rb
index 74a445a94..688a0b622 100755
--- a/test/types/port.rb
+++ b/test/types/port.rb
@@ -40,7 +40,7 @@ class TestPort < Test::Unit::TestCase
:number => 8139,
:protocols => "tcp",
:description => "The port that Puppet runs on",
- :aliases => "coolness"
+ :alias => "coolness"
)
}
@@ -117,7 +117,7 @@ class TestPort < Test::Unit::TestCase
port[:protocols] = "udp tcp"
}
assert_raise(Puppet::Error) {
- port[:aliases] = "puppetmasterd yayness"
+ port[:alias] = "puppetmasterd yayness"
}
end
end