pact_broker-client 1.75.3 → 1.76.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/lib/pact_broker/client/can_i_deploy.rb +1 -1
  4. data/lib/pact_broker/client/version.rb +1 -1
  5. metadata +5 -216
  6. data/.github/workflows/test.yml +0 -59
  7. data/.rspec +0 -3
  8. data/lib/pact_broker/client/pacts/list_latest_versions.rb +0 -66
  9. data/lib/pact_broker/client/webhooks/test.rb +0 -16
  10. data/pact-broker-client.gemspec +0 -31
  11. data/spec/fixtures/MyConsumer-MyProvider (1).json +0 -37
  12. data/spec/fixtures/MyConsumer-MyProvider.json +0 -37
  13. data/spec/fixtures/approvals/can_i_deploy_failure_dry_run.approved.txt +0 -7
  14. data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +0 -13
  15. data/spec/fixtures/approvals/can_i_deploy_success_dry_run.approved.txt +0 -7
  16. data/spec/fixtures/approvals/describe_environment.approved.txt +0 -7
  17. data/spec/fixtures/approvals/describe_pacticipant.approved.txt +0 -2
  18. data/spec/fixtures/approvals/list_environments.approved.txt +0 -3
  19. data/spec/fixtures/approvals/publish_provider_contract.approved.txt +0 -2
  20. data/spec/fixtures/certificates/ca_cert.pem +0 -19
  21. data/spec/fixtures/certificates/ca_cert.srl +0 -1
  22. data/spec/fixtures/certificates/ca_key.pem +0 -28
  23. data/spec/fixtures/certificates/client_cert.pem +0 -17
  24. data/spec/fixtures/certificates/key.pem +0 -28
  25. data/spec/fixtures/certificates/server.csr +0 -15
  26. data/spec/fixtures/certificates/unsigned_cert.pem +0 -19
  27. data/spec/fixtures/certificates/unsigned_key.pem +0 -28
  28. data/spec/fixtures/foo-bar.json +0 -31
  29. data/spec/integration/can_i_deploy_spec.rb +0 -24
  30. data/spec/integration/can_i_merge_spec.rb +0 -44
  31. data/spec/integration/create_version_tag_spec.rb +0 -20
  32. data/spec/integration/describe_environment_spec.rb +0 -31
  33. data/spec/integration/publish_provider_contract_spec.rb +0 -53
  34. data/spec/integration/unknown_options_spec.rb +0 -39
  35. data/spec/lib/pact_broker/client/base_client_spec.rb +0 -182
  36. data/spec/lib/pact_broker/client/branches/delete_branch_spec.rb +0 -103
  37. data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +0 -250
  38. data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +0 -196
  39. data/spec/lib/pact_broker/client/cli/broker_create_or_update_webhook_spec.rb +0 -23
  40. data/spec/lib/pact_broker/client/cli/broker_create_webhook_spec.rb +0 -23
  41. data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +0 -327
  42. data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +0 -287
  43. data/spec/lib/pact_broker/client/cli/custom_thor_spec.rb +0 -174
  44. data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +0 -97
  45. data/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +0 -224
  46. data/spec/lib/pact_broker/client/deployments/record_support_ended_spec.rb +0 -208
  47. data/spec/lib/pact_broker/client/deployments/record_undeployment_spec.rb +0 -227
  48. data/spec/lib/pact_broker/client/environments/delete_environment_spec.rb +0 -120
  49. data/spec/lib/pact_broker/client/environments/describe_environment_spec.rb +0 -89
  50. data/spec/lib/pact_broker/client/environments/update_environment_spec.rb +0 -167
  51. data/spec/lib/pact_broker/client/generate_display_name_spec.rb +0 -39
  52. data/spec/lib/pact_broker/client/git_spec.rb +0 -159
  53. data/spec/lib/pact_broker/client/hal/authorization_header_redactor_spec.rb +0 -17
  54. data/spec/lib/pact_broker/client/hal/entity_spec.rb +0 -149
  55. data/spec/lib/pact_broker/client/hal/http_client_spec.rb +0 -238
  56. data/spec/lib/pact_broker/client/hal/link_spec.rb +0 -127
  57. data/spec/lib/pact_broker/client/matrix/abbreviate_version_number_spec.rb +0 -42
  58. data/spec/lib/pact_broker/client/matrix/resource_spec.rb +0 -70
  59. data/spec/lib/pact_broker/client/matrix/text_formatter_spec.rb +0 -63
  60. data/spec/lib/pact_broker/client/matrix_spec.rb +0 -17
  61. data/spec/lib/pact_broker/client/merge_pacts_spec.rb +0 -198
  62. data/spec/lib/pact_broker/client/pact_broker_client_spec.rb +0 -47
  63. data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +0 -31
  64. data/spec/lib/pact_broker/client/pacticipants_spec.rb +0 -18
  65. data/spec/lib/pact_broker/client/publish_pacts_the_old_way_spec.rb +0 -272
  66. data/spec/lib/pact_broker/client/retry_spec.rb +0 -119
  67. data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +0 -231
  68. data/spec/lib/pact_broker/client/versions/create_spec.rb +0 -174
  69. data/spec/lib/pact_broker/client/versions/describe_spec.rb +0 -64
  70. data/spec/lib/pact_broker/client/versions_spec.rb +0 -34
  71. data/spec/lib/pact_broker/client/webhooks/create_spec.rb +0 -99
  72. data/spec/lib/pactflow/client/provider_contracts/publish_spec.rb +0 -179
  73. data/spec/pacts/pact_broker_client-pact_broker.json +0 -2969
  74. data/spec/pacts/pact_broker_client-pactflow.json +0 -288
  75. data/spec/readme_spec.rb +0 -16
  76. data/spec/service_providers/create_environment_spec.rb +0 -78
  77. data/spec/service_providers/delete_branch_spec.rb +0 -68
  78. data/spec/service_providers/extra_goodies_spec.rb +0 -108
  79. data/spec/service_providers/list_environments_spec.rb +0 -77
  80. data/spec/service_providers/list_latest_pact_versions_spec.rb.bak +0 -44
  81. data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +0 -98
  82. data/spec/service_providers/pact_broker_client_matrix_spec.rb +0 -292
  83. data/spec/service_providers/pact_broker_client_pacticipant_version_spec.rb +0 -56
  84. data/spec/service_providers/pact_broker_client_publish_spec.rb +0 -135
  85. data/spec/service_providers/pact_broker_client_register_repository_spec.rb +0 -49
  86. data/spec/service_providers/pact_broker_client_retrieve_all_pacts_for_provider_spec.rb +0 -53
  87. data/spec/service_providers/pact_broker_client_retrieve_pact_spec.rb +0 -109
  88. data/spec/service_providers/pact_broker_client_tags_spec.rb +0 -101
  89. data/spec/service_providers/pact_broker_client_versions_spec.rb +0 -113
  90. data/spec/service_providers/pact_helper.rb +0 -136
  91. data/spec/service_providers/pactflow_publish_provider_contract_spec.rb +0 -137
  92. data/spec/service_providers/pactflow_publish_provider_contract_the_old_way_spec.rb +0 -129
  93. data/spec/service_providers/pactflow_webhooks_create_spec.rb +0 -86
  94. data/spec/service_providers/pacticipants_create_spec.rb +0 -119
  95. data/spec/service_providers/publish_pacts_spec.rb +0 -114
  96. data/spec/service_providers/record_deployment_spec.rb +0 -199
  97. data/spec/service_providers/record_release_spec.rb +0 -130
  98. data/spec/service_providers/record_undeployment_spec.rb +0 -164
  99. data/spec/service_providers/webhooks_create_spec.rb +0 -391
  100. data/spec/spec_helper.rb +0 -68
  101. data/spec/support/approvals.rb +0 -26
  102. data/spec/support/cli_test_pacts/bar.json +0 -0
  103. data/spec/support/cli_test_pacts/foo.json +0 -0
  104. data/spec/support/latest_pacts_for_provider.json +0 -15
  105. data/spec/support/matrix.json +0 -35
  106. data/spec/support/matrix.txt +0 -3
  107. data/spec/support/matrix_error.txt +0 -3
  108. data/spec/support/matrix_with_results.txt +0 -10
  109. data/spec/support/pacticipant_get.json +0 -18
  110. data/spec/support/pacticipants_list.json +0 -26
  111. data/spec/support/pacts_latest_list.json +0 -41
  112. data/spec/support/shared_context.rb +0 -25
  113. data/spec/support/ssl_server.rb +0 -42
data/spec/spec_helper.rb DELETED
@@ -1,68 +0,0 @@
1
- require 'webmock/rspec'
2
- require 'rspec/its'
3
-
4
- ENV["PACT_BROKER_CAN_I_DEPLOY_IGNORE"] = nil
5
-
6
- WebMock.disable_net_connect!(allow_localhost: true)
7
-
8
- require "./spec/support/shared_context.rb"
9
- require "./spec/support/approvals.rb"
10
-
11
- is_windows = (RbConfig::CONFIG['host_os'] =~ /bccwin|cygwin|djgpp|mingw|mswin|wince/i) != nil
12
- is_ci = ENV['CI'] == 'true'
13
-
14
- RSpec.configure do | config |
15
-
16
- config.before(:each) do
17
- ENV.delete('PACT_BROKER_BASE_URL')
18
- ENV.delete('PACT_BROKER_USERNAME')
19
- ENV.delete('PACT_BROKER_PASSWORD')
20
- ENV.delete('PACT_BROKER_TOKEN')
21
- end
22
-
23
- config.after(:all) do
24
- Pact::Fixture.check_fixtures
25
- end
26
-
27
- config.filter_run_excluding skip_windows: is_windows, skip_ci: is_ci
28
- config.example_status_persistence_file_path = "./spec/examples.txt"
29
-
30
- def capture(stream)
31
- begin
32
- stream = stream.to_s
33
- eval "$#{stream} = StringIO.new"
34
- yield
35
- result = eval("$#{stream}").string
36
- rescue SystemExit => e
37
- puts "CAUGHT SYSTEM EXIT"
38
- puts e
39
- puts e.backtrace
40
- ensure
41
- eval("$#{stream} = #{stream.upcase}")
42
- end
43
-
44
- result
45
- end
46
- end
47
-
48
- module Pact
49
- module Fixture
50
-
51
- def self.add_fixture key, value
52
- fixtures[key] ||= []
53
- fixtures[key] << value
54
- end
55
-
56
- def self.fixtures
57
- @fixtures ||= {}
58
- end
59
-
60
- def self.check_fixtures
61
- fixtures.each do | fixture_group |
62
- if fixture_group.size > 1
63
- #TODO compare fixtures to ensure they match
64
- end
65
- end
66
- end
67
- end
68
- end
@@ -1,26 +0,0 @@
1
- require 'approvals/rspec'
2
- require 'pact/support'
3
-
4
- Approvals.configure do |c|
5
- c.approvals_path = 'spec/fixtures/approvals/'
6
- end
7
-
8
- def print_diff(exception)
9
- parts = exception.message.split('"')
10
- received_file = parts[1]
11
- approved_file = parts[3]
12
- if File.exist?(received_file) && File.exist?(approved_file) && received_file.end_with?(".json") && approved_file.end_with?(".json")
13
- received_hash = JSON.parse(File.read(received_file))
14
- approved_hash = JSON.parse(File.read(approved_file))
15
- diff = Pact::Matchers.diff(approved_hash, received_hash)
16
- puts Pact::Matchers::UnixDiffFormatter.call(diff)
17
- end
18
- end
19
-
20
- RSpec.configure do | config |
21
- config.after(:each) do | example |
22
- if example.exception.is_a?(Approvals::ApprovalError)
23
- print_diff(example.exception)
24
- end
25
- end
26
- end
File without changes
File without changes
@@ -1,15 +0,0 @@
1
- {
2
- "_links": {
3
- "provider": {
4
- "href": "http://example.org/pacticipants/Pricing%20Service",
5
- "title": "Pricing Service"
6
- },
7
- "pb:pacts": [
8
- {
9
- "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
10
- "title": "Pact between Condor (v1.3.0) and Pricing Service",
11
- "name": "Condor"
12
- }
13
- ]
14
- }
15
- }
@@ -1,35 +0,0 @@
1
- {
2
- "summary": {
3
- "deployable": true,
4
- "reason": "some text",
5
- "unknown": 1
6
- },
7
- "matrix": [
8
- {
9
- "consumer": {
10
- "name": "Foo",
11
- "version": {
12
- "number": "4"
13
- }
14
- },
15
- "provider": {
16
- "name": "Bar",
17
- "version": {
18
- "number": "5"
19
- }
20
- },
21
- "verificationResult": {
22
- "verifiedAt": "2017-10-10T12:49:04+11:00",
23
- "success": true,
24
- "_links": {
25
- "self": {
26
- "href": "http://result"
27
- }
28
- }
29
- },
30
- "pact": {
31
- "createdAt": "2017-10-10T12:49:04+11:00"
32
- }
33
- }
34
- ]
35
- }
@@ -1,3 +0,0 @@
1
- CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT#
2
- ---------|-----------|----------|-----------|----------|--------
3
- Foo | 4 | Bar | 5 | true | 1
@@ -1,3 +0,0 @@
1
- CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT#
2
- ---------|-----------|----------|-----------|----------|--------
3
- ??? | ??? | ??? | ??? | ??? |
@@ -1,10 +0,0 @@
1
- CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT#
2
- ---------|-----------|----------|-----------|----------|--------
3
- Foo | 3 | Bar | 5 | ??? |
4
- Foo | 4 | Bar | 5 | true | 1
5
- Foo | 5 | Bar | 5 | false | 2
6
-
7
- VERIFICATION RESULTS
8
- --------------------
9
- 1. http://result (success)
10
- 2. http://result (failure)
@@ -1,18 +0,0 @@
1
- {
2
- "_links": {
3
- "self": { "href": "http://example.org/pacticipants/Pricing%20Service" },
4
- "versions": { "href": "http://example.org/pacticipants/Pricing%20Service/versions" }
5
- },
6
- "name" : "Pricing Service",
7
- "repositoryUrl": "git@git.realestate.com.au:business-systems/pricing-service",
8
- "_embedded" : {
9
- "latest-version" : {
10
- "_links" : {
11
- "self": {
12
- "href": "http://example.org/pacticipants/Pricing%20Service/versions/1.3.0"
13
- }
14
- },
15
- "number" : "1.3.0"
16
- }
17
- }
18
- }
@@ -1,26 +0,0 @@
1
- {
2
- "_links": {
3
- "self": { "href": "http://example.org/pacticipants" },
4
- "pacticipants": [
5
- { "href": "http://example.org/pacticipants/Condor", "title": "Condor" }
6
- ]
7
- },
8
- "pacticipants" : [{
9
- "_links": {
10
- "self" : {
11
- "href" : "http://example.org/pacticipants/Condor"
12
- }
13
- },
14
- "name" : "Condor",
15
- "_embedded" : {
16
- "latest-version" : {
17
- "_links" : {
18
- "self": {
19
- "href": "http://example.org/pacticipants/Condor/versions/1.3.0"
20
- }
21
- },
22
- "number" : "1.3.0"
23
- }
24
- }
25
- }]
26
- }
@@ -1,41 +0,0 @@
1
- {
2
- "_links": {
3
- "self": {
4
- "href": "http://example.org/pacts/latest"
5
- }
6
- },
7
- "pacts": [
8
- {
9
- "_links": {
10
- "self": [{
11
- "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/latest"
12
- },{
13
- "href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
14
- }]
15
- },
16
- "_embedded": {
17
- "consumer": {
18
- "name": "Condor",
19
- "_links": {
20
- "self": {
21
- "href": "http://example.org/pacticipants/Condor"
22
- }
23
- },
24
- "_embedded": {
25
- "version": {
26
- "number": "1.3.0"
27
- }
28
- }
29
- },
30
- "provider": {
31
- "_links": {
32
- "self": {
33
- "href": "http://example.org/pacticipants/Pricing%20Service"
34
- }
35
- },
36
- "name": "Pricing Service"
37
- }
38
- }
39
- }
40
- ]
41
- }
@@ -1,25 +0,0 @@
1
- require 'pact_broker/client/pact_hash'
2
- require 'pact_broker/client/hal/http_client'
3
-
4
- shared_context "pact broker" 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
- let(:pact_hash) { PactBroker::Client::PactHash[consumer: {name: 'Condor'}, provider: {name: 'Pricing Service'}, interactions: []] }
10
- let(:consumer_contract) { Pact::ConsumerContract.from_hash pact_hash }
11
- let(:pact_json) { pact_hash.to_json }
12
- let(:pact_broker_client) { PactBroker::Client::PactBrokerClient.new(client_config) }
13
- let(:broker_base_url) { 'http://localhost:1234' }
14
- let(:client_config) { { base_url: broker_base_url } }
15
- let(:consumer_version) { '1.3.0' }
16
- let(:version) { '1.3.0' }
17
- let(:pact_broker_version) { Pact::Term.new(:matcher => /\d+\.\d+\.\d+/, :generate => '1.0.0') }
18
- let(:pact_broker_response_headers) { {'Content-Type' => 'application/hal+json;charset=utf-8'} }
19
- let(:default_request_headers) { { 'Content-Type' => 'application/json'} }
20
- let(:old_patch_request_headers) { { 'Content-Type' => 'application/json'} }
21
- let(:patch_request_headers) { { 'Content-Type' => 'application/merge-patch+json'} }
22
- let(:put_request_headers) { { 'Content-Type' => 'application/json', 'Accept' => 'application/hal+json'} }
23
- let(:post_request_headers) { { 'Content-Type' => 'application/json', 'Accept' => 'application/hal+json'} }
24
- let(:get_request_headers) { { 'Accept' => 'application/hal+json'} }
25
- end
@@ -1,42 +0,0 @@
1
- if __FILE__ == $0
2
-
3
- SSL_KEY = "spec/fixtures/certificates/key.pem"
4
- SSL_CERT = "spec/fixtures/certificates/client_cert.pem"
5
- SSL_CA_CERT = "spec/fixtures/certificates/ca_cert.pem"
6
-
7
- trap(:INT) do
8
- @server.shutdown
9
- exit
10
- end
11
-
12
- def webrick_opts port
13
- certificate = OpenSSL::X509::Certificate.new(File.read(SSL_CERT))
14
- cert_name = certificate.subject.to_a.collect{|a| a[0..1] }
15
- logger_stream = ENV["DEBUG"] ? $stderr : StringIO.new
16
- {
17
- Port: port,
18
- Host: "0.0.0.0",
19
- AccessLog: [],
20
- Logger: WEBrick::Log.new(logger_stream,WEBrick::Log::INFO),
21
- SSLVerifyClient: OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT | OpenSSL::SSL::VERIFY_PEER,
22
- SSLCACertificateFile: SSL_CA_CERT,
23
- SSLCertificate: certificate,
24
- SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read(SSL_KEY)),
25
- SSLEnable: true,
26
- SSLCertName: cert_name,
27
- }
28
- end
29
-
30
- app = ->(_env) { puts "hello"; [200, {}, ["Hello world" + "\n"]] }
31
-
32
- require "webrick"
33
- require "webrick/https"
34
- require "rack"
35
- require "rackup/handler/webrick"
36
-
37
- opts = webrick_opts(4444)
38
-
39
- Rackup::Handler::WEBrick.run(app, **opts) do |server|
40
- @server = server
41
- end
42
- end