summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorIgor Afonov <afonov@gmail.com>2011-11-10 22:53:31 +0200
committerBryan McLellan <btm@opscode.com>2012-03-16 14:15:49 -0700
commitfeb1b2ce80aaafcf8ef4c97a03dd9e0d8ae5b714 (patch)
tree1ac333b433a339e94638861527ff71ca7e6bbf50 /features
parent846f5c4800b2f3766641d26a3272afd3889e9ec9 (diff)
downloadchef-feb1b2ce80aaafcf8ef4c97a03dd9e0d8ae5b714.tar.gz
Failing test for a revision based rollback issue.
Diffstat (limited to 'features')
-rw-r--r--features/data/cookbooks/deploy/recipes/revision_rollback.rb28
-rw-r--r--features/provider/deploy/deploy.feature21
-rw-r--r--features/steps/deploy_steps.rb18
3 files changed, 66 insertions, 1 deletions
diff --git a/features/data/cookbooks/deploy/recipes/revision_rollback.rb b/features/data/cookbooks/deploy/recipes/revision_rollback.rb
new file mode 100644
index 0000000000..faa39c2f42
--- /dev/null
+++ b/features/data/cookbooks/deploy/recipes/revision_rollback.rb
@@ -0,0 +1,28 @@
+#
+# Cookbook Name:: deploy
+# Recipe:: default
+#
+# Copyright 2009, Opscode
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+deploy_revision "#{node[:tmpdir]}/deploy" do
+ repo "#{node[:tmpdir]}/gitrepo/myapp/"
+ environment "RAILS_ENV" => "production"
+ revision "HEAD"
+ action :rollback
+ migration_command "rake db:migrate --trace"
+ migrate true
+ restart_command "touch tmp/restart.txt"
+end
diff --git a/features/provider/deploy/deploy.feature b/features/provider/deploy/deploy.feature
index fcd99b897f..595accc9cf 100644
--- a/features/provider/deploy/deploy.feature
+++ b/features/provider/deploy/deploy.feature
@@ -78,6 +78,27 @@ Feature: Deploy
Then the run should exit '0'
Then there should be 'one' release
+ @chef-2723 @known_issue
+ Scenario: Make changes, commit them, deploy again using revision based strategy and do rollback
+ Given I haven't yet fixed CHEF-1816, this test should be pending
+ Given a validated node
+ And it includes the recipe 'deploy::revision_deploy'
+ And I have a clone of the rails app in the data/tmp dir
+ And that I have 'rails' '2.3.4' installed
+ And that I have 'sqlite3-ruby' '1.2.5' installed
+ And I run the chef-client
+ Then the run should exit '0'
+ When I make changes and do commit in rails app repo
+ And I run the chef-client
+ Then the run should exit '0'
+ And there should be 'two' releases
+ When I remove 'recipe[deploy::revision_deploy]' from the node's run list
+ And I add 'deploy::revision_rollback' to the node's run list
+ And I run the chef-client
+ Then the run should exit '0'
+ And current release revision should be "61e5cb77acb7400667df009ffef01306dcca4a07"
+ And there should be 'one' release
+
Scenario: Deploy an app twice using the idempotent revision deploy strategy
Given a validated node
And it includes the recipe 'deploy::revision_deploy'
diff --git a/features/steps/deploy_steps.rb b/features/steps/deploy_steps.rb
index cdedf6534a..43dac5d6ce 100644
--- a/features/steps/deploy_steps.rb
+++ b/features/steps/deploy_steps.rb
@@ -11,12 +11,28 @@ def gem_installed?(gem_name, version)
`#{cmd}`=~ /true/ ? true : false
end
-
Given /^I have a clone of the rails app in the data\/tmp dir$/ do
cmd = "git clone #{datadir}/myapp.bundle #{tmpdir}/gitrepo/myapp"
`#{cmd}`
end
+When /^I make changes and do commit in rails app repo$/ do
+ cmd = <<-CMD
+ cd #{tmpdir}/gitrepo/myapp &&
+ git checkout -qb master &&
+ echo 1 >> test_file &&
+ git add test_file &&
+ git commit -m "Modified file"
+ CMD
+
+ `#{cmd}`
+end
+
+And /^current release revision should be "(.*)"$/ do |revision|
+ File.readlink("#{tmpdir}/deploy/current").split("/").last.should == revision
+end
+
+
Given /^that I have '(.*)' '(.*)' installed$/ do |gem_name, version|
unless gem_installed?(gem_name, version)
pending "This Cucumber feature will not execute, as #{gem_name} #{version} is not installed."