pact_broker 2.19.1 → 2.19.2
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/CHANGELOG.md +20 -0
- data/README.md +0 -1
- data/db/migrations/000002_create_versions_table.rb +1 -1
- data/db/migrations/20180311_optimise_head_matrix.rb +1 -0
- data/db/migrations/20180523_create_latest_verifications_for_consumer_version_tags.rb +50 -0
- data/db/migrations/20180524_create_latest_verifications_for_consumer_and_provider.rb +46 -0
- data/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +7 -3
- data/lib/pact_broker/configuration.rb +6 -1
- data/lib/pact_broker/domain/webhook_request.rb +12 -11
- data/lib/pact_broker/index/service.rb +14 -84
- data/lib/pact_broker/matrix/aggregated_row.rb +71 -0
- data/lib/pact_broker/matrix/head_row.rb +23 -0
- data/lib/pact_broker/matrix/repository.rb +0 -1
- data/lib/pact_broker/matrix/row.rb +15 -20
- data/lib/pact_broker/pacts/content.rb +66 -0
- data/lib/pact_broker/pacts/create_formatted_diff.rb +0 -1
- data/lib/pact_broker/pacts/diff.rb +3 -2
- data/lib/pact_broker/pacts/generate_sha.rb +24 -0
- data/lib/pact_broker/pacts/parse.rb +11 -0
- data/lib/pact_broker/pacts/repository.rb +4 -4
- data/lib/pact_broker/pacts/service.rb +4 -2
- data/lib/pact_broker/pacts/sort_content.rb +54 -0
- data/lib/pact_broker/verifications/latest_verification_for_consumer_and_provider.rb +26 -0
- data/lib/pact_broker/verifications/latest_verification_for_consumer_version_tag.rb +23 -0
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/repository.rb +12 -3
- data/script/run-with-ssl.rb +44 -0
- data/spec/features/base_equality_only_on_content_that_affects_verification_results_spec.rb +34 -0
- data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +6 -2
- data/spec/lib/pact_broker/domain/{index_items_spec.rb → index_item_spec.rb} +0 -0
- data/spec/lib/pact_broker/domain/webhook_request_spec.rb +16 -5
- data/spec/lib/pact_broker/matrix/aggregated_row_spec.rb +79 -0
- data/spec/lib/pact_broker/matrix/head_row_spec.rb +55 -0
- data/spec/lib/pact_broker/matrix/row_spec.rb +22 -2
- data/spec/lib/pact_broker/pacts/content_spec.rb +166 -0
- data/spec/lib/pact_broker/pacts/create_formatted_diff_spec.rb +0 -3
- data/spec/lib/pact_broker/pacts/generate_sha_spec.rb +92 -0
- data/spec/lib/pact_broker/pacts/repository_spec.rb +47 -4
- data/spec/lib/pact_broker/pacts/sort_content_spec.rb +44 -0
- data/spec/lib/pact_broker/versions/repository_spec.rb +13 -5
- data/spec/spec_helper.rb +1 -0
- data/spec/support/foo-bar.json +34 -0
- data/spec/support/rspec_match_hash.rb +14 -17
- data/spec/support/test_data_builder.rb +5 -4
- metadata +26 -8
- data/lib/pact_broker/matrix/latest_row.rb +0 -10
- data/lib/pact_broker/pacts/sort_verifiable_content.rb +0 -41
- data/spec/lib/pact_broker/pacts/sort_verifiable_content_spec.rb +0 -25
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'pact_broker/matrix/row'
|
2
|
-
|
3
|
-
module PactBroker
|
4
|
-
module Matrix
|
5
|
-
# Latest pact revision for each consumer version => latest verification for each provider version
|
6
|
-
class LatestRow < Row
|
7
|
-
set_dataset(:latest_matrix_for_consumer_version_and_provider_version)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'pact_broker/json'
|
2
|
-
|
3
|
-
module PactBroker
|
4
|
-
module Pacts
|
5
|
-
class SortVerifiableContent
|
6
|
-
|
7
|
-
def self.call json
|
8
|
-
hash = JSON.parse(json, PACT_PARSING_OPTIONS)
|
9
|
-
verifiable_content = if hash['interactions']
|
10
|
-
hash['interactions']
|
11
|
-
elsif hash['messages']
|
12
|
-
hash['messages']
|
13
|
-
end
|
14
|
-
order_verifiable_content(verifiable_content).to_json
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.order_verifiable_content array
|
18
|
-
array_with_ordered_hashes = order_hashes(array)
|
19
|
-
array_with_ordered_hashes.sort{|a, b| a.to_json <=> b.to_json }
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.order_hashes thing
|
23
|
-
case thing
|
24
|
-
when Hash then order_hash(thing)
|
25
|
-
when Array then order_child_array(thing)
|
26
|
-
else thing
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.order_child_array array
|
31
|
-
array.collect{|thing| order_hashes(thing) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.order_hash hash
|
35
|
-
hash.keys.sort.each_with_object({}) do | key, new_hash |
|
36
|
-
new_hash[key] = order_hashes(hash[key])
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'pact_broker/pacts/sort_verifiable_content'
|
2
|
-
|
3
|
-
module PactBroker
|
4
|
-
module Pacts
|
5
|
-
describe SortVerifiableContent do
|
6
|
-
let(:pact_content_1) do
|
7
|
-
{
|
8
|
-
a: 1,
|
9
|
-
interactions: [{ a: 1, b: 2 }, { a: 2, b: 3 }]
|
10
|
-
}.to_json
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:pact_content_2) do
|
14
|
-
{
|
15
|
-
interactions: [{ b: 3, a: 2}, { b: 2, a: 1 }],
|
16
|
-
a: 1
|
17
|
-
}.to_json
|
18
|
-
end
|
19
|
-
|
20
|
-
it "sorts the interactions/messages and keys in a deterministic way" do
|
21
|
-
expect(SortVerifiableContent.call(pact_content_1).to_json).to eq(SortVerifiableContent.call(pact_content_2).to_json)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|