This repository has been archived by the owner on Aug 26, 2020. It is now read-only.
forked from berkshelf/berkshelf
/
json_formatter.feature
161 lines (153 loc) · 4.25 KB
/
json_formatter.feature
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
158
159
160
161
Feature: --format json
Background:
* the Berkshelf API server's cache is empty
* the Chef Server is empty
* the cookbook store is empty
Scenario: JSON output installing a cookbook from the default location
Given I have a Berksfile pointing at the local Berkshelf API with:
"""
cookbook 'berkshelf', '1.0.0'
"""
And the Chef Server has cookbooks:
| berkshelf | 1.0.0 |
And the Berkshelf API server's cache is up to date
When I successfully run `berks install --format json`
Then the output should contain JSON:
"""
{
"cookbooks": [
{
"api_source": "http://0.0.0.0:26210",
"location_path": "http://localhost:26310/",
"version": "1.0.0",
"name": "berkshelf"
}
],
"errors": [],
"messages": [
"Resolving cookbook dependencies...",
"Fetching cookbook index from http://0.0.0.0:26210..."
],
"warnings": []
}
"""
Scenario: JSON output installing a cookbook we already have
Given the cookbook store has the cookbooks:
| berkshelf-cookbook-fixture | 1.0.0 |
And I have a Berksfile pointing at the local Berkshelf API with:
"""
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
"""
When I successfully run `berks install --format json`
Then the output should contain JSON:
"""
{
"cookbooks": [
{
"name": "berkshelf-cookbook-fixture",
"version": "1.0.0"
}
],
"errors": [],
"messages": [
"Resolving cookbook dependencies...",
"Fetching cookbook index from http://0.0.0.0:26210..."
],
"warnings": []
}
"""
Scenario: JSON output when running the show command
Given the cookbook store has the cookbooks:
| fake | 1.0.0 |
And I have a Berksfile pointing at the local Berkshelf API with:
"""
cookbook 'fake', '1.0.0'
"""
And I write to "Berksfile.lock" with:
"""
DEPENDENCIES
fake (= 1.0.0)
GRAPH
fake (1.0.0)
"""
When I successfully run `berks show fake --format json`
Then the output should contain JSON:
"""
{
"cookbooks": [
{
"name": "fake",
"path": "<%= Berkshelf.cookbook_store.storage_path.join('fake-1.0.0') %>"
}
],
"errors": [],
"messages": [],
"warnings": []
}
"""
Scenario: JSON output when running the upload command
Given I have a Berksfile pointing at the local Berkshelf API with:
"""
cookbook 'example_cookbook', path: '../../fixtures/cookbooks/example_cookbook-0.5.0'
"""
And I write to "Berksfile.lock" with:
"""
DEPENDENCIES
example_cookbook
path: ../../fixtures/cookbooks/example_cookbook-0.5.0
GRAPH
example_cookbook (0.5.0)
"""
When I successfully run `berks upload --format json`
Then the output should contain JSON:
"""
{
"cookbooks": [
{
"name": "example_cookbook",
"version": "0.5.0",
"uploaded_to": "http://localhost:26310/"
}
],
"errors": [],
"messages": [],
"warnings": []
}
"""
Scenario: JSON output when running the outdated command
Given the cookbook store has the cookbooks:
| seth | 0.1.0 |
And the Chef Server has cookbooks:
| seth | 0.1.0 |
| seth | 0.2.9 |
| seth | 1.0.0 |
And the Berkshelf API server's cache is up to date
And I have a Berksfile pointing at the local Berkshelf API with:
"""
cookbook 'seth', '~> 0.1'
"""
And I write to "Berksfile.lock" with:
"""
DEPENDENCIES
seth (~> 0.1)
GRAPH
seth (0.1.0)
"""
And I successfully run `berks outdated --format json`
Then the output should contain JSON:
"""
{
"cookbooks": [
{
"local": "0.1.0",
"remote": {
"http://0.0.0.0:26210": "0.2.9"
},
"name": "seth"
}
],
"errors": [],
"messages": [],
"warnings": []
}
"""