summaryrefslogtreecommitdiff
path: root/spec/unit/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet')
-rw-r--r--spec/unit/puppet/provider/ec2/ec2.rb40
-rw-r--r--spec/unit/puppet/type/ec2.rb125
-rw-r--r--spec/unit/puppet/util/ec2.rb34
3 files changed, 0 insertions, 199 deletions
diff --git a/spec/unit/puppet/provider/ec2/ec2.rb b/spec/unit/puppet/provider/ec2/ec2.rb
deleted file mode 100644
index 1846147..0000000
--- a/spec/unit/puppet/provider/ec2/ec2.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
-
-provider_class = Puppet::Type.type(:ec2).provider(:ec2)
-
-describe provider_class do
- before do
- @resource = stub("resource")
- @provider = provider_class.new(@resource)
- end
-
-# it "should not be suitable if the 'aws' libraries are missing" do
-# Puppet.features.expects(:aws?).returns false
-# provider_class.should_not be_suitable
-# end
-
-# it "should be suitable if the 'aws' libraries are present" do
-# Puppet.features.expects(:aws?).returns true
-# provider_class.should be_suitable
-# end
-
-# it "should be present if provided an 'ensure' value of 'present'" do
-# provider_class.new(:ensure => :present).should be_exists
-# end
-#
-# it "should be absent if provided an 'ensure' value of 'absent'" do
-# provider_class.new(:ensure => :absent).should_not be_exists
-# end
-#
-# it "should be absent if not provided an 'ensure' value" do
-# provider_class.new({}).should_not be_exists
-# end
-#
-# it "should be absent if provided with a resource rather than an 'ensure' value" do
-# provider_class.new(@resource).should_not be_exists
-# end
-
-# it "should accept an instance_id at initialization" do
-# provider_class.new(:instance_id => 50).instance_id.should == 50
-# end
-end
diff --git a/spec/unit/puppet/type/ec2.rb b/spec/unit/puppet/type/ec2.rb
deleted file mode 100644
index ce3d51c..0000000
--- a/spec/unit/puppet/type/ec2.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
-
-describe Puppet::Type.type(:ec2) do
- before do
- @type = Puppet::Type.type(:ec2)
- stub_default_provider!
- @valid_types = [
- 'm1.small', 'm1.large', 'm1.xlarge',
- 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge',
- 'c1.medium', 'c1.xlarge'
- ]
- @valid_params = {
- :name => :name,
- :ensure => :present,
- :user => 'user',
- :password => 'password',
- :image => 'image',
- :desc => 'description'
-
- }
- end
-
- it "should exist" do
- @type.should_not be_nil
- end
-
- describe "the name parameter" do
- it "should exist" do
- @type.attrclass(:name).should_not be_nil
- end
- it 'values should be prefixed with PUPPET_' do
- with(valid_params)[:name].should == "PUPPET_#{valid_params[:name]}"
- end
- it 'should be required' do
- specifying(valid_params_without(:name)).should raise_error(Puppet::Error)
- end
- end
-
- describe "the user parameter" do
- it "should exist" do
- @type.attrclass(:user).should_not be_nil
- end
- it 'should support setting a value' do
- with(valid_params)[:user].should == valid_params[:user]
- end
- # I think isrequired is broken
- it 'should be required' do
- specifying(valid_params_without(:user)).should raise_error(Puppet::Error)
- end
- end
-
- describe "the password parameter" do
- it "should exist" do
- @type.attrclass(:password).should_not be_nil
- end
- it 'should support setting a value' do
- with(valid_params)[:password].should == valid_params[:password]
- end
- it 'should be required' do
- specifying(valid_params_without(:password)).should raise_error(Puppet::Error)
- end
- end
-
- describe "the image parameter" do
- it "should exist" do
- @type.attrclass(:image).should_not be_nil
- end
- it 'should be required' do
- specifying(valid_params_without(:image)).should raise_error(Puppet::Error)
- end
- it 'should support setting a value' do
- with(valid_params)[:image].should == valid_params[:image]
- end
- end
-
- describe "the desc parameter" do
- it "should exist" do
- @type.attrclass(:desc).should_not be_nil
- end
- it 'should not be required' do
- specifying(valid_params_without(:desc)).should_not raise_error(Puppet::Error)
- end
- it 'should accept a value' do
- with(valid_params)[:desc].should == 'description'
- end
- end
-
- describe 'the type parameter' do
- it 'should exist' do
- @type.attrclass(:type).should_not be_nil
- end
- it 'should accept valid ec2 types' do
- @valid_types.each do |t|
- with(valid_params_with({:type => t}))[:type].should == t
- end
- end
- it 'should not accept invalid types' do
- specifying(:type => 'm1.freakin-huge').should raise_error(Puppet::Error)
- end
- it 'should default to m1.small' do
- with(valid_params_without(:type)) do |resource|
- resource[:type].should == 'm1.small'
- end
- end
- end
- describe "when specifying the 'ensure' parameter" do
- it "should exist" do
- @type.attrclass(:ensure).should_not be_nil
- end
- it "should support 'present' as a value" do
- with(valid_params_with({:ensure => :present}))[:ensure].should == :present
- end
- it "should support 'absent' as a value" do
- with(valid_params.merge(:ensure => :absent)) do |resource|
- resource[:ensure].should == :absent
- end
- end
- it "should not support other values" do
- specifying(valid_params.merge(:ensure => :foobar)).should raise_error(Puppet::Error)
- end
- it 'should not be required' do
- specifying(valid_params_without(:ensure)).should_not raise_error(Puppet::Error)
- end
- end
-end
diff --git a/spec/unit/puppet/util/ec2.rb b/spec/unit/puppet/util/ec2.rb
deleted file mode 100644
index c8757ee..0000000
--- a/spec/unit/puppet/util/ec2.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
-
-require 'puppet/util/ec2'
-
-class Ec2Helper
- include Puppet::Util::Ec2
-end
-
-# LAK: This way the constants exist, but I expect we'll regret this
-unless Puppet.features.aws?
- class AWS
- class EC2
- class Base
- end
- end
- end
-end
-
-describe Puppet::Util::Ec2 do
- before do
- @helper = Ec2Helper.new
- end
-
- it "should use AWS::Base to create an EC2 connection" do
- AWS::EC2::Base.expects(:new).with(:access_key_id => "myuser", :secret_access_key => "mypass")
- @helper.ec2_connection("myuser", "mypass")
- end
-
- it "should call foo and bar when calling baz" do
- @helper.stubs(:foo).returns "yay"
- @helper.expects(:bar).with("yay").returns "yip"
- @helper.baz.should == "yip"
- end
-end