pact_broker-client 1.38.3 → 1.39.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 +8 -0
- data/README.md +18 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +100 -0
- data/example/scripts/publish-pact.sh +1 -1
- data/lib/pact_broker/client/cli/broker.rb +23 -7
- data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +55 -0
- data/lib/pact_broker/client/hal/entity.rb +16 -0
- data/lib/pact_broker/client/hal/http_client.rb +6 -2
- data/lib/pact_broker/client/hal/link.rb +12 -0
- data/lib/pact_broker/client/hal/links.rb +15 -0
- data/lib/pact_broker/client/hal_client_methods.rb +8 -0
- data/lib/pact_broker/client/pacts.rb +0 -1
- data/lib/pact_broker/client/publish_pacts.rb +90 -128
- data/lib/pact_broker/client/publish_pacts_the_old_way.rb +194 -0
- data/lib/pact_broker/client/tasks/publication_task.rb +3 -3
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions/record_deployment.rb +4 -4
- data/lib/pact_broker/client/versions/record_undeployment.rb +45 -68
- data/script/publish-pact.sh +17 -4
- data/script/record-deployment.sh +1 -3
- data/script/record-undeployment.sh +4 -0
- data/spec/fixtures/foo-bar.json +31 -0
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +36 -7
- data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +3 -0
- data/spec/lib/pact_broker/client/{publish_pacts_spec.rb → publish_pacts_the_old_way_spec.rb} +10 -9
- data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +18 -12
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +4 -4
- data/spec/pacts/pact_broker_client-pact_broker.json +106 -0
- data/spec/service_providers/pact_broker_client_create_version_spec.rb +4 -4
- data/spec/service_providers/publish_pacts_spec.rb +115 -0
- data/spec/service_providers/record_deployment_spec.rb +5 -5
- metadata +12 -5
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'pact_broker/client/tasks/publication_task'
|
3
3
|
require 'pact_broker/client/publish_pacts'
|
4
|
+
require 'pact_broker/client/command_result'
|
4
5
|
|
5
6
|
module PactBroker::Client
|
6
7
|
describe PublicationTask do
|
@@ -9,13 +10,16 @@ module PactBroker::Client
|
|
9
10
|
@consumer_version = "1.2.3"
|
10
11
|
end
|
11
12
|
|
12
|
-
let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call:
|
13
|
+
let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call: result)}
|
13
14
|
let(:pact_file_list) { ['spec/pact/consumer-provider.json'] }
|
15
|
+
let(:success) { true }
|
16
|
+
let(:result) { instance_double(PactBroker::Client::CommandResult, success: success, message: "message")}
|
14
17
|
|
15
18
|
before do
|
16
19
|
allow(PactBroker::Client::PublishPacts).to receive(:new).and_return(publish_pacts)
|
17
20
|
allow(FileList).to receive(:[]).with(pattern).and_return(pact_file_list)
|
18
21
|
allow(PactBroker::Client::Git).to receive(:branch).and_return('foo')
|
22
|
+
allow($stdout).to receive(:puts)
|
19
23
|
end
|
20
24
|
|
21
25
|
let(:pattern) { "spec/pacts/*.json" }
|
@@ -29,15 +33,16 @@ module PactBroker::Client
|
|
29
33
|
|
30
34
|
context "when pacts are succesfully published" do
|
31
35
|
it "invokes PublishPacts with the default values" do
|
32
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}).and_return(publish_pacts)
|
33
|
-
expect(publish_pacts).to receive(:call).and_return(
|
36
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}, {}).and_return(publish_pacts)
|
37
|
+
expect(publish_pacts).to receive(:call).and_return(result)
|
34
38
|
Rake::Task['pact:publish'].execute
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
38
42
|
context "when a pact fails to be published" do
|
43
|
+
let(:success) { false }
|
44
|
+
|
39
45
|
it "raises an error" do
|
40
|
-
expect(publish_pacts).to receive(:call).and_return(false)
|
41
46
|
expect { Rake::Task['pact:publish'].execute }.to raise_error("One or more pacts failed to be published")
|
42
47
|
end
|
43
48
|
end
|
@@ -52,8 +57,8 @@ module PactBroker::Client
|
|
52
57
|
end
|
53
58
|
|
54
59
|
it "invokes PublishPacts with the write method set" do
|
55
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {write: :merge}).and_return(publish_pacts)
|
56
|
-
expect(publish_pacts).to receive(:call).and_return(
|
60
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {}, {write: :merge}).and_return(publish_pacts)
|
61
|
+
expect(publish_pacts).to receive(:call).and_return(result)
|
57
62
|
Rake::Task['pact:publish:merge'].execute
|
58
63
|
end
|
59
64
|
end
|
@@ -74,7 +79,7 @@ module PactBroker::Client
|
|
74
79
|
end
|
75
80
|
|
76
81
|
it "invokes PublishPacts with the git branch name as a tag" do
|
77
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything).and_return(publish_pacts)
|
82
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything, anything).and_return(publish_pacts)
|
78
83
|
Rake::Task['pact:publish:git_branch'].execute
|
79
84
|
end
|
80
85
|
end
|
@@ -93,7 +98,7 @@ module PactBroker::Client
|
|
93
98
|
end
|
94
99
|
|
95
100
|
it "invokes PublishPacts with the branch name" do
|
96
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
|
101
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything, anything).and_return(publish_pacts)
|
97
102
|
Rake::Task['pact:publish:git_branch_auto_detect_true'].execute
|
98
103
|
end
|
99
104
|
end
|
@@ -113,7 +118,7 @@ module PactBroker::Client
|
|
113
118
|
end
|
114
119
|
|
115
120
|
it "invokes PublishPacts with the specified branch name" do
|
116
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything).and_return(publish_pacts)
|
121
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything, anything).and_return(publish_pacts)
|
117
122
|
Rake::Task['pact:publish:git_branch_auto_detect_true_with_branch'].execute
|
118
123
|
end
|
119
124
|
end
|
@@ -132,7 +137,7 @@ module PactBroker::Client
|
|
132
137
|
end
|
133
138
|
|
134
139
|
it "invokes PublishPacts without the branch name" do
|
135
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything).and_return(publish_pacts)
|
140
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything, anything).and_return(publish_pacts)
|
136
141
|
Rake::Task['pact:publish:git_branch_auto_detect_false'].execute
|
137
142
|
end
|
138
143
|
end
|
@@ -150,7 +155,7 @@ module PactBroker::Client
|
|
150
155
|
end
|
151
156
|
|
152
157
|
it "invokes PublishPacts with the branch name" do
|
153
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
|
158
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"),anything, anything).and_return(publish_pacts)
|
154
159
|
Rake::Task['pact:publish:git_branch_auto_detect_default'].execute
|
155
160
|
end
|
156
161
|
end
|
@@ -180,9 +185,10 @@ module PactBroker::Client
|
|
180
185
|
@pact_broker_base_url,
|
181
186
|
pact_file_list,
|
182
187
|
{ number: "1.2.3", tags: [@tag], branch: "foo", version_required: false},
|
188
|
+
{},
|
183
189
|
{ basic_auth: @pact_broker_basic_auth, token: @pact_broker_token }
|
184
190
|
)
|
185
|
-
expect(publish_pacts).to receive(:call).and_return(
|
191
|
+
expect(publish_pacts).to receive(:call).and_return(result)
|
186
192
|
Rake::Task['pact:publish:custom'].execute
|
187
193
|
end
|
188
194
|
end
|
@@ -15,14 +15,14 @@ module PactBroker
|
|
15
15
|
stub_request(:get, broker_base_url).to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
|
16
16
|
end
|
17
17
|
|
18
|
-
let(:
|
18
|
+
let(:target) { true }
|
19
19
|
|
20
20
|
let(:params) do
|
21
21
|
{
|
22
22
|
pacticipant_name: "Foo",
|
23
23
|
version_number: "1",
|
24
24
|
environment_name: "test",
|
25
|
-
|
25
|
+
target: target,
|
26
26
|
output: "text"
|
27
27
|
}
|
28
28
|
end
|
@@ -57,7 +57,7 @@ module PactBroker
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
context "when
|
60
|
+
context "when target is false" do
|
61
61
|
before do
|
62
62
|
allow_any_instance_of(RecordDeployment).to receive(:check_if_command_supported)
|
63
63
|
allow_any_instance_of(RecordDeployment).to receive(:check_environment_exists)
|
@@ -65,7 +65,7 @@ module PactBroker
|
|
65
65
|
allow_any_instance_of(RecordDeployment).to receive(:pact_broker_name).and_return("")
|
66
66
|
end
|
67
67
|
|
68
|
-
let(:
|
68
|
+
let(:target) { false }
|
69
69
|
|
70
70
|
let(:deployed_version_resource) do
|
71
71
|
double('PactBroker::Client::Hal::Entity', response: double('response', headers: response_headers) )
|
@@ -1550,6 +1550,112 @@
|
|
1550
1550
|
}
|
1551
1551
|
}
|
1552
1552
|
},
|
1553
|
+
{
|
1554
|
+
"description": "a request for the index resource",
|
1555
|
+
"providerState": "the pb:publish-contracts relations exists in the index resource",
|
1556
|
+
"request": {
|
1557
|
+
"method": "GET",
|
1558
|
+
"path": "/",
|
1559
|
+
"headers": {
|
1560
|
+
"Accept": "application/hal+json"
|
1561
|
+
}
|
1562
|
+
},
|
1563
|
+
"response": {
|
1564
|
+
"status": 200,
|
1565
|
+
"headers": {
|
1566
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1567
|
+
},
|
1568
|
+
"body": {
|
1569
|
+
"_links": {
|
1570
|
+
"pb:publish-contracts": {
|
1571
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS"
|
1572
|
+
}
|
1573
|
+
}
|
1574
|
+
},
|
1575
|
+
"matchingRules": {
|
1576
|
+
"$.body._links.pb:publish-contracts.href": {
|
1577
|
+
"match": "regex",
|
1578
|
+
"regex": "http:\\/\\/.*"
|
1579
|
+
}
|
1580
|
+
}
|
1581
|
+
}
|
1582
|
+
},
|
1583
|
+
{
|
1584
|
+
"description": "a request to publish contracts",
|
1585
|
+
"request": {
|
1586
|
+
"method": "POST",
|
1587
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS",
|
1588
|
+
"headers": {
|
1589
|
+
"Content-Type": "application/json",
|
1590
|
+
"Accept": "application/hal+json"
|
1591
|
+
},
|
1592
|
+
"body": {
|
1593
|
+
"pacticipantName": "Foo",
|
1594
|
+
"pacticipantVersionNumber": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1595
|
+
"branch": "main",
|
1596
|
+
"tags": [
|
1597
|
+
"dev"
|
1598
|
+
],
|
1599
|
+
"buildUrl": "http://build",
|
1600
|
+
"contracts": [
|
1601
|
+
{
|
1602
|
+
"consumerName": "Foo",
|
1603
|
+
"providerName": "Bar",
|
1604
|
+
"specification": "pact",
|
1605
|
+
"contentType": "application/json",
|
1606
|
+
"content": "eyJjb25zdW1lciI6eyJuYW1lIjoiRm9vIn0sInByb3ZpZGVyIjp7Im5hbWUiOiJCYXIifSwiaW50ZXJhY3Rpb25zIjpbeyJkZXNjcmlwdGlvbiI6ImFuIGV4YW1wbGUgcmVxdWVzdCIsInByb3ZpZGVyU3RhdGUiOiJhIHByb3ZpZGVyIHN0YXRlIiwicmVxdWVzdCI6eyJtZXRob2QiOiJHRVQiLCJwYXRoIjoiLyIsImhlYWRlcnMiOnt9fSwicmVzcG9uc2UiOnsic3RhdHVzIjoyMDAsImhlYWRlcnMiOnsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vaGFsK2pzb24ifX19XSwibWV0YWRhdGEiOnsicGFjdFNwZWNpZmljYXRpb24iOnsidmVyc2lvbiI6IjIuMC4wIn19fQ==",
|
1607
|
+
"writeMode": "overwrite"
|
1608
|
+
}
|
1609
|
+
]
|
1610
|
+
}
|
1611
|
+
},
|
1612
|
+
"response": {
|
1613
|
+
"status": 200,
|
1614
|
+
"headers": {
|
1615
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1616
|
+
},
|
1617
|
+
"body": {
|
1618
|
+
"_embedded": {
|
1619
|
+
"pacticipant": {
|
1620
|
+
"name": "Foo"
|
1621
|
+
},
|
1622
|
+
"version": {
|
1623
|
+
"number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1624
|
+
"buildUrl": "http://build"
|
1625
|
+
}
|
1626
|
+
},
|
1627
|
+
"logs": [
|
1628
|
+
{
|
1629
|
+
"level": "info",
|
1630
|
+
"message": "some message"
|
1631
|
+
}
|
1632
|
+
],
|
1633
|
+
"_links": {
|
1634
|
+
"pb:pacticipant-version-tags": [
|
1635
|
+
{
|
1636
|
+
"name": "dev"
|
1637
|
+
}
|
1638
|
+
],
|
1639
|
+
"pb:contracts": [
|
1640
|
+
{
|
1641
|
+
"href": "http://some-pact"
|
1642
|
+
}
|
1643
|
+
]
|
1644
|
+
}
|
1645
|
+
},
|
1646
|
+
"matchingRules": {
|
1647
|
+
"$.body.logs": {
|
1648
|
+
"min": 1
|
1649
|
+
},
|
1650
|
+
"$.body.logs[*].*": {
|
1651
|
+
"match": "type"
|
1652
|
+
},
|
1653
|
+
"$.body._links.pb:contracts[0].href": {
|
1654
|
+
"match": "type"
|
1655
|
+
}
|
1656
|
+
}
|
1657
|
+
}
|
1658
|
+
},
|
1553
1659
|
{
|
1554
1660
|
"description": "a request for the index resource",
|
1555
1661
|
"providerState": "the pb:pacticipant-version and pb:environments relations exist in the index resource",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'pact_helper'
|
2
2
|
require 'pact_broker/client'
|
3
|
-
require 'pact_broker/client/
|
3
|
+
require 'pact_broker/client/publish_pacts_the_old_way'
|
4
4
|
|
5
5
|
describe PactBroker::Client::Versions, pact: true do
|
6
6
|
|
@@ -9,7 +9,7 @@ describe PactBroker::Client::Versions, pact: true do
|
|
9
9
|
|
10
10
|
describe "creating a pacticipant version" do
|
11
11
|
before do
|
12
|
-
allow(
|
12
|
+
allow(publish_pacts_the_old_way).to receive(:consumer_names).and_return(["Foo"])
|
13
13
|
allow($stdout).to receive(:puts)
|
14
14
|
end
|
15
15
|
let(:version_path) { "/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-{pacticipant}-{version}" }
|
@@ -18,11 +18,11 @@ describe PactBroker::Client::Versions, pact: true do
|
|
18
18
|
let(:branch) { "main" }
|
19
19
|
let(:build_url) { "http://my-ci/builds/1" }
|
20
20
|
let(:consumer_version_params) { { number: number, branch: branch, build_url: build_url } }
|
21
|
-
let(:
|
21
|
+
let(:publish_pacts_the_old_way) { PactBroker::Client::PublishPactsTheOldWay.new(pact_broker.mock_service_base_url, ["some-pact.json"], consumer_version_params, {}) }
|
22
22
|
let(:provider_state) { "version #{number} of pacticipant Foo does not exist" }
|
23
23
|
let(:expected_response_status) { 201 }
|
24
24
|
|
25
|
-
subject {
|
25
|
+
subject { publish_pacts_the_old_way.send(:create_consumer_versions) }
|
26
26
|
|
27
27
|
before do
|
28
28
|
pact_broker
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'pact_broker/client/publish_pacts'
|
2
|
+
require 'service_providers/pact_helper'
|
3
|
+
|
4
|
+
RSpec.describe "publishing contracts", pact: true do
|
5
|
+
before do
|
6
|
+
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
|
7
|
+
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:default_max_tries).and_return(1)
|
8
|
+
end
|
9
|
+
include_context "pact broker"
|
10
|
+
include PactBrokerPactHelperMethods
|
11
|
+
|
12
|
+
let(:pacticipant_name) { "Foo" }
|
13
|
+
let(:version_number) { "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30" }
|
14
|
+
let(:output) { "text" }
|
15
|
+
let(:build_url) { "http://build" }
|
16
|
+
let(:consumer_version_params) do
|
17
|
+
{
|
18
|
+
pacticipant_name: pacticipant_name,
|
19
|
+
number: version_number,
|
20
|
+
tags: ["dev"],
|
21
|
+
branch: "main",
|
22
|
+
build_url: build_url,
|
23
|
+
output: output
|
24
|
+
}
|
25
|
+
end
|
26
|
+
let(:pact_file_path_1) { "spec/fixtures/foo-bar.json" }
|
27
|
+
let(:pact_file_paths) { [pact_file_path_1] }
|
28
|
+
let(:options) { {} }
|
29
|
+
let(:pact_broker_client_options) { {} }
|
30
|
+
let(:expected_content) { Base64.strict_encode64(JSON.parse(File.read(pact_file_path_1)).to_json) }
|
31
|
+
let(:request_body) do
|
32
|
+
{
|
33
|
+
pacticipantName: pacticipant_name,
|
34
|
+
pacticipantVersionNumber: version_number,
|
35
|
+
branch: "main",
|
36
|
+
tags: ["dev"],
|
37
|
+
buildUrl: "http://build",
|
38
|
+
contracts: [
|
39
|
+
{
|
40
|
+
consumerName: pacticipant_name,
|
41
|
+
providerName: "Bar",
|
42
|
+
specification: "pact",
|
43
|
+
contentType: "application/json",
|
44
|
+
content: expected_content,
|
45
|
+
writeMode: "overwrite"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
subject { PactBroker::Client::PublishPacts.call(broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options) }
|
52
|
+
|
53
|
+
def mock_index
|
54
|
+
pact_broker
|
55
|
+
.given("the pb:publish-contracts relations exists in the index resource")
|
56
|
+
.upon_receiving("a request for the index resource")
|
57
|
+
.with(
|
58
|
+
method: "GET",
|
59
|
+
path: '/',
|
60
|
+
headers: get_request_headers).
|
61
|
+
will_respond_with(
|
62
|
+
status: 200,
|
63
|
+
headers: pact_broker_response_headers,
|
64
|
+
body: {
|
65
|
+
_links: {
|
66
|
+
:'pb:publish-contracts' => {
|
67
|
+
href: placeholder_url_term("pb:publish-contracts")
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def mock_contract_publication
|
75
|
+
pact_broker
|
76
|
+
.upon_receiving("a request to publish contracts")
|
77
|
+
.with(
|
78
|
+
method: "POST",
|
79
|
+
path: '/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS',
|
80
|
+
headers: post_request_headers,
|
81
|
+
body: request_body).
|
82
|
+
will_respond_with(
|
83
|
+
status: 200,
|
84
|
+
headers: pact_broker_response_headers,
|
85
|
+
body: {
|
86
|
+
_embedded: {
|
87
|
+
pacticipant: {
|
88
|
+
name: pacticipant_name
|
89
|
+
},
|
90
|
+
version: {
|
91
|
+
number: version_number,
|
92
|
+
buildUrl: build_url
|
93
|
+
}
|
94
|
+
},
|
95
|
+
logs: Pact.each_like(level: "info", message: "some message"),
|
96
|
+
_links: {
|
97
|
+
:'pb:pacticipant-version-tags' => [{ name: "dev"} ],
|
98
|
+
:'pb:contracts' => [{ href: Pact.like("http://some-pact") }]
|
99
|
+
}
|
100
|
+
}
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
context "with valid params" do
|
105
|
+
before do
|
106
|
+
mock_index
|
107
|
+
mock_contract_publication
|
108
|
+
end
|
109
|
+
|
110
|
+
it "returns a success result" do
|
111
|
+
expect(subject.success).to be true
|
112
|
+
expect(subject.message).to include "some message"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -10,13 +10,13 @@ RSpec.describe "recording a deployment", pact: true do
|
|
10
10
|
let(:version_number) { "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30" }
|
11
11
|
let(:environment_name) { "test" }
|
12
12
|
let(:output) { "text" }
|
13
|
-
let(:
|
13
|
+
let(:target) { true }
|
14
14
|
let(:params) do
|
15
15
|
{
|
16
16
|
pacticipant_name: pacticipant_name,
|
17
17
|
version_number: version_number,
|
18
18
|
environment_name: environment_name,
|
19
|
-
|
19
|
+
target: target,
|
20
20
|
output: output
|
21
21
|
}
|
22
22
|
end
|
@@ -148,14 +148,14 @@ RSpec.describe "recording a deployment", pact: true do
|
|
148
148
|
path: "/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST",
|
149
149
|
headers: post_request_headers,
|
150
150
|
body: {
|
151
|
-
replacedPreviousDeployedVersion:
|
151
|
+
replacedPreviousDeployedVersion: target
|
152
152
|
}
|
153
153
|
)
|
154
154
|
.will_respond_with(
|
155
155
|
status: 201,
|
156
156
|
headers: pact_broker_response_headers,
|
157
157
|
body: {
|
158
|
-
replacedPreviousDeployedVersion:
|
158
|
+
replacedPreviousDeployedVersion: target
|
159
159
|
}
|
160
160
|
)
|
161
161
|
end
|
@@ -176,7 +176,7 @@ RSpec.describe "recording a deployment", pact: true do
|
|
176
176
|
let(:output) { "json" }
|
177
177
|
|
178
178
|
it "returns the JSON payload" do
|
179
|
-
expect(JSON.parse(subject.message)).to eq "replacedPreviousDeployedVersion" =>
|
179
|
+
expect(JSON.parse(subject.message)).to eq "replacedPreviousDeployedVersion" => target
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
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.39.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: 2021-04-
|
11
|
+
date: 2021-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- lib/pact_broker/client/cli/create_or_update_webhook_long_desc.txt
|
213
213
|
- lib/pact_broker/client/cli/create_webhook_long_desc.txt
|
214
214
|
- lib/pact_broker/client/cli/custom_thor.rb
|
215
|
+
- lib/pact_broker/client/cli/record_deployment_long_desc.txt
|
215
216
|
- lib/pact_broker/client/cli/version_selector_options_parser.rb
|
216
217
|
- lib/pact_broker/client/command_result.rb
|
217
218
|
- lib/pact_broker/client/create_tag.rb
|
@@ -240,6 +241,7 @@ files:
|
|
240
241
|
- lib/pact_broker/client/pacts.rb
|
241
242
|
- lib/pact_broker/client/pacts/list_latest_versions.rb
|
242
243
|
- lib/pact_broker/client/publish_pacts.rb
|
244
|
+
- lib/pact_broker/client/publish_pacts_the_old_way.rb
|
243
245
|
- lib/pact_broker/client/retry.rb
|
244
246
|
- lib/pact_broker/client/tasks.rb
|
245
247
|
- lib/pact_broker/client/tasks/publication_task.rb
|
@@ -259,8 +261,10 @@ files:
|
|
259
261
|
- script/generate-cli-usage.sh
|
260
262
|
- script/publish-pact.sh
|
261
263
|
- script/record-deployment.sh
|
264
|
+
- script/record-undeployment.sh
|
262
265
|
- script/release.sh
|
263
266
|
- script/trigger-release.sh
|
267
|
+
- spec/fixtures/foo-bar.json
|
264
268
|
- spec/integration/can_i_deploy_spec.rb
|
265
269
|
- spec/integration/create_version_tag_spec.rb
|
266
270
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
@@ -284,7 +288,7 @@ files:
|
|
284
288
|
- spec/lib/pact_broker/client/pact_broker_client_spec.rb
|
285
289
|
- spec/lib/pact_broker/client/pacticipants/create_spec.rb
|
286
290
|
- spec/lib/pact_broker/client/pacticipants_spec.rb
|
287
|
-
- spec/lib/pact_broker/client/
|
291
|
+
- spec/lib/pact_broker/client/publish_pacts_the_old_way_spec.rb
|
288
292
|
- spec/lib/pact_broker/client/retry_spec.rb
|
289
293
|
- spec/lib/pact_broker/client/tasks/publication_task_spec.rb
|
290
294
|
- spec/lib/pact_broker/client/versions/describe_spec.rb
|
@@ -305,6 +309,7 @@ files:
|
|
305
309
|
- spec/service_providers/pact_broker_client_versions_spec.rb
|
306
310
|
- spec/service_providers/pact_helper.rb
|
307
311
|
- spec/service_providers/pacticipants_create_spec.rb
|
312
|
+
- spec/service_providers/publish_pacts_spec.rb
|
308
313
|
- spec/service_providers/record_deployment_spec.rb
|
309
314
|
- spec/service_providers/webhooks_create_spec.rb
|
310
315
|
- spec/spec_helper.rb
|
@@ -339,11 +344,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
344
|
- !ruby/object:Gem::Version
|
340
345
|
version: '0'
|
341
346
|
requirements: []
|
342
|
-
rubygems_version: 3.2.
|
347
|
+
rubygems_version: 3.2.16
|
343
348
|
signing_key:
|
344
349
|
specification_version: 4
|
345
350
|
summary: See description
|
346
351
|
test_files:
|
352
|
+
- spec/fixtures/foo-bar.json
|
347
353
|
- spec/integration/can_i_deploy_spec.rb
|
348
354
|
- spec/integration/create_version_tag_spec.rb
|
349
355
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
@@ -367,7 +373,7 @@ test_files:
|
|
367
373
|
- spec/lib/pact_broker/client/pact_broker_client_spec.rb
|
368
374
|
- spec/lib/pact_broker/client/pacticipants/create_spec.rb
|
369
375
|
- spec/lib/pact_broker/client/pacticipants_spec.rb
|
370
|
-
- spec/lib/pact_broker/client/
|
376
|
+
- spec/lib/pact_broker/client/publish_pacts_the_old_way_spec.rb
|
371
377
|
- spec/lib/pact_broker/client/retry_spec.rb
|
372
378
|
- spec/lib/pact_broker/client/tasks/publication_task_spec.rb
|
373
379
|
- spec/lib/pact_broker/client/versions/describe_spec.rb
|
@@ -388,6 +394,7 @@ test_files:
|
|
388
394
|
- spec/service_providers/pact_broker_client_versions_spec.rb
|
389
395
|
- spec/service_providers/pact_helper.rb
|
390
396
|
- spec/service_providers/pacticipants_create_spec.rb
|
397
|
+
- spec/service_providers/publish_pacts_spec.rb
|
391
398
|
- spec/service_providers/record_deployment_spec.rb
|
392
399
|
- spec/service_providers/webhooks_create_spec.rb
|
393
400
|
- spec/spec_helper.rb
|