pact_broker-client 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -17
- data/CHANGELOG.md +28 -0
- data/RELEASING.md +3 -14
- data/Rakefile +6 -1
- data/lib/pact_broker/client/base_client.rb +13 -1
- data/lib/pact_broker/client/can_i_deploy.rb +2 -3
- data/lib/pact_broker/client/cli/broker.rb +19 -8
- data/lib/pact_broker/client/cli/version_selector_options_parser.rb +5 -4
- data/lib/pact_broker/client/git.rb +15 -0
- data/lib/pact_broker/client/matrix.rb +17 -3
- data/lib/pact_broker/client/matrix/json_formatter.rb +2 -2
- data/lib/pact_broker/client/matrix/text_formatter.rb +3 -3
- data/lib/pact_broker/client/version.rb +1 -1
- data/pact-broker-client.gemspec +2 -3
- data/script/publish-pact.sh +1 -0
- data/script/release.sh +7 -0
- data/spec/integration/can_i_deploy_spec.rb +32 -0
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +2 -2
- data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +9 -1
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +25 -0
- data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +17 -14
- data/spec/lib/pact_broker/client/matrix/text_formatter_spec.rb +2 -2
- data/spec/lib/pact_broker/client/matrix_spec.rb +2 -1
- data/spec/pacts/pact_broker_client-pact_broker.json +272 -131
- data/spec/service_providers/pact_broker_client_matrix_spec.rb +89 -17
- data/spec/service_providers/pact_helper.rb +1 -0
- data/spec/support/matrix.json +26 -21
- data/spec/support/matrix.txt +1 -1
- metadata +11 -24
- data/Appraisals +0 -6
- data/gemfiles/default.gemfile +0 -7
- data/gemfiles/default.gemfile.lock +0 -106
- data/gemfiles/ruby_under_22.gemfile +0 -8
- data/gemfiles/ruby_under_22.gemfile.lock +0 -105
@@ -7,9 +7,9 @@ module PactBroker::Client
|
|
7
7
|
include_context "pact broker"
|
8
8
|
|
9
9
|
describe "retriving the compatibility matrix" do
|
10
|
-
let(:matrix_response_body) {
|
10
|
+
let(:matrix_response_body) { Pact.like(matrix) }
|
11
11
|
let(:matrix) { JSON.parse(File.read('spec/support/matrix.json')) }
|
12
|
-
let(:selectors) { [{
|
12
|
+
let(:selectors) { [{ pacticipant: "Foo", version: "1.2.3" }, { pacticipant: "Bar", version: "4.5.6" }] }
|
13
13
|
|
14
14
|
context "when results are found" do
|
15
15
|
before do
|
@@ -19,9 +19,30 @@ module PactBroker::Client
|
|
19
19
|
with(
|
20
20
|
method: :get,
|
21
21
|
path: "/matrix",
|
22
|
-
query:
|
23
|
-
|
24
|
-
|
22
|
+
query: "q[][pacticipant]=Foo&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=4.5.6"
|
23
|
+
).
|
24
|
+
will_respond_with(
|
25
|
+
status: 200,
|
26
|
+
headers: pact_broker_response_headers,
|
27
|
+
body: matrix_response_body
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'returns the pact matrix' do
|
32
|
+
matrix = pact_broker_client.matrix.get(selectors)
|
33
|
+
expect(matrix[:matrix].size).to eq 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when the pacticipant name has a space in it" do
|
38
|
+
before do
|
39
|
+
pact_broker.
|
40
|
+
given("the pact for Foo Thing version 1.2.3 has been verified by Bar version 4.5.6").
|
41
|
+
upon_receiving("a request for the compatibility matrix for Foo version 1.2.3 and Bar version 4.5.6").
|
42
|
+
with(
|
43
|
+
method: :get,
|
44
|
+
path: "/matrix",
|
45
|
+
query: "q[][pacticipant]=Foo%20Thing&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=4.5.6"
|
25
46
|
).
|
26
47
|
will_respond_with(
|
27
48
|
status: 200,
|
@@ -30,9 +51,11 @@ module PactBroker::Client
|
|
30
51
|
)
|
31
52
|
end
|
32
53
|
|
33
|
-
|
54
|
+
let(:selectors) { [{ pacticipant: "Foo Thing", version: "1.2.3" }, { pacticipant: "Bar", version: "4.5.6" }] }
|
55
|
+
|
56
|
+
it 'incorrectly escapes the spaces but it still seems to work' do
|
34
57
|
matrix = pact_broker_client.matrix.get(selectors)
|
35
|
-
expect(matrix.size).to eq 1
|
58
|
+
expect(matrix[:matrix].size).to eq 1
|
36
59
|
end
|
37
60
|
end
|
38
61
|
|
@@ -64,9 +87,7 @@ module PactBroker::Client
|
|
64
87
|
with(
|
65
88
|
method: :get,
|
66
89
|
path: "/matrix",
|
67
|
-
query:
|
68
|
-
'selectors[]' => ['Foo/version/1.2.3', 'Bar/version/9.9.9']
|
69
|
-
}
|
90
|
+
query: "q[][pacticipant]=Foo&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=9.9.9"
|
70
91
|
).
|
71
92
|
will_respond_with(
|
72
93
|
status: 400,
|
@@ -77,9 +98,9 @@ module PactBroker::Client
|
|
77
98
|
)
|
78
99
|
end
|
79
100
|
|
80
|
-
let(:selectors) { [{
|
101
|
+
let(:selectors) { [{ pacticipant: "Foo", version: "1.2.3" }, { pacticipant: "Bar", version: "9.9.9" }] }
|
81
102
|
|
82
|
-
it '
|
103
|
+
it 'raises an error' do
|
83
104
|
expect {
|
84
105
|
pact_broker_client.matrix.get(selectors)
|
85
106
|
}.to raise_error PactBroker::Client::Error, "an error message"
|
@@ -93,9 +114,7 @@ module PactBroker::Client
|
|
93
114
|
with(
|
94
115
|
method: :get,
|
95
116
|
path: "/matrix",
|
96
|
-
query:
|
97
|
-
'selectors[]' => ['Foo/version/1.2.3', 'Bar/version/9.9.9']
|
98
|
-
}
|
117
|
+
query: "q[][pacticipant]=Wiffle&q[][version]=1.2.3&q[][pacticipant]=Meep&q[][version]=9.9.9"
|
99
118
|
).
|
100
119
|
will_respond_with(
|
101
120
|
status: 400,
|
@@ -106,14 +125,67 @@ module PactBroker::Client
|
|
106
125
|
)
|
107
126
|
end
|
108
127
|
|
109
|
-
let(:selectors) { [{
|
128
|
+
let(:selectors) { [{ pacticipant: "Wiffle", version: "1.2.3" }, { pacticipant: "Meep", version: "9.9.9" }] }
|
110
129
|
|
111
|
-
it '
|
130
|
+
it 'raises an error' do
|
112
131
|
expect {
|
113
132
|
pact_broker_client.matrix.get(selectors)
|
114
133
|
}.to raise_error PactBroker::Client::Error, "an error message"
|
115
134
|
end
|
116
135
|
end
|
136
|
+
|
137
|
+
context "when no versions are specified" do
|
138
|
+
before do
|
139
|
+
pact_broker.
|
140
|
+
given("the pact for Foo version 1.2.3 and 1.2.4 has been verified by Bar version 4.5.6").
|
141
|
+
upon_receiving("a request for the compatibility matrix for all versions of Foo and Bar").
|
142
|
+
with(
|
143
|
+
method: :get,
|
144
|
+
path: "/matrix",
|
145
|
+
query: "q[][pacticipant]=Foo&q[][pacticipant]=Bar"
|
146
|
+
).
|
147
|
+
will_respond_with(
|
148
|
+
status: 200,
|
149
|
+
headers: pact_broker_response_headers,
|
150
|
+
body: {
|
151
|
+
matrix: Pact.each_like(matrix_row, min: 2)
|
152
|
+
}
|
153
|
+
)
|
154
|
+
end
|
155
|
+
let(:matrix_row) { JSON.parse(File.read('spec/support/matrix.json'))['matrix'].first }
|
156
|
+
let(:selectors) { [{ pacticipant: "Foo" }, { pacticipant: "Bar" }] }
|
157
|
+
|
158
|
+
it "returns multiple rows" do
|
159
|
+
matrix = pact_broker_client.matrix.get(selectors)
|
160
|
+
expect(matrix[:matrix].size).to eq 2
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
context "when the success option is true" do
|
165
|
+
before do
|
166
|
+
pact_broker.
|
167
|
+
given("the pact for Foo version 1.2.3 has been successfully verified by Bar version 4.5.6, and 1.2.4 unsuccessfully by 9.9.9").
|
168
|
+
upon_receiving("a request for the successful rows of the compatibility matrix for all versions of Foo and Bar").
|
169
|
+
with(
|
170
|
+
method: :get,
|
171
|
+
path: "/matrix",
|
172
|
+
query: "q[][pacticipant]=Foo&q[][pacticipant]=Bar&success[]=true"
|
173
|
+
).
|
174
|
+
will_respond_with(
|
175
|
+
status: 200,
|
176
|
+
headers: pact_broker_response_headers,
|
177
|
+
body: matrix_response_body
|
178
|
+
)
|
179
|
+
end
|
180
|
+
let(:matrix_row) { JSON.parse(File.read('spec/support/matrix.json'))['matrix'].first }
|
181
|
+
let(:selectors) { [{ pacticipant: "Foo" }, { pacticipant: "Bar" }] }
|
182
|
+
let(:options) { {success: true} }
|
183
|
+
|
184
|
+
it "returns only the successful row" do
|
185
|
+
matrix = pact_broker_client.matrix.get(selectors, options)
|
186
|
+
expect(matrix[:matrix].size).to eq 1
|
187
|
+
end
|
188
|
+
end
|
117
189
|
end
|
118
190
|
end
|
119
191
|
end
|
data/spec/support/matrix.json
CHANGED
@@ -1,23 +1,28 @@
|
|
1
|
-
|
2
|
-
{
|
3
|
-
"
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
{
|
2
|
+
"summary": {
|
3
|
+
"compatible": true
|
4
|
+
},
|
5
|
+
"matrix": [
|
6
|
+
{
|
7
|
+
"consumer": {
|
8
|
+
"name": "Foo",
|
9
|
+
"version": {
|
10
|
+
"number": "4"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"provider": {
|
14
|
+
"name": "Bar",
|
15
|
+
"version": {
|
16
|
+
"number": "5"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"verificationResult": {
|
20
|
+
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
21
|
+
"success": true
|
22
|
+
},
|
23
|
+
"pact": {
|
24
|
+
"createdAt": "2017-10-10T12:49:04+11:00"
|
7
25
|
}
|
8
|
-
},
|
9
|
-
"provider": {
|
10
|
-
"name": "Bar",
|
11
|
-
"version": {
|
12
|
-
"number": "5"
|
13
|
-
}
|
14
|
-
},
|
15
|
-
"verificationResult": {
|
16
|
-
"verifiedAt": "2017-10-10T12:49:04+11:00",
|
17
|
-
"success": true
|
18
|
-
},
|
19
|
-
"pact": {
|
20
|
-
"createdAt": "2017-10-10T12:49:04+11:00"
|
21
26
|
}
|
22
|
-
|
23
|
-
|
27
|
+
]
|
28
|
+
}
|
data/spec/support/matrix.txt
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_broker-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Beth Skurrie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: appraisal
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: webmock
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +122,8 @@ dependencies:
|
|
136
122
|
- - "~>"
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '1.16'
|
139
|
-
description:
|
125
|
+
description: Client for the Pact Broker. Publish, retrieve and query pacts and verification
|
126
|
+
results.
|
140
127
|
email:
|
141
128
|
- bskurrie@dius.com.au
|
142
129
|
executables:
|
@@ -147,7 +134,6 @@ files:
|
|
147
134
|
- ".gitignore"
|
148
135
|
- ".rspec"
|
149
136
|
- ".travis.yml"
|
150
|
-
- Appraisals
|
151
137
|
- CHANGELOG.md
|
152
138
|
- Gemfile
|
153
139
|
- README.md
|
@@ -157,10 +143,6 @@ files:
|
|
157
143
|
- ci.sh
|
158
144
|
- doc/markdown/Pact Broker Client - Pact Broker.md
|
159
145
|
- doc/markdown/README.md
|
160
|
-
- gemfiles/default.gemfile
|
161
|
-
- gemfiles/default.gemfile.lock
|
162
|
-
- gemfiles/ruby_under_22.gemfile
|
163
|
-
- gemfiles/ruby_under_22.gemfile.lock
|
164
146
|
- lib/pact_broker/client.rb
|
165
147
|
- lib/pact_broker/client/base_client.rb
|
166
148
|
- lib/pact_broker/client/can_i_deploy.rb
|
@@ -168,6 +150,7 @@ files:
|
|
168
150
|
- lib/pact_broker/client/cli/custom_thor.rb
|
169
151
|
- lib/pact_broker/client/cli/version_selector_options_parser.rb
|
170
152
|
- lib/pact_broker/client/error.rb
|
153
|
+
- lib/pact_broker/client/git.rb
|
171
154
|
- lib/pact_broker/client/matrix.rb
|
172
155
|
- lib/pact_broker/client/matrix/formatter.rb
|
173
156
|
- lib/pact_broker/client/matrix/json_formatter.rb
|
@@ -186,6 +169,9 @@ files:
|
|
186
169
|
- lib/pact_broker/client/versions.rb
|
187
170
|
- lib/pact_broker_client.rb
|
188
171
|
- pact-broker-client.gemspec
|
172
|
+
- script/publish-pact.sh
|
173
|
+
- script/release.sh
|
174
|
+
- spec/integration/can_i_deploy_spec.rb
|
189
175
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
190
176
|
- spec/lib/pact_broker/client/can_i_deploy_spec.rb
|
191
177
|
- spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
|
@@ -242,11 +228,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
228
|
version: '0'
|
243
229
|
requirements: []
|
244
230
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.6.
|
231
|
+
rubygems_version: 2.6.12
|
246
232
|
signing_key:
|
247
233
|
specification_version: 4
|
248
234
|
summary: See description
|
249
235
|
test_files:
|
236
|
+
- spec/integration/can_i_deploy_spec.rb
|
250
237
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
251
238
|
- spec/lib/pact_broker/client/can_i_deploy_spec.rb
|
252
239
|
- spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
|
data/Appraisals
DELETED
data/gemfiles/default.gemfile
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
pact_broker-client (1.8.0)
|
5
|
-
httparty
|
6
|
-
json
|
7
|
-
table_print (~> 1.5)
|
8
|
-
term-ansicolor
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
addressable (2.5.2)
|
14
|
-
public_suffix (>= 2.0.2, < 4.0)
|
15
|
-
appraisal (2.2.0)
|
16
|
-
bundler
|
17
|
-
rake
|
18
|
-
thor (>= 0.14.0)
|
19
|
-
awesome_print (1.8.0)
|
20
|
-
conventional-changelog (1.3.0)
|
21
|
-
crack (0.4.3)
|
22
|
-
safe_yaml (~> 1.0.0)
|
23
|
-
diff-lcs (1.3)
|
24
|
-
fakefs (0.11.3)
|
25
|
-
filelock (1.1.1)
|
26
|
-
find_a_port (1.0.1)
|
27
|
-
hashdiff (0.3.7)
|
28
|
-
httparty (0.15.6)
|
29
|
-
multi_xml (>= 0.5.2)
|
30
|
-
json (2.1.0)
|
31
|
-
multi_xml (0.6.0)
|
32
|
-
pact (1.16.1)
|
33
|
-
json (> 1.8.5)
|
34
|
-
pact-mock_service (~> 2.0)
|
35
|
-
pact-support (~> 1.1, >= 1.1.8)
|
36
|
-
rack-test (~> 0.6.2)
|
37
|
-
randexp (~> 0.1.7)
|
38
|
-
rspec (>= 2.14)
|
39
|
-
term-ansicolor (~> 1.0)
|
40
|
-
thor
|
41
|
-
webrick
|
42
|
-
pact-mock_service (2.4.0)
|
43
|
-
filelock (~> 1.1)
|
44
|
-
find_a_port (~> 1.0.1)
|
45
|
-
json
|
46
|
-
pact-support (~> 1.2, >= 1.2.1)
|
47
|
-
rack (~> 2.0)
|
48
|
-
rack-test (~> 0.6.2)
|
49
|
-
rspec (>= 2.14)
|
50
|
-
term-ansicolor (~> 1.0)
|
51
|
-
thor (~> 0.19)
|
52
|
-
webrick (~> 1.3)
|
53
|
-
pact-support (1.2.1)
|
54
|
-
awesome_print (~> 1.1)
|
55
|
-
find_a_port (~> 1.0.1)
|
56
|
-
json
|
57
|
-
rack-test (~> 0.6.2)
|
58
|
-
randexp (~> 0.1.7)
|
59
|
-
rspec (>= 2.14)
|
60
|
-
term-ansicolor (~> 1.0)
|
61
|
-
thor
|
62
|
-
public_suffix (3.0.0)
|
63
|
-
rack (2.0.3)
|
64
|
-
rack-test (0.6.3)
|
65
|
-
rack (>= 1.0)
|
66
|
-
rake (10.0.4)
|
67
|
-
randexp (0.1.7)
|
68
|
-
rspec (3.7.0)
|
69
|
-
rspec-core (~> 3.7.0)
|
70
|
-
rspec-expectations (~> 3.7.0)
|
71
|
-
rspec-mocks (~> 3.7.0)
|
72
|
-
rspec-core (3.7.0)
|
73
|
-
rspec-support (~> 3.7.0)
|
74
|
-
rspec-expectations (3.7.0)
|
75
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
-
rspec-support (~> 3.7.0)
|
77
|
-
rspec-mocks (3.7.0)
|
78
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
-
rspec-support (~> 3.7.0)
|
80
|
-
rspec-support (3.7.0)
|
81
|
-
safe_yaml (1.0.4)
|
82
|
-
table_print (1.5.6)
|
83
|
-
term-ansicolor (1.6.0)
|
84
|
-
tins (~> 1.0)
|
85
|
-
thor (0.20.0)
|
86
|
-
tins (1.15.0)
|
87
|
-
webmock (3.1.0)
|
88
|
-
addressable (>= 2.3.6)
|
89
|
-
crack (>= 0.3.2)
|
90
|
-
hashdiff
|
91
|
-
webrick (1.3.1)
|
92
|
-
|
93
|
-
PLATFORMS
|
94
|
-
ruby
|
95
|
-
|
96
|
-
DEPENDENCIES
|
97
|
-
appraisal
|
98
|
-
conventional-changelog
|
99
|
-
fakefs (~> 0.4)
|
100
|
-
pact (~> 1.16)
|
101
|
-
pact_broker-client!
|
102
|
-
rake (~> 10.0.3)
|
103
|
-
webmock (~> 3.0)
|
104
|
-
|
105
|
-
BUNDLED WITH
|
106
|
-
1.15.4
|