blob: a8562d1e4bef954837bf11ac84960ebfa209aeb7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
@api @cookbooks @api_cookbooks_upload
@manage_cookbook
Feature: CRUD cookbooks
In order to manage cookbook data
As a Developer
I want to create and upload cookbook files and manifests
@create_cookbook_negative
Scenario: Should not be able to create a cookbook with the wrong name
Given I am an administrator
When I create a versioned cookbook named 'foo' versioned '1.0.0' with 'testcookbook_valid'
Then I should get a '400 "Bad Request"' exception
Scenario: Should not be able to create a cookbook with the wrong version
Given I am an administrator
When I create a versioned cookbook named 'testcookbook_valid' versioned '9.9.9' with 'testcookbook_valid'
Then I should get a '400 "Bad Request"' exception
Scenario: Should not be able to create a cookbook with missing name
Given I am an administrator
When I create a versioned cookbook named '' versioned '9.9.9' with 'testcookbook_valid'
Then I should get a '404 "Not Found"' exception
Scenario: Should not be able to create a cookbook with missing name and version
Given I am an administrator
When I create a versioned cookbook named '' versioned '' with 'testcookbook_valid'
Then I should get a '404 "Not Found"' exception
Scenario: Should not be able to create a cookbook with non-X.Y.Z version
Given I am an administrator
When I create a versioned cookbook named 'testcookbook_valid' versioned '1.0' with 'testcookbook_valid'
Then I should get a '404 "Not Found"' exception
Scenario: Should not be able to create a cookbook if none of its contained files have been uploaded
Given I am an administrator
When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
Then I should get a '400 "Bad Request"' exception
@create_cookbook_positive
Scenario: Should be able to create a cookbook if its files have been uploaded
Given I am an administrator
When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_valid'
Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$'
Then I upload a file named 'metadata.json' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
Then I upload a file named 'metadata.rb' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
When I commit the sandbox
Then I should not get an exception
When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
Then I should not get an exception
@create_cookbook_positive
Scenario: Cookbook successfully uploaded via sandbox should later be visible via /cookbooks, including its versions and metadata
Given I am an administrator
When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
When I 'GET' the path '/cookbooks'
Then the inflated responses key 'testcookbook_valid' should exist
When I 'GET' the path '/cookbooks/testcookbook_valid'
Then the inflated responses key 'testcookbook_valid' should exist
Then the inflated responses key 'testcookbook_valid' sub-key 'versions' item '0' sub-key 'version' should equal '0.1.0'
When I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0'
Then the inflated response should match '.*default.rb.*' as json
@create_multiple_cookbook_versions_positive
Scenario: Multiple cookbook versions successfully uploaded are visible
Given I am an administrator
And I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0'
When I 'GET' the path '/cookbooks'
Then the inflated responses key 'testcookbook_valid' should exist
When I 'GET' the path '/cookbooks/testcookbook_valid'
Then the inflated responses key 'testcookbook_valid' should exist
And the inflated responses key 'testcookbook_valid' sub-key 'versions' should be '2' items long
And the inflated responses key 'testcookbook_valid' sub-key 'versions' item '0' sub-key 'version' should equal '0.2.0'
And the inflated responses key 'testcookbook_valid' sub-key 'versions' item '1' sub-key 'version' should equal '0.1.0'
@update_cookbook_version_metadata_positive
Scenario: A successful cookbook version upload that changes the metadata is properly reflected
Given I am an administrator
And I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
When I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0'
Then the inflated response should be a kind of 'Chef::CookbookVersion'
And the dependencies in its metadata should be an empty hash
When I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid_v0.1.0_with_different_dependencies'
Then the inflated response should be a kind of 'Chef::CookbookVersion'
And the metadata should include a dependency on 'aws'
# The sandbox is created missing 'metadata.json'. However, the cookbook's
# manifest includes that file. We don't upload the file to the sandbox, but
# the sandbox commits ok cuz it wasn't expecting that file. However, when we
# try to create the cookbook, it should complain as its manifest wants that
# file.
@create_cookbook_negative
Scenario: Should not be able to create a cookbook if it is missing one file
Given I am an administrator
When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_valid' minus files 'metadata.rb'
Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$'
Then I upload a file named 'metadata.json' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_valid' to the sandbox
Then the response code should be '200'
When I commit the sandbox
Then I should not get an exception
When I create a versioned cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
Then I should get a '400 "Bad Request"' exception
@create_cookbook_negative
Scenario: Should not be able to create a cookbook if it has no metadata file
Given I am an administrator
When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_invalid_nometadata'
Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$'
Then I upload a file named 'attributes/attributes.rb' from cookbook 'testcookbook_invalid_nometadata' to the sandbox
Then the response code should be '200'
Then I upload a file named 'recipes/default.rb' from cookbook 'testcookbook_invalid_nometadata' to the sandbox
Then the response code should be '200'
When I commit the sandbox
Then I should not get an exception
When I create a versioned cookbook named 'testcookbook_invalid_nometadata' versioned '0.1.0' with 'testcookbook_invalid_nometadata'
Then I should get a '400 "Bad Request"' exception
# update a cookbook with no files should fail
@create_cookbook_negative
Scenario: Should not be able to create a cookbook if it has no files and just metadata
Given I am an administrator
When I create a sandbox named 'sandbox1' for cookbook 'testcookbook_invalid_empty_except_metadata'
Then the inflated responses key 'uri' should match '^http://.+/sandboxes/[^\/]+$'
Then I upload a file named 'metadata.json' from cookbook 'testcookbook_invalid_empty_except_metadata' to the sandbox
Then the response code should be '200'
Then I upload a file named 'metadata.rb' from cookbook 'testcookbook_invalid_empty_except_metadata' to the sandbox
Then the response code should be '200'
When I commit the sandbox
Then I should not get an exception
When I create a cookbook named 'testcookbook_invalid_empty_except_metadata' with only the metadata file
Then I should get a '400 "Bad Request"' exception
@freeze_cookbook_version
Scenario: Create a frozen Cookbook Version
Given I am an administrator
And I have uploaded a frozen cookbook named 'testcookbook_valid' at version '0.1.0'
When I 'GET' the path '/cookbooks/testcookbook_valid/0.1.0'
Then the cookbook version document should be frozen
@freeze_cookbook_version @overwrite_frozen_version
Scenario: Cannot overwrite a frozen Cookbook Version
Given I am an administrator
And I have uploaded a frozen cookbook named 'testcookbook_valid' at version '0.1.0'
When I upload a cookbook named 'testcookbook_valid' at version '0.1.0'
Then I should get a '409 "Conflict"' exception
|