pact_broker-client 1.33.0 → 1.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/pact_broker/client/publish_pacts.rb +11 -3
- data/lib/pact_broker/client/version.rb +1 -1
- data/spec/lib/pact_broker/client/publish_pacts_spec.rb +20 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 108c1ab15ca6e36cc62cd630bdd73e716d83ed78ae9cdf718edb5abc7741ac3b
|
4
|
+
data.tar.gz: fa0e07f37153ce67e4b76a9e2ed32635e613d38972b60687e4eeff659e8d6dff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3a851164b96ca422c7c3e683c389f5731c86e85fa8a7fe29501fb9b0719b4ac20fc8caed19654324765c2f29e1b253dfd12055268b45e59d75eef73507c834f
|
7
|
+
data.tar.gz: c9f836d70e375a8a6205855184fefaf0712cfeb4c46a14bd71433406ddf6aa445c50d76a3d36044d4427ac63b4ad14b2eab5890a16d502e68a4704a4b3cac540
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
<a name="v1.34.0"></a>
|
2
|
+
### v1.34.0 (2020-11-20)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* **pact publish**
|
7
|
+
* strip new lines from version numbers and tags ([5842d24](/../../commit/5842d24))
|
8
|
+
|
9
|
+
* **publish**
|
10
|
+
* update output text when pact already exists and merging ([9b849d3](/../../commit/9b849d3))
|
11
|
+
|
1
12
|
<a name="v1.33.0"></a>
|
2
13
|
### v1.33.0 (2020-11-10)
|
3
14
|
|
@@ -16,8 +16,8 @@ module PactBroker
|
|
16
16
|
def initialize pact_broker_base_url, pact_file_paths, consumer_version, tags, pact_broker_client_options={}
|
17
17
|
@pact_broker_base_url = pact_broker_base_url
|
18
18
|
@pact_file_paths = pact_file_paths
|
19
|
-
@consumer_version = consumer_version
|
20
|
-
@tags = tags
|
19
|
+
@consumer_version = consumer_version.respond_to?(:strip) ? consumer_version.strip : consumer_version
|
20
|
+
@tags = tags ? tags.collect{ |tag| tag.respond_to?(:strip) ? tag.strip : tag } : tags
|
21
21
|
@pact_broker_client_options = pact_broker_client_options
|
22
22
|
end
|
23
23
|
|
@@ -37,6 +37,10 @@ module PactBroker
|
|
37
37
|
@pact_broker_client ||= PactBroker::Client::PactBrokerClient.new(base_url: pact_broker_base_url, client_options: pact_broker_client_options)
|
38
38
|
end
|
39
39
|
|
40
|
+
def merge_on_server?
|
41
|
+
pact_broker_client_options[:write] == :merge
|
42
|
+
end
|
43
|
+
|
40
44
|
def publish_pacts
|
41
45
|
pact_files.group_by(&:pact_name).collect do | pact_name, pact_files |
|
42
46
|
$stdout.puts "Merging #{pact_files.collect(&:path).join(", ")}" if pact_files.size > 1
|
@@ -91,7 +95,11 @@ module PactBroker
|
|
91
95
|
Retry.while_error do
|
92
96
|
pacts = pact_broker_client.pacticipants.versions.pacts
|
93
97
|
if pacts.version_published?(consumer: pact.consumer_name, provider: pact.provider_name, consumer_version: consumer_version)
|
94
|
-
|
98
|
+
if merge_on_server?
|
99
|
+
$stdout.puts "A pact for this consumer version is already published. Merging contents."
|
100
|
+
else
|
101
|
+
$stdout.puts ::Term::ANSIColor.yellow("A pact for this consumer version is already published. Overwriting. (Note: Overwriting pacts is not recommended as it can lead to race conditions. Best practice is to provide a unique consumer version number for each publication.)")
|
102
|
+
end
|
95
103
|
end
|
96
104
|
|
97
105
|
latest_pact_url = pacts.publish(pact_hash: pact, consumer_version: consumer_version)
|
@@ -62,12 +62,12 @@ module PactBroker
|
|
62
62
|
end
|
63
63
|
|
64
64
|
context "when publishing is successful" do
|
65
|
-
|
66
65
|
it "puts the location of the latest pact" do
|
67
66
|
allow($stdout).to receive(:puts)
|
68
67
|
expect($stdout).to receive(:puts).with(/#{latest_pact_url}/)
|
69
68
|
subject.call
|
70
69
|
end
|
70
|
+
|
71
71
|
it "returns true" do
|
72
72
|
expect(subject.call).to be true
|
73
73
|
end
|
@@ -142,6 +142,15 @@ module PactBroker
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
context "when consumer_version has a new line" do
|
146
|
+
let(:consumer_version) { "1\n" }
|
147
|
+
|
148
|
+
it "strips the new line" do
|
149
|
+
expect(pacts_client).to receive(:publish).with(pact_hash: pact_hash, consumer_version: "1")
|
150
|
+
subject.call
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
145
154
|
context "when pact_broker_base_url is blank" do
|
146
155
|
let(:pact_broker_base_url) { " " }
|
147
156
|
it "raises a validation errror" do
|
@@ -164,6 +173,16 @@ module PactBroker
|
|
164
173
|
subject.call
|
165
174
|
end
|
166
175
|
|
176
|
+
context "when the tag has a new line on the end of it" do
|
177
|
+
let(:tags) { ["foo\n"] }
|
178
|
+
|
179
|
+
it "strips the newline" do
|
180
|
+
expect(pact_versions_client).to receive(:tag).with({pacticipant: "Consumer",
|
181
|
+
version: consumer_version, tag: "foo"})
|
182
|
+
subject.call
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
167
186
|
context "when an error occurs tagging the pact" do
|
168
187
|
|
169
188
|
before do
|
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.34.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: 2020-11-
|
11
|
+
date: 2020-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|