summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-10-30 04:07:52 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-10-30 04:07:52 +0000
commitba76eb2da506aee52b5bbbce842fa5ac361540a0 (patch)
tree10016d5b84c55993c5e9391142733a78981de453
parente605a5c181ef8cd2ec57384c7816bf1f7980aedb (diff)
downloadpuppet-ba76eb2da506aee52b5bbbce842fa5ac361540a0.tar.gz
puppet-ba76eb2da506aee52b5bbbce842fa5ac361540a0.tar.xz
puppet-ba76eb2da506aee52b5bbbce842fa5ac361540a0.zip
Cleaning up tests resulting from the changes to the parser
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@737 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type.rb13
-rwxr-xr-xlib/puppet/type/cron.rb2
-rw-r--r--lib/puppet/type/pfile.rb6
-rwxr-xr-xtest/language/snippets.rb2
-rw-r--r--test/puppettest.rb5
-rw-r--r--test/tagging/tagging.rb2
-rw-r--r--test/types/basic.rb2
-rwxr-xr-xtest/types/cron.rb4
-rw-r--r--test/types/type.rb20
9 files changed, 22 insertions, 34 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 9d728c07c..0735d3945 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -669,14 +669,17 @@ class Type < Puppet::Element
# now pass through and create the new object
elsif implicit
- Puppet.warning "Ignoring implicit %s" % name
+ Puppet.notice "Ignoring implicit %s" % name
return retobj
else
- # merge the new data
- retobj.merge(hash)
+ # We will probably want to support merging of some kind in
+ # the future, but for now, just throw an error.
+ raise Puppet::Error, "%s %s is already being managed" %
+ [self.name, name]
+ #retobj.merge(hash)
- return retobj
+ #return retobj
end
end
@@ -916,7 +919,7 @@ class Type < Puppet::Element
if defined? @parent
@path = [@parent.path, self.name].flatten.to_s
else
- @path = self.name
+ @path = self.name.to_s
end
end
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index f237ecd7d..88ea83b4d 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -310,7 +310,7 @@ module Puppet
raise Puppet::DevError, "No command for %s" % name
end
# if the cron already exists with that name...
- if cron = Puppet::Type::Cron[hash[:command]]
+ if cron = Puppet::Type::Cron[name]
# do nothing...
elsif tmp = @instances[user].reject { |obj|
! obj.is_a?(Cron)
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index 2c2e8ab4f..fd9831447 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -175,12 +175,12 @@ module Puppet
def path
if defined? @parent
if @parent.is_a?(self.class)
- return [@parent.path, File.basename(self.name)].flatten
+ return [@parent.path, File.basename(self.name)].flatten.to_s
else
- return [@parent.path, self.name].flatten
+ return [@parent.path, self.name].flatten.to_s
end
else
- return [self.name]
+ return [self.name].to_s
end
end
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 3749ea24d..3d9808091 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -221,7 +221,7 @@ class TestSnippets < Test::Unit::TestCase
}
assert_nothing_raised {
- assert_equal(%w{puppet[top] testing[testing] component[componentname] /tmp/classtest}, obj.path)
+ assert_equal(%w{puppet[top] testing[testing] component[componentname] /tmp/classtest}.to_s, obj.path)
#Puppet.err obj.path
}
diff --git a/test/puppettest.rb b/test/puppettest.rb
index ccaa027cd..d38de89a2 100644
--- a/test/puppettest.rb
+++ b/test/puppettest.rb
@@ -1,10 +1,11 @@
-require 'test/unit'
-
libdir = File.join(File.dirname(__FILE__), '../lib')
unless $:.include?(libdir)
$:.unshift libdir
end
+require 'puppet'
+require 'test/unit'
+
module TestPuppet
def newcomp(name,*ary)
comp = Puppet::Type::Component.create(
diff --git a/test/tagging/tagging.rb b/test/tagging/tagging.rb
index 260e0e53a..2cd1e18b3 100644
--- a/test/tagging/tagging.rb
+++ b/test/tagging/tagging.rb
@@ -71,7 +71,7 @@ class TestTagging < Test::Unit::TestCase
object = objects.shift
assert_nothing_raised {
- assert_equal(%w{solaris file /etc/passwd}, object.tags,
+ assert_equal(%w{solaris}, object.tags,
"Incorrect tags")
}
end
diff --git a/test/types/basic.rb b/test/types/basic.rb
index 4ad6d559b..8cc5e406c 100644
--- a/test/types/basic.rb
+++ b/test/types/basic.rb
@@ -110,7 +110,7 @@ class TestBasic < Test::Unit::TestCase
def test_paths
[@configfile,@sleeper,@component].each { |obj|
assert_nothing_raised {
- assert(obj.path.is_a?(Array))
+ assert_instance_of(String, obj.path)
}
}
end
diff --git a/test/types/cron.rb b/test/types/cron.rb
index ffefba3c1..f26dd69ef 100755
--- a/test/types/cron.rb
+++ b/test/types/cron.rb
@@ -166,7 +166,7 @@ class TestExec < Test::Unit::TestCase
cronback
Puppet::Type::Cron.crontype.remove(@me)
- cron = mkcron("crontest")
+ cron = mkcron("testwithnotab")
cyclecron(cron)
cronrestore
end
@@ -178,7 +178,7 @@ class TestExec < Test::Unit::TestCase
"1 1 1 1 * date > %s/crontesting\n" % testdir()
)
- cron = mkcron("crontest")
+ cron = mkcron("testwithtab")
cyclecron(cron)
cronrestore
end
diff --git a/test/types/type.rb b/test/types/type.rb
index 55b809372..87ca8077a 100644
--- a/test/types/type.rb
+++ b/test/types/type.rb
@@ -122,27 +122,11 @@ class TestType < Test::Unit::TestCase
)
}
- # Make an identical statement
- assert_nothing_raised {
- Puppet::Type::PFile.create(
- :path => file,
- :owner => ["root", "bin"]
- )
- }
-
- # Create a conflicting statement
+ # Make sure no other statements are allowed
assert_raise(Puppet::Error) {
Puppet::Type::PFile.create(
:path => file,
- :owner => ["root", "bin", "adm"]
- )
- }
-
- # And then make an intersection with one valid value
- assert_nothing_raised {
- Puppet::Type::PFile.create(
- :path => file,
- :owner => "root"
+ :group => "root"
)
}
end