summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsdelano <stephen@opscode.com>2010-08-23 13:13:46 -0700
committersdelano <stephen@opscode.com>2010-08-26 13:19:37 -0700
commit26f0e5974c8a16ee22e955fe9533e4352106a3ce (patch)
tree626f3ef3cbe35e5adc7876da20d689092270a78a
parent43d30c96c650518e8f9fc5cbf2110e9afb5dec46 (diff)
downloadchef-26f0e5974c8a16ee22e955fe9533e4352106a3ce.tar.gz
feature tests for CHEF-1607
-rw-r--r--cucumber.yml2
-rw-r--r--features/api/cookbooks/list_cookbooks.feature7
-rw-r--r--features/api/cookbooks/show_cookbooks.feature7
-rw-r--r--features/api/nodes/cookbook_sync_api.feature9
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json39
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb6
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb18
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json39
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb6
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb18
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json39
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb6
-rw-r--r--features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb18
-rw-r--r--features/steps/cookbook_steps.rb5
-rw-r--r--features/steps/fixture_steps.rb6
15 files changed, 224 insertions, 1 deletions
diff --git a/cucumber.yml b/cucumber.yml
index 65804844dd..3d9d6cc163 100644
--- a/cucumber.yml
+++ b/cucumber.yml
@@ -2,7 +2,7 @@ default: -f pretty features -r features/steps -r features/support
api: --tags @api --format pretty -r features/steps -r features/support features
api_cookbooks: --tags @api --tags @cookbooks --format pretty -r features/steps -r features/support features
api_cookbooks_list: --tags @api_cookbooks_list --format pretty -r features/steps -r features/support features
-api_cookbooks_show: --tags @spi_cookbooks_show --format pretty -r features/steps -r features/support features
+api_cookbooks_show: --tags @api_cookbooks_show --format pretty -r features/steps -r features/support features
api_cookbooks_upload: --tags @api_cookbooks_upload --format pretty -r features/steps -r features/support features
api_cookbooks_download: --tags @api_cookbooks_download --format pretty -r features/steps -r features/support features
api_cookbooks_delete: --tags @api_cookbooks_delete --format pretty -r features/steps -r features/support features
diff --git a/features/api/cookbooks/list_cookbooks.feature b/features/api/cookbooks/list_cookbooks.feature
index f5e494f2aa..cdbc7f98a4 100644
--- a/features/api/cookbooks/list_cookbooks.feature
+++ b/features/api/cookbooks/list_cookbooks.feature
@@ -33,6 +33,13 @@ Feature: List cookbooks via the REST API
| an administrator |
| a non-admin |
+ @CHEF-1607
+ Scenario: List all cookbooks with the lastest version, when they cannot be lexically sorted
+ Given I am an administrator
+ And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly
+ When I 'GET' the path '/cookbooks/_latest'
+ And the inflated responses key 'version_test' should match 'http://.+/cookbooks/version_test/0\.10\.0'
+
Scenario: List cookbooks with a wrong private key
Given I am an administrator
When I 'GET' the path '/cookbooks' using a wrong private key
diff --git a/features/api/cookbooks/show_cookbooks.feature b/features/api/cookbooks/show_cookbooks.feature
index dbd6bc47d1..7613ff90c4 100644
--- a/features/api/cookbooks/show_cookbooks.feature
+++ b/features/api/cookbooks/show_cookbooks.feature
@@ -21,6 +21,13 @@ Feature: Show a cookbook via the REST API
Then the inflated response should respond to 'templates' and match '^\[\]$' as json
Then the inflated response should respond to 'resources' and match '^\[\]$' as json
+ @CHEF-1607
+ Scenario: Show the latest version of a cookbook
+ Given I am an administrator
+ And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly
+ When I 'GET' the path '/cookbooks/version_test/_latest'
+ Then the inflated response should respond to 'version' and match '0.10.0'
+
@show_cookbook_negative
Scenario: Show a cookbook with a wrong private key
Given I am an administrator
diff --git a/features/api/nodes/cookbook_sync_api.feature b/features/api/nodes/cookbook_sync_api.feature
index a92db1b5cc..2a8934a81a 100644
--- a/features/api/nodes/cookbook_sync_api.feature
+++ b/features/api/nodes/cookbook_sync_api.feature
@@ -18,6 +18,15 @@ Feature: Synchronize cookbooks to the edge
And the inflated responses key 'node_cookbook_sync' should match '"attributes":' as json
And the inflated responses key 'node_cookbook_sync' should match 'attr_file.rb' as json
+ @CHEF-1607
+ Scenario: Retrieve the correct versions of cookbook files to sync, especially when they do not lexically sort
+ Given I am an administrator
+ And I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly
+ And a 'node' named 'paradise' exists
+ When I 'GET' the path '/nodes/paradise/cookbooks'
+ And the inflated responses key 'version_test' should exist
+ And the inflated responses key 'version_test' should match '"version":"0.10.0"' as json
+
Scenario: Retrieve the list of cookbook files to synchronize with a wrong private key
Given I am an administrator
And a 'node' named 'sync' exists
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json
new file mode 100644
index 0000000000..cd048cf9c8
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.json
@@ -0,0 +1,39 @@
+{
+ "version": "0.10.0",
+ "suggestions": {
+
+ },
+ "conflicting": {
+
+ },
+ "license": "Apache 2.0",
+ "providing": {
+
+ },
+ "maintainer": "Opscode",
+ "replacing": {
+
+ },
+ "platforms": {
+
+ },
+ "description": "Tests cookbook versioning in environments",
+ "recipes": {
+
+ },
+ "maintainer_email": "do_not_reply@opscode.com",
+ "name": "version_test",
+ "groupings": {
+
+ },
+ "attributes": {
+
+ },
+ "long_description": "",
+ "recommendations": {
+
+ },
+ "dependencies": {
+
+ }
+} \ No newline at end of file
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb
new file mode 100644
index 0000000000..57e1b20e01
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/metadata.rb
@@ -0,0 +1,6 @@
+name "version_test"
+maintainer "Opscode"
+maintainer_email "do_not_reply@opscode.com"
+license "Apache 2.0"
+description "Tests cookbook versioning in environments"
+version "0.10.0" \ No newline at end of file
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb
new file mode 100644
index 0000000000..dc2a253959
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.10.0/recipes/default.rb
@@ -0,0 +1,18 @@
+#
+# Cookbook Name:: template
+# Recipe:: default
+#
+# Copyright 2010, Opscode, Inc.
+#
+# 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.
+#
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json
new file mode 100644
index 0000000000..3fd425ab36
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.json
@@ -0,0 +1,39 @@
+{
+ "version": "0.9.0",
+ "suggestions": {
+
+ },
+ "conflicting": {
+
+ },
+ "license": "Apache 2.0",
+ "providing": {
+
+ },
+ "maintainer": "Opscode",
+ "replacing": {
+
+ },
+ "platforms": {
+
+ },
+ "description": "Tests cookbook versioning in environments",
+ "recipes": {
+
+ },
+ "maintainer_email": "do_not_reply@opscode.com",
+ "name": "version_test",
+ "groupings": {
+
+ },
+ "attributes": {
+
+ },
+ "long_description": "",
+ "recommendations": {
+
+ },
+ "dependencies": {
+
+ }
+} \ No newline at end of file
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb
new file mode 100644
index 0000000000..f926a138ff
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/metadata.rb
@@ -0,0 +1,6 @@
+name "version_test"
+maintainer "Opscode"
+maintainer_email "do_not_reply@opscode.com"
+license "Apache 2.0"
+description "Tests cookbook versioning in environments"
+version "0.9.0" \ No newline at end of file
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb
new file mode 100644
index 0000000000..dc2a253959
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.0/recipes/default.rb
@@ -0,0 +1,18 @@
+#
+# Cookbook Name:: template
+# Recipe:: default
+#
+# Copyright 2010, Opscode, Inc.
+#
+# 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.
+#
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json
new file mode 100644
index 0000000000..a191fc8fa5
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.json
@@ -0,0 +1,39 @@
+{
+ "version": "0.9.7",
+ "suggestions": {
+
+ },
+ "conflicting": {
+
+ },
+ "license": "Apache 2.0",
+ "providing": {
+
+ },
+ "maintainer": "Opscode",
+ "replacing": {
+
+ },
+ "platforms": {
+
+ },
+ "description": "Tests cookbook versioning in environments",
+ "recipes": {
+
+ },
+ "maintainer_email": "do_not_reply@opscode.com",
+ "name": "version_test",
+ "groupings": {
+
+ },
+ "attributes": {
+
+ },
+ "long_description": "",
+ "recommendations": {
+
+ },
+ "dependencies": {
+
+ }
+} \ No newline at end of file
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb
new file mode 100644
index 0000000000..d429e394cb
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/metadata.rb
@@ -0,0 +1,6 @@
+name "version_test"
+maintainer "Opscode"
+maintainer_email "do_not_reply@opscode.com"
+license "Apache 2.0"
+description "Tests cookbook versioning in environments"
+version "0.9.7" \ No newline at end of file
diff --git a/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb
new file mode 100644
index 0000000000..dc2a253959
--- /dev/null
+++ b/features/data/cookbooks_not_uploaded_at_feature_start/version_test_0.9.7/recipes/default.rb
@@ -0,0 +1,18 @@
+#
+# Cookbook Name:: template
+# Recipe:: default
+#
+# Copyright 2010, Opscode, Inc.
+#
+# 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.
+#
diff --git a/features/steps/cookbook_steps.rb b/features/steps/cookbook_steps.rb
index 7e2be0d122..f4d1827dfd 100644
--- a/features/steps/cookbook_steps.rb
+++ b/features/steps/cookbook_steps.rb
@@ -324,3 +324,8 @@ Given "I upload multiple versions of the 'version_test' cookbook" do
When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.2.0' with 'version_test_0.2.0'"
end
+Given "I upload multiple versions of the 'version_test' cookbook that do not lexically sort correctly" do
+ When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.9.0' with 'version_test_0.9.0'"
+ When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.10.0' with 'version_test_0.10.0'"
+ When "I fully upload a sandboxed cookbook force-named 'version_test' versioned '0.9.7' with 'version_test_0.9.7'"
+end
diff --git a/features/steps/fixture_steps.rb b/features/steps/fixture_steps.rb
index 3d6d4bb03d..433826b1b5 100644
--- a/features/steps/fixture_steps.rb
+++ b/features/steps/fixture_steps.rb
@@ -185,6 +185,12 @@ Before do
n.name 'role_not_exist'
n.run_list << "role[not_exist]"
n
+ end,
+ 'paradise' => Proc.new do
+ n = Chef::Node.new
+ n.name 'paradise'
+ n.run_list << "version_test"
+ n
end
},
'hash' => {