Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit 495d124

Browse files
author
Helen
authored
Merge pull request #397 from hunner/comment_iam_tests
(maint) Comment out iam acceptance tests
2 parents db1c767 + 2864698 commit 495d124

File tree

3 files changed

+241
-241
lines changed

3 files changed

+241
-241
lines changed
Lines changed: 134 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,134 @@
1-
require 'spec_helper_acceptance'
2-
require 'securerandom'
3-
4-
describe 'iam_instance_profile' do
5-
before(:all) do
6-
@default_region = 'us-east-1'
7-
@aws = AwsHelper.new(@default_region)
8-
@template = 'iam_instance_profile.pp.tmpl'
9-
end
10-
11-
def get_role(name)
12-
roles = @aws.get_iam_roles(name)
13-
expect(roles.count).to eq(1)
14-
roles.first
15-
end
16-
17-
def get_instance_profile(name)
18-
instance_profiles = @aws.get_iam_instance_profiles(name)
19-
expect(instance_profiles.count).to eq(1)
20-
instance_profiles.first
21-
end
22-
23-
describe 'managing as puppet resource' do
24-
before :all do
25-
@name = "#{SecureRandom.uuid}"
26-
27-
@config = {
28-
:role_name => @name,
29-
:profile_name => @name,
30-
:path_prefix => "/#{SecureRandom.hex(8)}/",
31-
:ensure => 'present',
32-
}
33-
end
34-
35-
it "should create properly with only defaults" do
36-
profile_options = { :name => @config[:profile_name], :path => @config[:path_prefix], :ensure => @config[:ensure] }
37-
result = TestExecutor.puppet_resource('iam_instance_profile', profile_options, '--modulepath spec/fixtures/modules/')
38-
expect(result.stderr).not_to match(/Error:/)
39-
end
40-
41-
it "should have the specified name" do
42-
profile = get_instance_profile(@config[:profile_name])
43-
expect(profile.instance_profile_name).to eq(@config[:profile_name])
44-
end
45-
46-
it "should have a valid ARN" do
47-
profile = get_instance_profile(@config[:profile_name])
48-
expect(profile.arn).to match(/^arn\:aws\:iam\:\:\d+\:\S+$/)
49-
expect(profile.arn).to include("#{@config[:path]}#{@config[:profile_name]}")
50-
end
51-
52-
it "should accept a role assignment after the fact" do
53-
role_options = { :name => @config[:role_name], :path => @config[:path_prefix], :ensure => @config[:ensure] }
54-
result = TestExecutor.puppet_resource('iam_role', role_options, '--modulepath spec/fixtures/modules/ --trace')
55-
expect(result.stderr).not_to match(/Error:/)
56-
57-
profile_options = { :name => @config[:profile_name], :path => @config[:path_prefix], :ensure => @config[:ensure], :roles => @config[:role_name] }
58-
result = TestExecutor.puppet_resource('iam_instance_profile', profile_options, '--modulepath spec/fixtures/modules/ --trace')
59-
expect(result.stderr).not_to match(/Error:/)
60-
end
61-
62-
it "should accept policy attachment" do
63-
policy_options = { :name => 'IAMFullAccess', :roles => @config[:role_name] }
64-
result = TestExecutor.puppet_resource('iam_policy_attachment', policy_options, '--modulepath spec/fixtures/modules/ --trace')
65-
expect(result.stderr).not_to match(/Error:/)
66-
end
67-
68-
it "should destroy and cleanup properly" do
69-
new_config = @config.update({:ensure => 'absent'})
70-
71-
role_options = { :name => new_config[:role_name], :path => @config[:path_prefix], :ensure => new_config[:ensure] }
72-
result = TestExecutor.puppet_resource('iam_role', role_options, '--modulepath spec/fixtures/modules/ --trace')
73-
expect(result.stderr).not_to match(/Error:/)
74-
75-
profile_options = { :name => new_config[:profile_name], :path => @config[:path_prefix], :ensure => new_config[:ensure] }
76-
result = TestExecutor.puppet_resource('iam_instance_profile', profile_options, '--modulepath spec/fixtures/modules/ --trace')
77-
expect(result.stderr).not_to match(/Error:/)
78-
end
79-
80-
end
81-
82-
describe 'managing via puppet manifest apply' do
83-
84-
before (:all) do
85-
@name = "#{SecureRandom.uuid}"
86-
@path_prefix = "/#{SecureRandom.hex(8)}/"
87-
@role_policy_json = <<-'JSON'
88-
{
89-
"Version": "2012-10-17",
90-
"Statement": [
91-
{
92-
"Effect": "Allow",
93-
"Principal": {
94-
"Service": "ec2.amazonaws.com"
95-
},
96-
"Action": "sts:AssumeRole"
97-
}
98-
]
99-
}
100-
JSON
101-
102-
@config = {
103-
:role_name => @name,
104-
:profile_name => @name,
105-
:path => @path_prefix,
106-
:role_policy_document => @role_policy_json.strip.gsub(/\r\n?/, " "),
107-
:ensure => 'present',
108-
}
109-
end
110-
111-
it "should compile and apply" do
112-
result = PuppetManifest.new(@template, @config).apply
113-
expect(result.stderr).not_to match(/Error:/)
114-
end
115-
116-
it "with the specified name" do
117-
profile = get_instance_profile(@config[:profile_name])
118-
expect(profile.instance_profile_name).to eq(@config[:profile_name])
119-
end
120-
121-
it "should have valid ARN" do
122-
profile = get_instance_profile(@config[:profile_name])
123-
expect(profile.arn).to match(/^arn\:aws\:iam\:\:\d+\:\S+$/)
124-
expect(profile.arn).to include("#{@config[:path]}#{@config[:profile_name]}")
125-
end
126-
127-
it "should cleanup properly" do
128-
new_config = @config.update({:ensure => 'absent'})
129-
result = PuppetManifest.new(@template, new_config).apply
130-
expect(result.stderr).not_to match(/Error:/)
131-
end
132-
end
133-
134-
end
1+
#require 'spec_helper_acceptance'
2+
#require 'securerandom'
3+
#
4+
#describe 'iam_instance_profile' do
5+
# before(:all) do
6+
# @default_region = 'us-east-1'
7+
# @aws = AwsHelper.new(@default_region)
8+
# @template = 'iam_instance_profile.pp.tmpl'
9+
# end
10+
#
11+
# def get_role(name)
12+
# roles = @aws.get_iam_roles(name)
13+
# expect(roles.count).to eq(1)
14+
# roles.first
15+
# end
16+
#
17+
# def get_instance_profile(name)
18+
# instance_profiles = @aws.get_iam_instance_profiles(name)
19+
# expect(instance_profiles.count).to eq(1)
20+
# instance_profiles.first
21+
# end
22+
#
23+
# describe 'managing as puppet resource' do
24+
# before :all do
25+
# @name = "#{SecureRandom.uuid}"
26+
#
27+
# @config = {
28+
# :role_name => @name,
29+
# :profile_name => @name,
30+
# :path_prefix => "/#{SecureRandom.hex(8)}/",
31+
# :ensure => 'present',
32+
# }
33+
# end
34+
#
35+
# it "should create properly with only defaults" do
36+
# profile_options = { :name => @config[:profile_name], :path => @config[:path_prefix], :ensure => @config[:ensure] }
37+
# result = TestExecutor.puppet_resource('iam_instance_profile', profile_options, '--modulepath spec/fixtures/modules/')
38+
# expect(result.stderr).not_to match(/Error:/)
39+
# end
40+
#
41+
# it "should have the specified name" do
42+
# profile = get_instance_profile(@config[:profile_name])
43+
# expect(profile.instance_profile_name).to eq(@config[:profile_name])
44+
# end
45+
#
46+
# it "should have a valid ARN" do
47+
# profile = get_instance_profile(@config[:profile_name])
48+
# expect(profile.arn).to match(/^arn\:aws\:iam\:\:\d+\:\S+$/)
49+
# expect(profile.arn).to include("#{@config[:path]}#{@config[:profile_name]}")
50+
# end
51+
#
52+
# it "should accept a role assignment after the fact" do
53+
# role_options = { :name => @config[:role_name], :path => @config[:path_prefix], :ensure => @config[:ensure] }
54+
# result = TestExecutor.puppet_resource('iam_role', role_options, '--modulepath spec/fixtures/modules/ --trace')
55+
# expect(result.stderr).not_to match(/Error:/)
56+
#
57+
# profile_options = { :name => @config[:profile_name], :path => @config[:path_prefix], :ensure => @config[:ensure], :roles => @config[:role_name] }
58+
# result = TestExecutor.puppet_resource('iam_instance_profile', profile_options, '--modulepath spec/fixtures/modules/ --trace')
59+
# expect(result.stderr).not_to match(/Error:/)
60+
# end
61+
#
62+
# it "should accept policy attachment" do
63+
# policy_options = { :name => 'IAMFullAccess', :roles => @config[:role_name] }
64+
# result = TestExecutor.puppet_resource('iam_policy_attachment', policy_options, '--modulepath spec/fixtures/modules/ --trace')
65+
# expect(result.stderr).not_to match(/Error:/)
66+
# end
67+
#
68+
# it "should destroy and cleanup properly" do
69+
# new_config = @config.update({:ensure => 'absent'})
70+
#
71+
# role_options = { :name => new_config[:role_name], :path => @config[:path_prefix], :ensure => new_config[:ensure] }
72+
# result = TestExecutor.puppet_resource('iam_role', role_options, '--modulepath spec/fixtures/modules/ --trace')
73+
# expect(result.stderr).not_to match(/Error:/)
74+
#
75+
# profile_options = { :name => new_config[:profile_name], :path => @config[:path_prefix], :ensure => new_config[:ensure] }
76+
# result = TestExecutor.puppet_resource('iam_instance_profile', profile_options, '--modulepath spec/fixtures/modules/ --trace')
77+
# expect(result.stderr).not_to match(/Error:/)
78+
# end
79+
#
80+
# end
81+
#
82+
# describe 'managing via puppet manifest apply' do
83+
#
84+
# before (:all) do
85+
# @name = "#{SecureRandom.uuid}"
86+
# @path_prefix = "/#{SecureRandom.hex(8)}/"
87+
# @role_policy_json = <<-'JSON'
88+
# {
89+
# "Version": "2012-10-17",
90+
# "Statement": [
91+
# {
92+
# "Effect": "Allow",
93+
# "Principal": {
94+
# "Service": "ec2.amazonaws.com"
95+
# },
96+
# "Action": "sts:AssumeRole"
97+
# }
98+
# ]
99+
# }
100+
# JSON
101+
#
102+
# @config = {
103+
# :role_name => @name,
104+
# :profile_name => @name,
105+
# :path => @path_prefix,
106+
# :role_policy_document => @role_policy_json.strip.gsub(/\r\n?/, " "),
107+
# :ensure => 'present',
108+
# }
109+
# end
110+
#
111+
# it "should compile and apply" do
112+
# result = PuppetManifest.new(@template, @config).apply
113+
# expect(result.stderr).not_to match(/Error:/)
114+
# end
115+
#
116+
# it "with the specified name" do
117+
# profile = get_instance_profile(@config[:profile_name])
118+
# expect(profile.instance_profile_name).to eq(@config[:profile_name])
119+
# end
120+
#
121+
# it "should have valid ARN" do
122+
# profile = get_instance_profile(@config[:profile_name])
123+
# expect(profile.arn).to match(/^arn\:aws\:iam\:\:\d+\:\S+$/)
124+
# expect(profile.arn).to include("#{@config[:path]}#{@config[:profile_name]}")
125+
# end
126+
#
127+
# it "should cleanup properly" do
128+
# new_config = @config.update({:ensure => 'absent'})
129+
# result = PuppetManifest.new(@template, new_config).apply
130+
# expect(result.stderr).not_to match(/Error:/)
131+
# end
132+
# end
133+
#
134+
#end

spec/acceptance/iam_role_spec.rb

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
require 'spec_helper_acceptance'
2-
require 'securerandom'
3-
4-
describe 'iam_role' do
5-
before(:all) do
6-
@default_region = 'us-east-1'
7-
@aws = AwsHelper.new(@default_region)
8-
end
9-
10-
def find_role(name)
11-
roles = @aws.get_iam_roles(name)
12-
expect(roles.count).to eq(1)
13-
roles.first
14-
end
15-
16-
describe 'manage an iam_role' do
17-
18-
before (:all) do
19-
@name = "#{SecureRandom.uuid}"
20-
@config = {
21-
:name => @name,
22-
}
23-
end
24-
25-
it 'with puppet resource' do
26-
options = {:name => @config[:name], :ensure => 'present'}
27-
result = TestExecutor.puppet_resource('iam_role', options, '--modulepath spec/fixtures/modules/')
28-
expect(result.stderr).not_to match(/Error:/)
29-
expect{ find_role(@config[:name]) }.not_to raise_error
30-
end
31-
32-
it 'should create an IAM role with the correct name' do
33-
role = find_role(@name)
34-
expect(role.role_name).to eq(@name)
35-
end
36-
37-
it 'should create an IAM role with a valid ARN' do
38-
role = find_role(@name)
39-
expect(role.arn).to match(/^arn\:aws\:iam\:\:\d+\:\S+$/)
40-
end
41-
42-
it 'should destroy an IAM role' do
43-
options = {:name => @config[:name], :ensure => 'absent'}
44-
result = TestExecutor.puppet_resource('iam_role', options, '--modulepath spec/fixtures/modules/')
45-
expect(result.stderr).not_to match(/Error:/)
46-
expect(@aws.get_iam_roles(@name)).to be_empty
47-
end
48-
49-
end
50-
51-
end
1+
#require 'spec_helper_acceptance'
2+
#require 'securerandom'
3+
#
4+
#describe 'iam_role' do
5+
# before(:all) do
6+
# @default_region = 'us-east-1'
7+
# @aws = AwsHelper.new(@default_region)
8+
# end
9+
#
10+
# def find_role(name)
11+
# roles = @aws.get_iam_roles(name)
12+
# expect(roles.count).to eq(1)
13+
# roles.first
14+
# end
15+
#
16+
# describe 'manage an iam_role' do
17+
#
18+
# before (:all) do
19+
# @name = "#{SecureRandom.uuid}"
20+
# @config = {
21+
# :name => @name,
22+
# }
23+
# end
24+
#
25+
# it 'with puppet resource' do
26+
# options = {:name => @config[:name], :ensure => 'present'}
27+
# result = TestExecutor.puppet_resource('iam_role', options, '--modulepath spec/fixtures/modules/')
28+
# expect(result.stderr).not_to match(/Error:/)
29+
# expect{ find_role(@config[:name]) }.not_to raise_error
30+
# end
31+
#
32+
# it 'should create an IAM role with the correct name' do
33+
# role = find_role(@name)
34+
# expect(role.role_name).to eq(@name)
35+
# end
36+
#
37+
# it 'should create an IAM role with a valid ARN' do
38+
# role = find_role(@name)
39+
# expect(role.arn).to match(/^arn\:aws\:iam\:\:\d+\:\S+$/)
40+
# end
41+
#
42+
# it 'should destroy an IAM role' do
43+
# options = {:name => @config[:name], :ensure => 'absent'}
44+
# result = TestExecutor.puppet_resource('iam_role', options, '--modulepath spec/fixtures/modules/')
45+
# expect(result.stderr).not_to match(/Error:/)
46+
# expect(@aws.get_iam_roles(@name)).to be_empty
47+
# end
48+
#
49+
# end
50+
#
51+
#end

0 commit comments

Comments
 (0)