summaryrefslogtreecommitdiff
path: root/features/steps
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-10-01 15:21:19 -0700
committerDaniel DeLeo <dan@opscode.com>2010-10-04 17:16:34 -0700
commitfedc5051f89f4339db4edf93d3ffe94b771d3e8b (patch)
tree67621e26a4328a2636db71637da0a92d70450e2a /features/steps
parentc82bd4d237056bfb57d27e7aa82d7506c9dd17dc (diff)
downloadchef-fedc5051f89f4339db4edf93d3ffe94b771d3e8b.tar.gz
integration test for dpkg_package
Diffstat (limited to 'features/steps')
-rw-r--r--features/steps/packages.rb47
-rw-r--r--features/steps/run_client_steps.rb1
2 files changed, 47 insertions, 1 deletions
diff --git a/features/steps/packages.rb b/features/steps/packages.rb
index d812adaaed..9e6d888f2d 100644
--- a/features/steps/packages.rb
+++ b/features/steps/packages.rb
@@ -1,3 +1,43 @@
+def debian_compatible?
+ (ohai[:platform] == 'debian') || (ohai[:platform] == "ubuntu")
+end
+
+def chef_test_dpkg_installed?
+ shell_out("dpkg -l chef-integration-test").exitstatus.success?
+end
+
+def purge_chef_integration_debs
+ if debian_compatible? && chef_test_dpkg_installed?
+ shell_out!("dpkg -r chef-integration-test")
+ end
+end
+
+Before('@dpkg', '@apt') do
+ purge_chef_integration_debs
+end
+
+AfterStep('@dpkg', '@apt') do
+ purge_chef_integration_debs
+end
+
+Given "I am running on a debian compatible OS" do
+ unless debian_compatible?
+ pending("This test can only run on debian or ubuntu, but you have #{ohai[:platform]}")
+ end
+end
+
+Given "my dpkg architecture is 'amd64'" do
+ unless `dpkg --print-architecture`.strip == "amd64"
+ pending("This scenario can only run on an amd64 system")
+ end
+end
+
+Given "the deb package '$pkg_name' is available" do |pkg_name|
+ source = File.expand_path(File.dirname(__FILE__) + "/data/apt/#{pkg_name}-1_amd64.deb")
+ dest = File.join(tmpdir, File.basename(source))
+ FileUtils.cp(source, dest)
+end
+
Given /^the gems server is running$/ do
self.gemserver_thread = Thread.new do
trap("INT") do
@@ -36,4 +76,9 @@ end
Then "the gem '$gem_name' version '$version' should not be installed" do |gem_name, version|
Then "a file named 'installed-gems/gems/#{gem_name}-#{version}' should not exist"
-end \ No newline at end of file
+end
+
+Then "the dpkg package '$package_name' should be installed" do |package_name|
+ pending # express the regexp above with the code you wish you had
+end
+
diff --git a/features/steps/run_client_steps.rb b/features/steps/run_client_steps.rb
index 183b000f11..f1f517495e 100644
--- a/features/steps/run_client_steps.rb
+++ b/features/steps/run_client_steps.rb
@@ -23,6 +23,7 @@ include Chef::Mixin::ShellOut
CHEF_CLIENT = File.join(CHEF_PROJECT_ROOT, "chef", "bin", "chef-client")
+
###
# When
###