Skip to content

Commit

Permalink
Merge pull request #900 from Dan33l/split_acceptance_error_idempotency
Browse files Browse the repository at this point in the history
split examples about error and idempotency as much as possible
  • Loading branch information
Dan33l authored Jan 18, 2019
2 parents a267835 + 8143669 commit 909577f
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 197 deletions.
50 changes: 22 additions & 28 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
include_context 'jenkins'

context 'default parameters' do
it 'works with no errors' do
pp = <<-EOS
class {'jenkins':
cli_remoting_free => true,
cli => true,
}
EOS
pp = <<-EOS
class {'jenkins':
cli_remoting_free => true,
cli => true,
}
EOS

apply2(pp)
end
apply2(pp)

describe port(8080) do
it {
Expand Down Expand Up @@ -66,16 +64,14 @@ class {'jenkins':
end # default parameters

context 'executors' do
it 'works with no errors' do
pp = <<-EOS
class {'jenkins':
executors => 42,
cli_remoting_free => true,
}
EOS
pp = <<-EOS
class {'jenkins':
executors => 42,
cli_remoting_free => true,
}
EOS

apply2(pp)
end
apply2(pp)

describe port(8080) do
# jenkins should already have been running so we shouldn't have to
Expand All @@ -94,16 +90,14 @@ class {'jenkins':
end # executors

context 'slaveagentport' do
it 'works with no errors' do
pp = <<-EOS
class {'jenkins':
slaveagentport => 7777,
cli_remoting_free => true,
}
EOS

apply2(pp)
end
pp = <<-EOS
class {'jenkins':
slaveagentport => 7777,
cli_remoting_free => true,
}
EOS

apply2(pp)

describe port(8080) do
# jenkins should already have been running so we shouldn't have to
Expand Down
55 changes: 30 additions & 25 deletions spec/acceptance/plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@
end

context 'default parameters' do
it 'works with no errors' do
pp = <<-EOS
class {'jenkins':
cli_remoting_free => true,
}
pp = <<-EOS
class {'jenkins':
cli_remoting_free => true,
}
jenkins::plugin {'git-plugin':
name => 'git',
version => '2.3.4',
}
EOS
jenkins::plugin {'git-plugin':
name => 'git',
version => '2.3.4',
}
EOS

apply2(pp)
end
apply2(pp)

it_behaves_like 'has_git_plugin'
end
Expand All @@ -70,7 +68,9 @@ class {'jenkins':
version => '2.3.4',
}
EOS
apply2(pp)

apply(pp, catch_failures: true)
apply(pp, catch_changes: true)
end

context 'downgrade' do
Expand All @@ -80,17 +80,20 @@ class {'jenkins':
package{'unzip':
ensure => present
}
class {'jenkins':
cli_remoting_free => true,
purge_plugins => true,
}
class {'jenkins':
cli_remoting_free => true,
purge_plugins => true,
}
jenkins::plugin {'git-plugin':
name => 'git',
version => '1.0',
}
EOS

apply(pp, catch_failures: true)
apply(pp, catch_changes: true)

jenkins::plugin {'git-plugin':
name => 'git',
version => '1.0',
}
EOS
apply2(pp)
# Find the version of the installed git plugin
git_version = shell("unzip -p #{$pdir}/git.hpi META-INF/MANIFEST.MF | sed 's/Plugin-Version: \\\(.*\\\)/\\1/;tx;d;:x'").stdout.strip
git_version.should eq('1.0')
Expand All @@ -116,7 +119,8 @@ class {'jenkins':
}
EOS

apply2(pp)
apply(pp, catch_failures: true)
apply(pp, catch_changes: true)
end

it_behaves_like 'has_git_plugin'
Expand Down Expand Up @@ -144,7 +148,8 @@ class {'jenkins':
}
EOS

apply2(pp)
apply(pp, catch_failures: true)
apply(pp, catch_changes: true)
end

it_behaves_like 'has_git_plugin'
Expand Down
Loading

0 comments on commit 909577f

Please sign in to comment.