pact_broker 2.77.0 → 2.80.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release_gem.yml +1 -0
- data/.github/workflows/test.yml +37 -11
- data/.rubocop.yml +37 -879
- data/.ruby-version +1 -1
- data/CHANGELOG.md +102 -0
- data/DEVELOPER_DOCUMENTATION.md +13 -0
- data/DEVELOPER_SETUP.md +6 -0
- data/Dockerfile +1 -1
- data/Gemfile +30 -28
- data/Rakefile +8 -6
- data/config.ru +11 -11
- data/config/boot.rb +6 -6
- data/db/ddl_statements/latest_pact_consumer_version_orders.rb +1 -1
- data/db/ddl_statements/latest_pact_publications_by_consumer_versions.rb +2 -2
- data/db/migrations/000001_create_pacticipant_table.rb +1 -1
- data/db/migrations/000002_create_versions_table.rb +1 -1
- data/db/migrations/000003_create_pacts_table.rb +1 -1
- data/db/migrations/000004_create_tags_table.rb +1 -1
- data/db/migrations/000007_increase_json_content_length.rb +1 -1
- data/db/migrations/000012_create_webhooks_table.rb +6 -6
- data/db/migrations/000015_create_pact_version_content.rb +4 -4
- data/db/migrations/000016_add_pact_content_foreign_key_to_pacts.rb +3 -3
- data/db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb +2 -2
- data/db/migrations/000018_drop_json_content_column_from_pacts.rb +2 -2
- data/db/migrations/000019_make_pact_version_content_sha_not_nullable.rb +2 -2
- data/db/migrations/000020_add_pact_version_content_sha_to_all_pacts_view.rb +2 -2
- data/db/migrations/000021_recreate_latest_pacts_view.rb +2 -2
- data/db/migrations/000023_create_pact_versions_table.rb +3 -3
- data/db/migrations/000026_create_pact_publications.rb +3 -3
- data/db/migrations/000031_create_verifications.rb +1 -1
- data/db/migrations/000033_create_config_table.rb +3 -3
- data/db/migrations/000034_create_index_on_consumer_version_order.rb +3 -3
- data/db/migrations/000035_create_index_on_names.rb +2 -2
- data/db/migrations/000036_create_webhook_execution.rb +2 -2
- data/db/migrations/000037_create_labels_table.rb +1 -1
- data/db/migrations/000038_create_triggered_webhooks_table.rb +3 -3
- data/db/migrations/000041_migrate_execution_data.rb +3 -3
- data/db/migrations/000043_add_provider_version_to_verification.rb +1 -1
- data/db/migrations/000044_populate_verifications_provider_version_id.rb +9 -9
- data/db/migrations/20171112_add_test_results.rb +1 -1
- data/db/migrations/20171117_create_webhook_events.rb +3 -3
- data/db/migrations/20171118_create_webhook_events.rb +2 -2
- data/db/migrations/20180108_create_certificates_table.rb +3 -3
- data/db/migrations/20180109_migrate_trigger_type.rb +2 -2
- data/db/migrations/20180119_update_latest_triggered_webhooks.rb +1 -1
- data/db/migrations/20180123_create_tags_with_latest_flag.rb +1 -1
- data/db/migrations/20180130_create_materialized_matrix.rb +4 -4
- data/db/migrations/20180131_create_materialized_latest_matrix.rb +4 -4
- data/db/migrations/20180202_create_materialized_head_matrix.rb +4 -4
- data/db/migrations/20180205_drop_materialized_latest_matrix.rb +4 -4
- data/db/migrations/20180210_fix_latest_matrix_for_cv_and_pv_again.rb +2 -2
- data/db/migrations/20180311_optimise_head_matrix.rb +2 -3
- data/db/migrations/20180523_create_latest_verifications_for_consumer_version_tags.rb +1 -1
- data/db/migrations/20180524_create_latest_verifications_for_consumer_and_provider.rb +1 -1
- data/db/migrations/20180613_migrate_pacticipant_ids_for_verifications.rb +1 -1
- data/db/migrations/20180614_update_latest_verification_ids_for_consumer_and_provider.rb +1 -1
- data/db/migrations/20180616_migrate_consumer_ids_for_pact_publications.rb +1 -1
- data/db/migrations/20180720_create_latest_pact_publication_ids.rb +1 -1
- data/db/migrations/20180722_recreate_views.rb +1 -1
- data/db/migrations/20180723_create_latest_verification_ids.rb +6 -6
- data/db/migrations/20180729_create_latest_verification_ids_for_provider_versions.rb +1 -1
- data/db/migrations/20190509_create_version_sequence.rb +1 -1
- data/db/migrations/20190510_set_version_sequence.rb +1 -1
- data/db/migrations/20190524_set_webhooks_enabled.rb +1 -1
- data/db/migrations/20190603_migrate_webhook_headers.rb +1 -1
- data/db/migrations/20191025_optimise_latest_verification_ids_for_cv_tags.rb +1 -1
- data/db/migrations/20191028_optimise_latest_tagged_pact_cv_orders.rb +1 -1
- data/db/migrations/20191030_optimise_latest_pact_publications_by_consumer_versions_.rb +1 -1
- data/db/migrations/20191031_optimise_latest_verification_ids_for_consumer_version_tags.rb +1 -1
- data/db/migrations/20191101_create_head_pact_tags.rb +1 -1
- data/db/migrations/20200930_update_latest_triggered_webhooks.rb +2 -2
- data/db/migrations/20201023_create_verification_number_sequence.rb +1 -1
- data/db/migrations/20201024_create_version_order_sequence.rb +1 -1
- data/db/migrations/20201026_update_latest_verification_ids_for_consumer_and_provider.rb +2 -2
- data/db/migrations/20210115_add_webhook_foreign_key_indexes.rb +1 -1
- data/db/migrations/20210116_add_context_to_triggered_webhook.rb +1 -1
- data/db/migrations/20210202_add_created_at_to_head_pact_tags.rb +2 -2
- data/db/migrations/20210205_add_pacticipant_id_to_tag.rb +1 -1
- data/db/migrations/20210206_add_index_to_tags_and_versions.rb +1 -1
- data/db/migrations/20210207_optimise_latest_verification_ids_for_consumer_version_tags.rb +1 -1
- data/db/migrations/20210208_optimise_latest_tagged_pact_cv_orders.rb +1 -1
- data/db/migrations/20210210_create_environments_table.rb +16 -0
- data/db/migrations/20210216_create_deployed_versions_table.rb +18 -0
- data/db/migrations/20210226_set_deployment_columns_not_null.rb +31 -0
- data/db/migrations/20210301_add_pacticipant_columns.rb +10 -0
- data/db/migrations/20210413_create_currently_deployed_version_ids_table.rb +13 -0
- data/db/migrations/20210415_add_target_column_to_deployed_version.rb +21 -0
- data/db/migrations/20210419_create_released_versions_table.rb +17 -0
- data/db/migrations/20210529_add_main_branch_to_pacticipant.rb +18 -0
- data/db/migrations/20210608_add_uuid_to_webhook.rb +14 -0
- data/db/migrations/20210609_set_webhook_uuid.rb +11 -0
- data/db/migrations/20210702_drop_unused_columns_from_deployed_versions.rb +15 -0
- data/db/migrations/migration_helper.rb +3 -3
- data/db/test/backwards_compatibility/Gemfile +11 -11
- data/db/test/backwards_compatibility/Rakefile +17 -17
- data/db/test/backwards_compatibility/config.ru +6 -6
- data/db/test/backwards_compatibility/spec/publish_pact_spec.rb +13 -13
- data/db/test/backwards_compatibility/spec/spec_helper.rb +3 -3
- data/db/test/backwards_compatibility/spec/support/fixture_helpers.rb +2 -2
- data/db/test/backwards_compatibility/spec/support/request_helpers.rb +3 -4
- data/db/test/change_migration_strategy/Rakefile +6 -6
- data/db/test/change_migration_strategy/before/Gemfile +1 -1
- data/docker-compose-dev-postgres.yml +9 -1
- data/example/Gemfile +4 -4
- data/example/basic_auth/Gemfile +1 -1
- data/example/basic_auth/config.ru +7 -7
- data/example/config.ru +7 -7
- data/issue-reproduction/Dockerfile-pact-broker +1 -1
- data/lib/db.rb +18 -12
- data/lib/pact/doc/generator.rb +3 -3
- data/lib/pact/doc/interaction_view_model.rb +13 -13
- data/lib/pact/doc/markdown/consumer_contract_renderer.rb +4 -4
- data/lib/pact/doc/markdown/generator.rb +6 -6
- data/lib/pact/doc/markdown/interaction_renderer.rb +4 -4
- data/lib/pact/doc/sort_interactions.rb +0 -1
- data/lib/pact_broker.rb +4 -4
- data/lib/pact_broker/api.rb +102 -78
- data/lib/pact_broker/api/contracts/base_contract.rb +2 -2
- data/lib/pact_broker/api/contracts/dry_validation_predicates.rb +18 -1
- data/lib/pact_broker/api/contracts/dry_validation_workarounds.rb +3 -2
- data/lib/pact_broker/api/contracts/environment_schema.rb +49 -0
- data/lib/pact_broker/api/contracts/pacticipant_name_contract.rb +1 -1
- data/lib/pact_broker/api/contracts/pacticipant_name_validation.rb +2 -2
- data/lib/pact_broker/api/contracts/pacticipant_schema.rb +34 -0
- data/lib/pact_broker/api/contracts/publish_contracts_schema.rb +104 -0
- data/lib/pact_broker/api/contracts/put_pact_params_contract.rb +1 -1
- data/lib/pact_broker/api/contracts/request_validations.rb +2 -2
- data/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema.rb +70 -15
- data/lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb +3 -3
- data/lib/pact_broker/api/contracts/verification_contract.rb +2 -2
- data/lib/pact_broker/api/contracts/webhook_contract.rb +10 -7
- data/lib/pact_broker/api/decorators/base_decorator.rb +20 -5
- data/lib/pact_broker/api/decorators/basic_pacticipant_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/configuration.rb +2 -2
- data/lib/pact_broker/api/decorators/dashboard_decorator.rb +8 -8
- data/lib/pact_broker/api/decorators/dashboard_text_decorator.rb +3 -3
- data/lib/pact_broker/api/decorators/decorator_context.rb +1 -1
- data/lib/pact_broker/api/decorators/decorator_context_creator.rb +1 -1
- data/lib/pact_broker/api/decorators/deployed_version_decorator.rb +26 -0
- data/lib/pact_broker/api/decorators/deployed_versions_decorator.rb +20 -0
- data/lib/pact_broker/api/decorators/embedded_label_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/embedded_pacticipant_decorator.rb +17 -0
- data/lib/pact_broker/api/decorators/embedded_tag_decorator.rb +4 -4
- data/lib/pact_broker/api/decorators/embedded_version_decorator.rb +7 -2
- data/lib/pact_broker/api/decorators/environment_decorator.rb +51 -0
- data/lib/pact_broker/api/decorators/environments_decorator.rb +31 -0
- data/lib/pact_broker/api/decorators/extended_pact_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/extended_verification_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/integration_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/integrations_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/label_decorator.rb +5 -5
- data/lib/pact_broker/api/decorators/latest_pact_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/matrix_decorator.rb +26 -11
- data/lib/pact_broker/api/decorators/matrix_text_decorator.rb +5 -5
- data/lib/pact_broker/api/decorators/pact_collection_decorator.rb +6 -6
- data/lib/pact_broker/api/decorators/pact_decorator.rb +5 -5
- data/lib/pact_broker/api/decorators/pact_details_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/pact_pacticipant_decorator.rb +3 -3
- data/lib/pact_broker/api/decorators/pact_version_decorator.rb +3 -3
- data/lib/pact_broker/api/decorators/pact_versions_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/pact_webhooks_status_decorator.rb +6 -6
- data/lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb +8 -8
- data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +29 -13
- data/lib/pact_broker/api/decorators/pagination_links.rb +2 -2
- data/lib/pact_broker/api/decorators/provider_pacts_decorator.rb +2 -3
- data/lib/pact_broker/api/decorators/publish_contract_decorator.rb +19 -0
- data/lib/pact_broker/api/decorators/publish_contracts_decorator.rb +21 -0
- data/lib/pact_broker/api/decorators/publish_contracts_results_decorator.rb +55 -0
- data/lib/pact_broker/api/decorators/reason_decorator.rb +30 -14
- data/lib/pact_broker/api/decorators/relationships_csv_decorator.rb +3 -1
- data/lib/pact_broker/api/decorators/released_version_decorator.rb +25 -0
- data/lib/pact_broker/api/decorators/released_versions_decorator.rb +20 -0
- data/lib/pact_broker/api/decorators/representable_pact.rb +1 -1
- data/lib/pact_broker/api/decorators/tag_decorator.rb +6 -6
- data/lib/pact_broker/api/decorators/tagged_pact_versions_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/timestamps.rb +2 -2
- data/lib/pact_broker/api/decorators/triggered_webhook_decorator.rb +8 -6
- data/lib/pact_broker/api/decorators/triggered_webhooks_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/verifiable_pact_decorator.rb +4 -4
- data/lib/pact_broker/api/decorators/verifiable_pacts_decorator.rb +3 -3
- data/lib/pact_broker/api/decorators/verifiable_pacts_query_decorator.rb +16 -9
- data/lib/pact_broker/api/decorators/verification_decorator.rb +6 -6
- data/lib/pact_broker/api/decorators/verification_summary_decorator.rb +4 -4
- data/lib/pact_broker/api/decorators/version_decorator.rb +38 -7
- data/lib/pact_broker/api/decorators/versions_decorator.rb +5 -5
- data/lib/pact_broker/api/decorators/webhook_decorator.rb +10 -8
- data/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +7 -7
- data/lib/pact_broker/api/decorators/webhook_request_template_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/webhooks_decorator.rb +3 -3
- data/lib/pact_broker/api/pact_broker_urls.rb +125 -69
- data/lib/pact_broker/api/paths.rb +2 -2
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +16 -17
- data/lib/pact_broker/api/resources.rb +1 -1
- data/lib/pact_broker/api/resources/all_webhooks.rb +14 -6
- data/lib/pact_broker/api/resources/authentication.rb +1 -1
- data/lib/pact_broker/api/resources/authorization.rb +37 -0
- data/lib/pact_broker/api/resources/badge.rb +8 -8
- data/lib/pact_broker/api/resources/base_resource.rb +1 -1
- data/lib/pact_broker/api/resources/can_i_deploy.rb +13 -13
- data/lib/pact_broker/api/resources/can_i_deploy_badge.rb +7 -7
- data/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version.rb +23 -18
- data/lib/pact_broker/api/resources/clean.rb +3 -3
- data/lib/pact_broker/api/resources/currently_deployed_versions_for_environment.rb +75 -0
- data/lib/pact_broker/api/resources/currently_supported_versions_for_environment.rb +70 -0
- data/lib/pact_broker/api/resources/dashboard.rb +3 -3
- data/lib/pact_broker/api/resources/default_base_resource.rb +47 -20
- data/lib/pact_broker/api/resources/deployed_version.rb +94 -0
- data/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb +89 -0
- data/lib/pact_broker/api/resources/environment.rb +76 -0
- data/lib/pact_broker/api/resources/environments.rb +79 -0
- data/lib/pact_broker/api/resources/error_handler.rb +4 -4
- data/lib/pact_broker/api/resources/error_response_body_generator.rb +3 -3
- data/lib/pact_broker/api/resources/error_test.rb +2 -2
- data/lib/pact_broker/api/resources/group.rb +2 -2
- data/lib/pact_broker/api/resources/index.rb +91 -70
- data/lib/pact_broker/api/resources/integration.rb +1 -1
- data/lib/pact_broker/api/resources/integrations.rb +3 -3
- data/lib/pact_broker/api/resources/label.rb +2 -2
- data/lib/pact_broker/api/resources/latest_pact.rb +5 -5
- data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
- data/lib/pact_broker/api/resources/latest_provider_pacts.rb +3 -3
- data/lib/pact_broker/api/resources/latest_verification_for_latest_pact.rb +5 -1
- data/lib/pact_broker/api/resources/latest_verification_for_pact.rb +5 -1
- data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +5 -5
- data/lib/pact_broker/api/resources/latest_version.rb +1 -1
- data/lib/pact_broker/api/resources/matrix.rb +18 -13
- data/lib/pact_broker/api/resources/matrix_badge.rb +1 -1
- data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +2 -2
- data/lib/pact_broker/api/resources/metadata_resource_methods.rb +2 -2
- data/lib/pact_broker/api/resources/metrics.rb +1 -1
- data/lib/pact_broker/api/resources/pact.rb +17 -27
- data/lib/pact_broker/api/resources/pact_content_diff.rb +3 -3
- data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +7 -3
- data/lib/pact_broker/api/resources/pact_version.rb +2 -2
- data/lib/pact_broker/api/resources/pact_versions.rb +3 -3
- data/lib/pact_broker/api/resources/pact_webhooks.rb +7 -8
- data/lib/pact_broker/api/resources/pact_webhooks_status.rb +2 -2
- data/lib/pact_broker/api/resources/pacticipant.rb +51 -15
- data/lib/pact_broker/api/resources/pacticipant_resource_methods.rb +1 -1
- data/lib/pact_broker/api/resources/{webhooks.rb → pacticipant_webhooks.rb} +12 -8
- data/lib/pact_broker/api/resources/pacticipants.rb +13 -8
- data/lib/pact_broker/api/resources/pacticipants_for_label.rb +2 -2
- data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +4 -4
- data/lib/pact_broker/api/resources/provider_pacts.rb +3 -3
- data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +10 -6
- data/lib/pact_broker/api/resources/publish_contracts.rb +81 -0
- data/lib/pact_broker/api/resources/relationships.rb +2 -2
- data/lib/pact_broker/api/resources/released_version.rb +84 -0
- data/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb +94 -0
- data/lib/pact_broker/api/resources/tag.rb +1 -1
- data/lib/pact_broker/api/resources/tagged_pact_versions.rb +4 -4
- data/lib/pact_broker/api/resources/triggered_webhook_logs.rb +16 -8
- data/lib/pact_broker/api/resources/verification.rb +17 -7
- data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +7 -3
- data/lib/pact_broker/api/resources/verifications.rb +13 -18
- data/lib/pact_broker/api/resources/version.rb +49 -11
- data/lib/pact_broker/api/resources/versions.rb +6 -6
- data/lib/pact_broker/api/resources/webhook.rb +17 -9
- data/lib/pact_broker/api/resources/webhook_execution.rb +18 -14
- data/lib/pact_broker/api/resources/webhook_execution_methods.rb +31 -0
- data/lib/pact_broker/app.rb +37 -35
- data/lib/pact_broker/application_context.rb +5 -5
- data/lib/pact_broker/badges/service.rb +22 -22
- data/lib/pact_broker/build_http_options.rb +2 -2
- data/lib/pact_broker/certificates/service.rb +4 -4
- data/lib/pact_broker/config/load.rb +4 -4
- data/lib/pact_broker/config/repository.rb +1 -1
- data/lib/pact_broker/config/save.rb +4 -4
- data/lib/pact_broker/config/setting.rb +28 -24
- data/lib/pact_broker/config/space_delimited_integer_list.rb +3 -3
- data/lib/pact_broker/config/space_delimited_string_list.rb +3 -3
- data/lib/pact_broker/configuration.rb +27 -20
- data/lib/pact_broker/constants.rb +2 -2
- data/lib/pact_broker/contracts/contract_to_publish.rb +19 -0
- data/lib/pact_broker/contracts/contracts_publication_results.rb +14 -0
- data/lib/pact_broker/contracts/contracts_to_publish.rb +11 -0
- data/lib/pact_broker/contracts/notice.rb +21 -0
- data/lib/pact_broker/contracts/service.rb +264 -0
- data/lib/pact_broker/date_helper.rb +48 -46
- data/lib/pact_broker/db.rb +11 -7
- data/lib/pact_broker/db/clean.rb +4 -8
- data/lib/pact_broker/db/clean_incremental.rb +8 -6
- data/lib/pact_broker/db/data_migrations/delete_deprecated_webhook_executions.rb +1 -1
- data/lib/pact_broker/db/data_migrations/migrate_webhook_headers.rb +1 -1
- data/lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications.rb +1 -1
- data/lib/pact_broker/db/data_migrations/set_created_at_for_latest_pact_publications.rb +1 -1
- data/lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb +1 -1
- data/lib/pact_broker/db/data_migrations/set_extra_columns_for_tags.rb +3 -3
- data/lib/pact_broker/db/data_migrations/set_latest_version_sequence_value.rb +1 -1
- data/lib/pact_broker/db/data_migrations/set_pacticipant_display_name.rb +23 -0
- data/lib/pact_broker/db/data_migrations/set_pacticipant_ids_for_verifications.rb +1 -1
- data/lib/pact_broker/db/data_migrations/set_pacticipant_main_branch.rb +53 -0
- data/lib/pact_broker/db/data_migrations/set_webhook_uuid.rb +24 -0
- data/lib/pact_broker/db/data_migrations/set_webhooks_enabled.rb +1 -1
- data/lib/pact_broker/db/delete_overwritten_data.rb +7 -7
- data/lib/pact_broker/db/log_quietener.rb +1 -1
- data/lib/pact_broker/db/migrate.rb +4 -4
- data/lib/pact_broker/db/migrate_data.rb +4 -1
- data/lib/pact_broker/db/models.rb +17 -12
- data/lib/pact_broker/db/seed_example_data.rb +9 -4
- data/lib/pact_broker/db/validate_encoding.rb +4 -4
- data/lib/pact_broker/db/version.rb +1 -1
- data/lib/pact_broker/deployments/currently_deployed_version_id.rb +30 -0
- data/lib/pact_broker/deployments/deployed_version.rb +115 -0
- data/lib/pact_broker/deployments/deployed_version_service.rb +85 -0
- data/lib/pact_broker/deployments/environment.rb +49 -0
- data/lib/pact_broker/deployments/environment_service.rb +52 -0
- data/lib/pact_broker/deployments/released_version.rb +83 -0
- data/lib/pact_broker/deployments/released_version_service.rb +47 -0
- data/lib/pact_broker/diagnostic/app.rb +8 -8
- data/lib/pact_broker/diagnostic/resources/base_resource.rb +2 -2
- data/lib/pact_broker/diagnostic/resources/dependencies.rb +3 -3
- data/lib/pact_broker/diagnostic/resources/heartbeat.rb +1 -1
- data/lib/pact_broker/doc/controllers/app.rb +10 -10
- data/lib/pact_broker/doc/views/can-i-deploy.markdown +4 -2
- data/lib/pact_broker/doc/views/index/environment.markdown +37 -0
- data/lib/pact_broker/doc/views/index/environments.markdown +53 -0
- data/lib/pact_broker/doc/views/index/latest-pact-versions.markdown +1 -1
- data/lib/pact_broker/doc/views/index/pacticipant-version-tag.markdown +1 -0
- data/lib/pact_broker/doc/views/index/pacticipants.markdown +25 -3
- data/lib/pact_broker/doc/views/index/publish-contracts.markdown +120 -0
- data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +22 -11
- data/lib/pact_broker/doc/views/webhooks.markdown +5 -3
- data/lib/pact_broker/domain.rb +6 -6
- data/lib/pact_broker/domain/index_item.rb +27 -8
- data/lib/pact_broker/domain/label.rb +1 -2
- data/lib/pact_broker/domain/order_versions.rb +2 -2
- data/lib/pact_broker/domain/pact.rb +14 -7
- data/lib/pact_broker/domain/pacticipant.rb +27 -18
- data/lib/pact_broker/domain/tag.rb +5 -3
- data/lib/pact_broker/domain/verification.rb +8 -8
- data/lib/pact_broker/domain/version.rb +55 -10
- data/lib/pact_broker/domain/webhook.rb +14 -15
- data/lib/pact_broker/domain/webhook_request.rb +14 -18
- data/lib/pact_broker/errors.rb +7 -7
- data/lib/pact_broker/errors/error_logger.rb +3 -3
- data/lib/pact_broker/events/event.rb +5 -0
- data/lib/pact_broker/events/publisher.rb +9 -0
- data/lib/pact_broker/events/subscriber.rb +42 -0
- data/lib/pact_broker/feature_toggle.rb +2 -2
- data/lib/pact_broker/groups/service.rb +2 -2
- data/lib/pact_broker/hash_refinements.rb +12 -12
- data/lib/pact_broker/index/service.rb +69 -36
- data/lib/pact_broker/integrations/integration.rb +5 -5
- data/lib/pact_broker/integrations/service.rb +11 -7
- data/lib/pact_broker/labels/repository.rb +2 -2
- data/lib/pact_broker/labels/service.rb +1 -1
- data/lib/pact_broker/locale/en.yml +54 -14
- data/lib/pact_broker/logging.rb +3 -3
- data/lib/pact_broker/logging/default_formatter.rb +3 -3
- data/lib/pact_broker/matrix/aggregated_row.rb +4 -4
- data/lib/pact_broker/matrix/can_i_deploy_query_schema.rb +17 -2
- data/lib/pact_broker/matrix/deployment_status_summary.rb +78 -38
- data/lib/pact_broker/matrix/every_row.rb +2 -2
- data/lib/pact_broker/matrix/head_row.rb +2 -2
- data/lib/pact_broker/matrix/integration.rb +6 -6
- data/lib/pact_broker/matrix/parse_can_i_deploy_query.rb +19 -3
- data/lib/pact_broker/matrix/parse_query.rb +47 -24
- data/lib/pact_broker/matrix/query_builder.rb +10 -10
- data/lib/pact_broker/matrix/query_results.rb +9 -4
- data/lib/pact_broker/matrix/query_results_with_deployment_status_summary.rb +3 -3
- data/lib/pact_broker/matrix/quick_row.rb +32 -34
- data/lib/pact_broker/matrix/reason.rb +88 -1
- data/lib/pact_broker/matrix/repository.rb +137 -66
- data/lib/pact_broker/matrix/resolved_selector.rb +82 -7
- data/lib/pact_broker/matrix/row.rb +6 -6
- data/lib/pact_broker/matrix/service.rb +44 -14
- data/lib/pact_broker/matrix/unresolved_selector.rb +22 -2
- data/lib/pact_broker/messages.rb +17 -5
- data/lib/pact_broker/metrics/service.rb +16 -15
- data/lib/pact_broker/pacticipants/find_potential_duplicate_pacticipant_names.rb +5 -5
- data/lib/pact_broker/pacticipants/generate_display_name.rb +27 -0
- data/lib/pact_broker/pacticipants/repository.rb +34 -16
- data/lib/pact_broker/pacticipants/service.rb +19 -19
- data/lib/pact_broker/pacts/all_pact_publications.rb +6 -6
- data/lib/pact_broker/pacts/build_verifiable_pact_notices.rb +8 -8
- data/lib/pact_broker/pacts/content.rb +23 -21
- data/lib/pact_broker/pacts/create_formatted_diff.rb +3 -3
- data/lib/pact_broker/pacts/diff.rb +8 -8
- data/lib/pact_broker/pacts/eager_loaders.rb +1 -1
- data/lib/pact_broker/pacts/generate_interaction_sha.rb +2 -2
- data/lib/pact_broker/pacts/generate_sha.rb +10 -10
- data/lib/pact_broker/pacts/head_pact.rb +1 -1
- data/lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb +2 -2
- data/lib/pact_broker/pacts/latest_pact_publications.rb +2 -2
- data/lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb +1 -1
- data/lib/pact_broker/pacts/latest_tagged_pact_publications.rb +2 -2
- data/lib/pact_broker/pacts/lazy_loaders.rb +2 -2
- data/lib/pact_broker/pacts/merger.rb +2 -2
- data/lib/pact_broker/pacts/order_hash_keys.rb +1 -1
- data/lib/pact_broker/pacts/pact_params.rb +7 -7
- data/lib/pact_broker/pacts/pact_publication.rb +19 -13
- data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +7 -49
- data/lib/pact_broker/pacts/pact_publication_selector_dataset_module.rb +70 -0
- data/lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb +106 -0
- data/lib/pact_broker/pacts/pact_version.rb +46 -14
- data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +51 -47
- data/lib/pact_broker/pacts/parse.rb +1 -1
- data/lib/pact_broker/pacts/placeholder_pact.rb +1 -1
- data/lib/pact_broker/pacts/repository.rb +27 -23
- data/lib/pact_broker/pacts/selected_pact.rb +5 -1
- data/lib/pact_broker/pacts/selector.rb +124 -6
- data/lib/pact_broker/pacts/selectors.rb +5 -1
- data/lib/pact_broker/pacts/service.rb +102 -32
- data/lib/pact_broker/pacts/sort_content.rb +14 -9
- data/lib/pact_broker/pacts/squash_pacts_for_verification.rb +0 -1
- data/lib/pact_broker/pacts/verifiable_pact.rb +5 -3
- data/lib/pact_broker/pacts/verifiable_pact_messages.rb +82 -37
- data/lib/pact_broker/policies.rb +1 -1
- data/lib/pact_broker/project_root.rb +2 -2
- data/lib/pact_broker/relationships/groupify.rb +1 -1
- data/lib/pact_broker/repositories.rb +9 -9
- data/lib/pact_broker/services.rb +53 -15
- data/lib/pact_broker/string_refinements.rb +10 -4
- data/lib/pact_broker/tags/eager_loaders.rb +2 -2
- data/lib/pact_broker/tags/head_pact_tags.rb +2 -2
- data/lib/pact_broker/tags/repository.rb +2 -2
- data/lib/pact_broker/tags/service.rb +1 -1
- data/lib/pact_broker/tags/tag_with_latest_flag.rb +2 -2
- data/lib/pact_broker/tasks.rb +5 -5
- data/lib/pact_broker/tasks/clean_task.rb +12 -12
- data/lib/pact_broker/tasks/data_migration_task.rb +4 -4
- data/lib/pact_broker/tasks/delete_overwritten_data_task.rb +8 -8
- data/lib/pact_broker/tasks/migration_task.rb +5 -5
- data/lib/pact_broker/tasks/version_task.rb +3 -3
- data/lib/pact_broker/test/http_test_data_builder.rb +72 -31
- data/lib/pact_broker/test/test_data_builder.rb +119 -52
- data/lib/pact_broker/ui.rb +3 -3
- data/lib/pact_broker/ui/app.rb +9 -9
- data/lib/pact_broker/ui/controllers/base_controller.rb +6 -6
- data/lib/pact_broker/ui/controllers/can_i_deploy.rb +9 -9
- data/lib/pact_broker/ui/controllers/clusters.rb +5 -5
- data/lib/pact_broker/ui/controllers/error_test.rb +3 -3
- data/lib/pact_broker/ui/controllers/groups.rb +4 -4
- data/lib/pact_broker/ui/controllers/index.rb +28 -15
- data/lib/pact_broker/ui/controllers/matrix.rb +11 -11
- data/lib/pact_broker/ui/controllers/pacts.rb +1 -1
- data/lib/pact_broker/ui/helpers/matrix_helper.rb +12 -8
- data/lib/pact_broker/ui/helpers/url_helper.rb +3 -3
- data/lib/pact_broker/ui/view_models/index_item.rb +29 -15
- data/lib/pact_broker/ui/view_models/index_items.rb +2 -2
- data/lib/pact_broker/ui/view_models/matrix_deployed_version.rb +37 -0
- data/lib/pact_broker/ui/view_models/matrix_line.rb +45 -11
- data/lib/pact_broker/ui/view_models/matrix_lines.rb +1 -1
- data/lib/pact_broker/ui/view_models/matrix_released_version.rb +37 -0
- data/lib/pact_broker/ui/view_models/matrix_tag.rb +3 -3
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +60 -14
- data/lib/pact_broker/ui/views/index/show.haml +23 -2
- data/lib/pact_broker/ui/views/matrix/show.haml +33 -9
- data/lib/pact_broker/verifications/latest_verification_for_consumer_and_provider.rb +1 -1
- data/lib/pact_broker/verifications/latest_verification_for_consumer_version_tag.rb +1 -1
- data/lib/pact_broker/verifications/latest_verification_for_pact_version.rb +1 -1
- data/lib/pact_broker/verifications/latest_verification_id_for_pact_version_and_provider_version.rb +1 -1
- data/lib/pact_broker/verifications/repository.rb +9 -5
- data/lib/pact_broker/verifications/sequence.rb +2 -2
- data/lib/pact_broker/verifications/service.rb +33 -17
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/eager_loaders.rb +6 -6
- data/lib/pact_broker/versions/latest_version.rb +1 -1
- data/lib/pact_broker/versions/parse_semantic_version.rb +2 -2
- data/lib/pact_broker/versions/repository.rb +47 -15
- data/lib/pact_broker/versions/sequence.rb +1 -1
- data/lib/pact_broker/versions/service.rb +25 -2
- data/lib/pact_broker/webhooks/check_host_whitelist.rb +1 -1
- data/lib/pact_broker/webhooks/event_listener.rb +86 -0
- data/lib/pact_broker/webhooks/execution.rb +3 -3
- data/lib/pact_broker/webhooks/execution_configuration.rb +1 -1
- data/lib/pact_broker/webhooks/execution_configuration_creator.rb +2 -2
- data/lib/pact_broker/webhooks/http_request_with_redacted_headers.rb +1 -1
- data/lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb +1 -1
- data/lib/pact_broker/webhooks/job.rb +5 -5
- data/lib/pact_broker/webhooks/latest_triggered_webhook.rb +17 -2
- data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +57 -15
- data/lib/pact_broker/webhooks/redact_logs.rb +3 -3
- data/lib/pact_broker/webhooks/render.rb +4 -5
- data/lib/pact_broker/webhooks/repository.rb +69 -75
- data/lib/pact_broker/webhooks/service.rb +52 -134
- data/lib/pact_broker/webhooks/status.rb +3 -1
- data/lib/pact_broker/webhooks/trigger_service.rb +75 -70
- data/lib/pact_broker/webhooks/triggered_webhook.rb +15 -12
- data/lib/pact_broker/webhooks/webhook.rb +43 -6
- data/lib/pact_broker/webhooks/webhook_event.rb +7 -7
- data/lib/pact_broker/webhooks/webhook_execution_result.rb +8 -3
- data/lib/pact_broker/webhooks/webhook_request_logger.rb +9 -7
- data/lib/pact_broker/webhooks/webhook_request_template.rb +41 -6
- data/lib/rack/hal_browser.rb +1 -1
- data/lib/rack/hal_browser/redirect.rb +9 -9
- data/lib/rack/pact_broker/add_pact_broker_version_header.rb +2 -2
- data/lib/rack/pact_broker/convert_404_to_hal.rb +2 -2
- data/lib/rack/pact_broker/convert_file_extension_to_accept_header.rb +1 -1
- data/lib/rack/pact_broker/database_transaction.rb +3 -3
- data/lib/rack/pact_broker/invalid_uri_protection.rb +5 -5
- data/lib/rack/pact_broker/no_auth.rb +1 -1
- data/lib/rack/pact_broker/request_target.rb +8 -8
- data/lib/rack/pact_broker/reset_thread_data.rb +1 -1
- data/lib/rack/pact_broker/set_base_url.rb +35 -5
- data/lib/rack/pact_broker/ui_authentication.rb +3 -3
- data/lib/rack/pact_broker/ui_request_filter.rb +1 -1
- data/lib/sequel/extensions/statement_timeout.rb +9 -9
- data/pact_broker.gemspec +26 -25
- data/public/javascripts/clipboard.js +8 -2
- data/public/javascripts/matrix.js +11 -6
- data/public/stylesheets/index.css +14 -1
- data/regression/can_i_deploy_spec.rb +1 -1
- data/regression/index_spec.rb +3 -3
- data/regression/regression_helper.rb +9 -9
- data/scaffolding/README.md +23 -0
- data/scaffolding/run.rb +242 -0
- data/scaffolding/templates/decorator.rb.erb +13 -0
- data/scaffolding/templates/decorator_spec.erb.rb +0 -0
- data/scaffolding/templates/migration.erb +12 -0
- data/scaffolding/templates/model.erb +14 -0
- data/scaffolding/templates/repository.rb.erb +18 -0
- data/scaffolding/templates/repository_spec.rb.erb +9 -0
- data/scaffolding/templates/resource.erb +46 -0
- data/scaffolding/templates/resource_spec.rb.erb +78 -0
- data/scaffolding/templates/service.rb.erb +22 -0
- data/scaffolding/templates/service_spec.rb.erb +9 -0
- data/script/data/environments.rb +45 -0
- data/script/demonstrate-version-branches.rb +2 -2
- data/script/docker-container/test.sh +1 -1
- data/script/generate-certificates-for-webooks-certificate-spec.rb +1 -1
- data/script/insert-self-signed-certificate-from-url.rb +5 -5
- data/script/pry.rb +18 -12
- data/script/query.rb +5 -5
- data/script/reproduce-issue-can-i-deploy-ignore.rb +48 -0
- data/script/reproduce-issue-expand-currently-deployed.rb +47 -0
- data/script/reproduce-issue-starting-up.rb +12 -7
- data/script/reproduce-issue.rb +7 -2
- data/script/run-with-ssl.rb +8 -8
- data/script/seed-example-matrix.rb +11 -11
- data/script/seed-for-webhook-test.rb +22 -22
- data/script/seed-matrix.rb +20 -20
- data/script/seed.rb +25 -25
- data/script/test/approval-all.sh +6 -0
- data/script/webhook-server.ru +3 -3
- data/spec/features/base_equality_only_on_content_that_affects_verification_results_spec.rb +3 -3
- data/spec/features/can_i_deploy_spec.rb +1 -1
- data/spec/features/create_environment_spec.rb +47 -0
- data/spec/features/create_pacticipant_spec.rb +13 -7
- data/spec/features/create_tag_spec.rb +32 -0
- data/spec/features/create_version_spec.rb +40 -26
- data/spec/features/create_webhook_spec.rb +10 -10
- data/spec/features/delete_environment_spec.rb +16 -0
- data/spec/features/delete_label_spec.rb +1 -1
- data/spec/features/delete_pact_spec.rb +1 -1
- data/spec/features/delete_verification_spec.rb +3 -3
- data/spec/features/delete_version_spec.rb +1 -1
- data/spec/features/delete_webhook_spec.rb +5 -1
- data/spec/features/edit_webhook_spec.rb +8 -8
- data/spec/features/end_deployment_spec.rb +29 -0
- data/spec/features/end_support_spec.rb +67 -0
- data/spec/features/execute_unsaved_webhook_spec.rb +7 -10
- data/spec/features/execute_webhook_spec.rb +5 -5
- data/spec/features/get_can_i_deploy_badge_spec.rb +2 -2
- data/spec/features/get_currently_deployed_versions_for_environment_spec.rb +59 -0
- data/spec/features/get_currently_deployed_versions_for_version_spec.rb +27 -0
- data/spec/features/get_currently_supported_versions_for_environment_spec.rb +57 -0
- data/spec/features/get_dashboard_spec.rb +1 -1
- data/spec/features/get_deployed_versions_for_version_and_environment.rb +27 -0
- data/spec/features/get_diff_spec.rb +5 -5
- data/spec/features/get_environment_spec.rb +19 -0
- data/spec/features/get_environments_spec.rb +30 -0
- data/spec/features/get_integrations_dot_file_spec.rb +2 -2
- data/spec/features/get_integrations_spec.rb +1 -1
- data/spec/features/get_label_spec.rb +1 -1
- data/spec/features/get_latest_pact_badge_spec.rb +7 -7
- data/spec/features/get_latest_tagged_pact_badge_spec.rb +8 -8
- data/spec/features/get_latest_untagged_pact_badge_spec.rb +8 -8
- data/spec/features/get_latest_untagged_pact_spec.rb +1 -1
- data/spec/features/get_latest_verification_for_pact_spec.rb +2 -2
- data/spec/features/get_matrix_badge_spec.rb +10 -10
- data/spec/features/get_matrix_for_consumer_and_provider_spec.rb +3 -6
- data/spec/features/get_matrix_spec.rb +5 -5
- data/spec/features/get_pact_version.rb +2 -2
- data/spec/features/get_pact_versions_spec.rb +1 -1
- data/spec/features/get_previous_distinct_version.rb +5 -5
- data/spec/features/get_provider_pacts_for_verification_spec.rb +16 -5
- data/spec/features/get_released_versions_for_version_and_environment.rb +27 -0
- data/spec/features/get_tagged_pact_versions_spec.rb +1 -1
- data/spec/features/get_triggered_webhooks_for_pact_spec.rb +1 -1
- data/spec/features/get_triggered_webhooks_for_verification_spec.rb +1 -1
- data/spec/features/get_verifications_for_consumer_version_spec.rb +1 -1
- data/spec/features/get_version_spec.rb +2 -2
- data/spec/features/get_versions_spec.rb +2 -2
- data/spec/features/label_pacticipant_spec.rb +3 -3
- data/spec/features/merge_pact_spec.rb +8 -8
- data/spec/features/pending_pacts_with_tags_spec.rb +138 -0
- data/spec/features/publish_not_a_pact_spec.rb +5 -5
- data/spec/features/publish_pact_all_in_one_approval_spec.rb +72 -0
- data/spec/features/publish_pact_all_in_one_spec.rb +43 -0
- data/spec/features/publish_pact_spec.rb +41 -6
- data/spec/features/publish_verification_spec.rb +11 -11
- data/spec/features/record_deployment_spec.rb +93 -0
- data/spec/features/record_release_spec.rb +84 -0
- data/spec/features/record_undeployment_spec.rb +67 -0
- data/spec/features/tag_version_spec.rb +2 -2
- data/spec/features/update_environment_spec.rb +44 -0
- data/spec/features/update_matrix_spec.rb +5 -5
- data/spec/features/update_pacticipant_spec.rb +87 -12
- data/spec/features/update_version_spec.rb +155 -0
- data/spec/features/update_webhook_spec.rb +6 -6
- data/spec/features/wip_pacts_spec.rb +64 -43
- data/spec/fixtures/approvals/get_provider_pacts_for_verification.approved.json +57 -0
- data/spec/fixtures/approvals/modifiable_resources.approved.json +24 -3
- data/spec/fixtures/approvals/publish_contract_no_branch.approved.json +166 -0
- data/spec/fixtures/approvals/publish_contract_nothing_exists.approved.json +158 -0
- data/spec/fixtures/approvals/publish_contract_nothing_exists_with_webhook.approved.json +158 -0
- data/spec/fixtures/approvals/publish_contract_verification_already_exists.approved.json +149 -0
- data/spec/fixtures/approvals/publish_contract_with_validation_error.approved.json +42 -0
- data/spec/fixtures/approvals/publish_contracts_results_decorator.approved.json +61 -0
- data/spec/integration/app_spec.rb +41 -41
- data/spec/integration/ui/index_spec.rb +4 -4
- data/spec/integration/ui/matrix_spec.rb +3 -3
- data/spec/integration/webhooks/certificate_spec.rb +7 -7
- data/spec/lib/pact/doc/generator_spec.rb +7 -7
- data/spec/lib/pact/doc/interaction_view_model_spec.rb +16 -16
- data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +9 -9
- data/spec/lib/pact/doc/markdown/index_renderer_spec.rb +3 -3
- data/spec/lib/pact_broker/api/contracts/environment_schema_spec.rb +91 -0
- data/spec/lib/pact_broker/api/contracts/pacticipant_schema_spec.rb +46 -0
- data/spec/lib/pact_broker/api/contracts/publish_contracts_schema_spec.rb +114 -0
- data/spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb +6 -6
- data/spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_combinations_spec.rb +76 -0
- data/spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb +158 -4
- data/spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb +1 -1
- data/spec/lib/pact_broker/api/contracts/verification_contract_spec.rb +4 -4
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +26 -26
- data/spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb +30 -30
- data/spec/lib/pact_broker/api/decorators/embedded_label_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/embedded_tag_decorator_spec.rb +5 -5
- data/spec/lib/pact_broker/api/decorators/embedded_version_decorator_spec.rb +3 -3
- data/spec/lib/pact_broker/api/decorators/extended_pact_decorator_spec.rb +17 -17
- data/spec/lib/pact_broker/api/decorators/integration_decorator_spec.rb +3 -3
- data/spec/lib/pact_broker/api/decorators/integrations_decorator_spec.rb +3 -3
- data/spec/lib/pact_broker/api/decorators/label_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/latest_pact_decorator_spec.rb +4 -4
- data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +50 -25
- data/spec/lib/pact_broker/api/decorators/pact_collection_decorator_spec.rb +6 -6
- data/spec/lib/pact_broker/api/decorators/pact_decorator_spec.rb +25 -25
- data/spec/lib/pact_broker/api/decorators/pact_version_decorator_spec.rb +22 -17
- data/spec/lib/pact_broker/api/decorators/pact_webhooks_status_decorator_spec.rb +17 -14
- data/spec/lib/pact_broker/api/decorators/pacticipant_collection_decorator_spec.rb +7 -7
- data/spec/lib/pact_broker/api/decorators/pacticipant_decorator_spec.rb +63 -50
- data/spec/lib/pact_broker/api/decorators/provider_pacts_decorator_spec.rb +7 -7
- data/spec/lib/pact_broker/api/decorators/publish_contracts_results_decorator_spec.rb +53 -0
- data/spec/lib/pact_broker/api/decorators/reason_decorator_spec.rb +27 -8
- data/spec/lib/pact_broker/api/decorators/relationships_csv_decorator_spec.rb +4 -4
- data/spec/lib/pact_broker/api/decorators/representable_pact_spec.rb +7 -7
- data/spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb +4 -4
- data/spec/lib/pact_broker/api/decorators/tagged_pact_versions_decorator_spec.rb +4 -4
- data/spec/lib/pact_broker/api/decorators/triggered_webhook_decorator_spec.rb +18 -15
- data/spec/lib/pact_broker/api/decorators/triggered_webhooks_decorator_spec.rb +5 -5
- data/spec/lib/pact_broker/api/decorators/verifiable_pact_decorator_spec.rb +11 -11
- data/spec/lib/pact_broker/api/decorators/verifiable_pacts_decorator_spec.rb +3 -3
- data/spec/lib/pact_broker/api/decorators/verifiable_pacts_query_decorator_spec.rb +44 -1
- data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +15 -15
- data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +9 -9
- data/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +93 -48
- data/spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb +7 -7
- data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +59 -59
- data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +15 -15
- data/spec/lib/pact_broker/api/decorators/webhook_request_template_decorator_spec.rb +13 -13
- data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +10 -10
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +36 -10
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +30 -30
- data/spec/lib/pact_broker/api/renderers/integrations_dot_renderer_spec.rb +4 -4
- data/spec/lib/pact_broker/api/resources/all_webhooks_spec.rb +32 -41
- data/spec/lib/pact_broker/api/resources/badge_spec.rb +17 -17
- data/spec/lib/pact_broker/api/resources/can_i_deploy_badge_spec.rb +6 -6
- data/spec/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version_spec.rb +9 -9
- data/spec/lib/pact_broker/api/resources/can_i_deploy_spec.rb +7 -7
- data/spec/lib/pact_broker/api/resources/dashboard_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/default_base_resource_approval_spec.rb +12 -11
- data/spec/lib/pact_broker/api/resources/default_base_resource_spec.rb +25 -24
- data/spec/lib/pact_broker/api/resources/error_response_body_generator_spec.rb +11 -11
- data/spec/lib/pact_broker/api/resources/group_spec.rb +11 -11
- data/spec/lib/pact_broker/api/resources/latest_pact_spec.rb +15 -15
- data/spec/lib/pact_broker/api/resources/latest_provider_pacts_spec.rb +6 -6
- data/spec/lib/pact_broker/api/resources/latest_verifications_for_consumer_version_spec.rb +8 -8
- data/spec/lib/pact_broker/api/resources/matrix_badge_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/matrix_spec.rb +10 -10
- data/spec/lib/pact_broker/api/resources/pact_spec.rb +24 -24
- data/spec/lib/pact_broker/api/resources/pact_triggered_webhooks_spec.rb +4 -4
- data/spec/lib/pact_broker/api/resources/pacticipant_spec.rb +2 -5
- data/spec/lib/pact_broker/api/resources/{webhooks_spec.rb → pacticipant_webhooks_spec.rb} +19 -19
- data/spec/lib/pact_broker/api/resources/pacticipants_spec.rb +18 -22
- data/spec/lib/pact_broker/api/resources/provider_pacts_for_verification_spec.rb +17 -17
- data/spec/lib/pact_broker/api/resources/provider_pacts_spec.rb +8 -8
- data/spec/lib/pact_broker/api/resources/released_version_spec.rb +61 -0
- data/spec/lib/pact_broker/api/resources/tag_spec.rb +3 -3
- data/spec/lib/pact_broker/api/resources/tagged_pact_versions_spec.rb +7 -7
- data/spec/lib/pact_broker/api/resources/triggered_webhook_logs_spec.rb +9 -6
- data/spec/lib/pact_broker/api/resources/verification_spec.rb +76 -7
- data/spec/lib/pact_broker/api/resources/verification_triggered_webhooks_spec.rb +4 -4
- data/spec/lib/pact_broker/api/resources/verifications_spec.rb +22 -28
- data/spec/lib/pact_broker/api/resources/webhook_execution_result_spec.rb +56 -0
- data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +10 -10
- data/spec/lib/pact_broker/api/resources/webhook_spec.rb +15 -15
- data/spec/lib/pact_broker/app_spec.rb +43 -43
- data/spec/lib/pact_broker/badges/service_spec.rb +6 -6
- data/spec/lib/pact_broker/build_http_options_spec.rb +5 -5
- data/spec/lib/pact_broker/certificates/service_spec.rb +7 -7
- data/spec/lib/pact_broker/config/load_spec.rb +11 -11
- data/spec/lib/pact_broker/config/save_and_load_spec.rb +2 -2
- data/spec/lib/pact_broker/config/save_spec.rb +29 -29
- data/spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb +1 -1
- data/spec/lib/pact_broker/config/space_delimited_string_list_spec.rb +1 -1
- data/spec/lib/pact_broker/configuration_spec.rb +9 -9
- data/spec/lib/pact_broker/contracts/service_spec.rb +108 -0
- data/spec/lib/pact_broker/db/clean_incremental_spec.rb +12 -11
- data/spec/lib/pact_broker/db/clean_old_spec.rb +2 -4
- data/spec/lib/pact_broker/db/clean_spec.rb +5 -7
- data/spec/lib/pact_broker/db/data_migrations/migrate_webhook_headers_spec.rb +1 -1
- data/spec/lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications_spec.rb +6 -6
- data/spec/lib/pact_broker/db/data_migrations/set_latest_version_sequence_value_spec.rb +8 -8
- data/spec/lib/pact_broker/db/data_migrations/set_pacticipant_main_branch_spec.rb +41 -0
- data/spec/lib/pact_broker/db/delete_overwritten_data_spec.rb +1 -1
- data/spec/lib/pact_broker/db/log_quietener_spec.rb +1 -1
- data/spec/lib/pact_broker/db/validate_encoding_spec.rb +8 -8
- data/spec/lib/pact_broker/deployments/deployed_version_spec.rb +109 -0
- data/spec/lib/pact_broker/deployments/environment_service_spec.rb +37 -0
- data/spec/lib/pact_broker/deployments/environment_spec.rb +27 -0
- data/spec/lib/pact_broker/diagnostic/resources/dependencies_spec.rb +9 -9
- data/spec/lib/pact_broker/diagnostic/resources/heartbeat_spec.rb +5 -5
- data/spec/lib/pact_broker/doc/controllers/app_spec.rb +4 -4
- data/spec/lib/pact_broker/doc/coverage_spec.rb +5 -5
- data/spec/lib/pact_broker/domain/group_spec.rb +7 -7
- data/spec/lib/pact_broker/domain/index_item_spec.rb +3 -3
- data/spec/lib/pact_broker/domain/order_versions_spec.rb +26 -26
- data/spec/lib/pact_broker/domain/pact_spec.rb +3 -3
- data/spec/lib/pact_broker/domain/tag_spec.rb +1 -1
- data/spec/lib/pact_broker/domain/verification_spec.rb +3 -3
- data/spec/lib/pact_broker/domain/version_spec.rb +118 -7
- data/spec/lib/pact_broker/domain/webhook_request_spec.rb +36 -36
- data/spec/lib/pact_broker/domain/webhook_spec.rb +11 -11
- data/spec/lib/pact_broker/errors/error_logger_spec.rb +4 -4
- data/spec/lib/pact_broker/errors_spec.rb +7 -8
- data/spec/lib/pact_broker/events/subscriber_spec.rb +43 -0
- data/spec/lib/pact_broker/feature_toggle_spec.rb +9 -9
- data/spec/lib/pact_broker/groups/service_spec.rb +8 -8
- data/spec/lib/pact_broker/hash_refinements_spec.rb +1 -1
- data/spec/lib/pact_broker/index/service_spec.rb +13 -14
- data/spec/lib/pact_broker/integrations/integration_spec.rb +1 -1
- data/spec/lib/pact_broker/integrations/service_spec.rb +17 -6
- data/spec/lib/pact_broker/labels/repository_spec.rb +2 -2
- data/spec/lib/pact_broker/labels/service_spec.rb +1 -1
- data/spec/lib/pact_broker/matrix/aggregated_row_spec.rb +14 -14
- data/spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb +72 -0
- data/spec/lib/pact_broker/matrix/deployment_status_summary_spec.rb +100 -20
- data/spec/lib/pact_broker/matrix/every_row_spec.rb +5 -5
- data/spec/lib/pact_broker/matrix/head_row_spec.rb +1 -1
- data/spec/lib/pact_broker/matrix/integration_environment_spec.rb +175 -0
- data/spec/lib/pact_broker/matrix/integration_ignore_spec.rb +226 -0
- data/spec/lib/pact_broker/matrix/integration_spec.rb +11 -13
- data/spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb +49 -0
- data/spec/lib/pact_broker/matrix/parse_query_spec.rb +28 -6
- data/spec/lib/pact_broker/matrix/quick_row_spec.rb +7 -7
- data/spec/lib/pact_broker/matrix/repository_dependency_spec.rb +2 -2
- data/spec/lib/pact_broker/matrix/repository_query_limit_spec.rb +9 -9
- data/spec/lib/pact_broker/matrix/repository_spec.rb +44 -211
- data/spec/lib/pact_broker/matrix/row_spec.rb +7 -7
- data/spec/lib/pact_broker/matrix/service_spec.rb +83 -20
- data/spec/lib/pact_broker/messages_spec.rb +6 -6
- data/spec/lib/pact_broker/metrics/service_spec.rb +1 -1
- data/spec/lib/pact_broker/pacticipants/find_potential_duplicate_pacticipant_names_spec.rb +10 -10
- data/spec/lib/pact_broker/pacticipants/generate_display_name_spec.rb +39 -0
- data/spec/lib/pact_broker/pacticipants/repository_spec.rb +86 -15
- data/spec/lib/pact_broker/pacticipants/service_spec.rb +27 -73
- data/spec/lib/pact_broker/pacts/build_verifiable_pact_notices_spec.rb +10 -10
- data/spec/lib/pact_broker/pacts/content_spec.rb +55 -55
- data/spec/lib/pact_broker/pacts/create_formatted_diff_spec.rb +10 -10
- data/spec/lib/pact_broker/pacts/diff_spec.rb +23 -23
- data/spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb +1 -1
- data/spec/lib/pact_broker/pacts/generate_sha_spec.rb +7 -7
- data/spec/lib/pact_broker/pacts/latest_tagged_pact_publications_spec.rb +1 -1
- data/spec/lib/pact_broker/pacts/merger_spec.rb +7 -7
- data/spec/lib/pact_broker/pacts/metadata_spec.rb +3 -3
- data/spec/lib/pact_broker/pacts/pact_params_spec.rb +12 -12
- data/spec/lib/pact_broker/pacts/pact_publication_dataset_module_spec.rb +8 -8
- data/spec/lib/pact_broker/pacts/pact_publication_selector_dataset_module_spec.rb +120 -0
- data/spec/lib/pact_broker/pacts/pact_publication_spec.rb +9 -9
- data/spec/lib/pact_broker/pacts/pact_version_spec.rb +47 -3
- data/spec/lib/pact_broker/pacts/repository_find_for_currently_deployed_spec.rb +124 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_currently_supported_releases_spec.rb +159 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb +1 -1
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +19 -19
- data/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_branch_spec.rb +59 -1
- data/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb +81 -22
- data/spec/lib/pact_broker/pacts/repository_spec.rb +39 -39
- data/spec/lib/pact_broker/pacts/selected_pact_spec.rb +1 -1
- data/spec/lib/pact_broker/pacts/selector_spec.rb +14 -11
- data/spec/lib/pact_broker/pacts/selectors_spec.rb +3 -3
- data/spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb +5 -5
- data/spec/lib/pact_broker/pacts/service_spec.rb +111 -39
- data/spec/lib/pact_broker/pacts/sort_content_spec.rb +21 -8
- data/spec/lib/pact_broker/pacts/squash_pacts_for_verification_spec.rb +3 -3
- data/spec/lib/pact_broker/pacts/verifiable_pact_messages_spec.rb +99 -35
- data/spec/lib/pact_broker/relationships/groupify_spec.rb +12 -12
- data/spec/lib/pact_broker/tags/repository_spec.rb +2 -2
- data/spec/lib/pact_broker/tags/service_spec.rb +2 -2
- data/spec/lib/pact_broker/ui/controllers/can_i_deploy_spec.rb +1 -1
- data/spec/lib/pact_broker/ui/controllers/clusters_spec.rb +3 -3
- data/spec/lib/pact_broker/ui/controllers/index_spec.rb +47 -8
- data/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +9 -9
- data/spec/lib/pact_broker/ui/view_models/index_items_spec.rb +3 -3
- data/spec/lib/pact_broker/ui/view_models/matrix_deployed_version_spec.rb +29 -0
- data/spec/lib/pact_broker/verifications/pseudo_branch_status_spec.rb +5 -5
- data/spec/lib/pact_broker/verifications/repository_spec.rb +4 -4
- data/spec/lib/pact_broker/verifications/sequence_spec.rb +1 -1
- data/spec/lib/pact_broker/verifications/service_spec.rb +30 -25
- data/spec/lib/pact_broker/verifications/summary_for_consumer_version_spec.rb +6 -6
- data/spec/lib/pact_broker/versions/abbreviate_number_spec.rb +5 -5
- data/spec/lib/pact_broker/versions/parse_semantic_version_spec.rb +2 -2
- data/spec/lib/pact_broker/versions/repository_spec.rb +16 -6
- data/spec/lib/pact_broker/versions/service_spec.rb +1 -1
- data/spec/lib/pact_broker/webhooks/check_host_whitelist_spec.rb +1 -1
- data/spec/lib/pact_broker/webhooks/execution_configuration_spec.rb +1 -1
- data/spec/lib/pact_broker/webhooks/job_spec.rb +10 -10
- data/spec/lib/pact_broker/webhooks/pact_and_verification_parameters_spec.rb +16 -0
- data/spec/lib/pact_broker/webhooks/redact_logs_spec.rb +1 -1
- data/spec/lib/pact_broker/webhooks/render_spec.rb +19 -10
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +203 -177
- data/spec/lib/pact_broker/webhooks/service_spec.rb +37 -243
- data/spec/lib/pact_broker/webhooks/status_spec.rb +5 -5
- data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +252 -127
- data/spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb +2 -2
- data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +11 -11
- data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +70 -28
- data/spec/lib/pact_broker/webhooks/webhook_spec.rb +2 -5
- data/spec/lib/rack/hal_browser/redirect_spec.rb +18 -18
- data/spec/lib/rack/pact_broker/add_pact_broker_version_header_spec.rb +3 -3
- data/spec/lib/rack/pact_broker/database_transaction_spec.rb +10 -15
- data/spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb +2 -2
- data/spec/lib/rack/pact_broker/request_target_spec.rb +5 -5
- data/spec/lib/rack/pact_broker/set_base_url_spec.rb +86 -0
- data/spec/lib/rack/pact_broker/use_when_spec.rb +6 -6
- data/spec/lib/sequel/plugins/insert_ignore_spec.rb +2 -2
- data/spec/lib/sequel/plugins/upsert_spec.rb +3 -3
- data/spec/lib/webmachine/rack_adapter_monkey_patch_spec.rb +7 -8
- data/spec/migrations/23_pact_versions_spec.rb +11 -13
- data/spec/migrations/24_populate_pact_contents_spec.rb +7 -7
- data/spec/migrations/34_latest_tagged_pacts_spec.rb +23 -23
- data/spec/migrations/34_pact_revisions_spec.rb +10 -10
- data/spec/migrations/41_migrate_execution_data_spec.rb +11 -11
- data/spec/migrations/42_delete_ophan_webhook_data_spec.rb +17 -17
- data/spec/migrations/44_add_provider_version_to_verification_spec.rb +9 -9
- data/spec/migrations/50_create_latest_matrix_spec.rb +15 -15
- data/spec/migrations/change_migration_strategy_spec.rb +21 -21
- data/spec/migrations/rollback_spec.rb +2 -0
- data/spec/service_consumers/hal_relation_proxy_app.rb +30 -7
- data/spec/service_consumers/pact_helper.rb +24 -11
- data/spec/service_consumers/provider_states_for_pact_broker_client.rb +101 -18
- data/spec/service_consumers/provider_states_for_pact_broker_client_2.rb +36 -0
- data/spec/service_consumers/provider_states_for_pact_ruby.rb +64 -64
- data/spec/spec_helper.rb +13 -25
- data/spec/support/approvals.rb +9 -7
- data/spec/support/database.rb +8 -4
- data/spec/support/database_cleaner.rb +2 -2
- data/spec/support/fixture_helpers.rb +1 -1
- data/spec/support/logging.rb +2 -2
- data/spec/support/metadata_test_server.rb +7 -7
- data/spec/support/migration_helpers.rb +1 -1
- data/spec/support/rack_helpers.rb +20 -0
- data/spec/support/rspec_matchers.rb +1 -1
- data/spec/support/shared_context.rb +1 -1
- data/spec/support/shared_examples_for_responses.rb +15 -4
- data/spec/support/simplecov.rb +20 -7
- data/spec/support/ssl_pact_broker_server.rb +8 -8
- data/spec/support/ssl_webhook_server.rb +8 -8
- data/spec/support/test_data_builder.rb +1 -1
- data/spec/support/verification_job.rb +8 -8
- data/spec/support/webhook_endpoint_middleware.rb +4 -4
- data/tasks/audit.rake +1 -1
- data/tasks/database.rb +23 -23
- data/tasks/database/annotate.rb +2 -2
- data/tasks/database/table_dependency_calculator.rb +1 -1
- data/tasks/db.rake +34 -39
- data/tasks/development.rake +38 -6
- data/tasks/docker_database.rb +9 -9
- data/tasks/pact.rake +5 -5
- data/tasks/release.rake +2 -2
- data/tasks/rspec.rake +16 -16
- data/tasks/test_db.rake +11 -11
- data/vendor/hal-browser/styles.css +6 -0
- metadata +209 -21
- data/.travis.yml +0 -31
- data/lib/pact_broker/domain/webhook_request_header.rb +0 -13
- data/lib/webmachine/rack_adapter_monkey_patch.rb +0 -38
- data/spec/lib/pact_broker/domain/pacticipant_spec.rb +0 -26
@@ -1,14 +1,14 @@
|
|
1
|
-
describe
|
1
|
+
describe "creating triggered webhooks from webhook executions (migrate 36-41)", migration: true do
|
2
2
|
before do
|
3
3
|
PactBroker::Database.migrate(41)
|
4
4
|
end
|
5
5
|
|
6
6
|
let(:before_now) { DateTime.new(2016, 1, 1) }
|
7
7
|
let(:now) { DateTime.new(2018, 2, 2) }
|
8
|
-
let!(:consumer) { create(:pacticipants, {name:
|
9
|
-
let!(:provider) { create(:pacticipants, {name:
|
10
|
-
let!(:consumer_version) { create(:versions, {number:
|
11
|
-
let!(:pact_version) { create(:pact_versions, {content: {some:
|
8
|
+
let!(:consumer) { create(:pacticipants, {name: "Consumer", created_at: now, updated_at: now}) }
|
9
|
+
let!(:provider) { create(:pacticipants, {name: "Provider", created_at: now, updated_at: now}) }
|
10
|
+
let!(:consumer_version) { create(:versions, {number: "1.2.3", order: 1, pacticipant_id: consumer[:id], created_at: now, updated_at: now}) }
|
11
|
+
let!(:pact_version) { create(:pact_versions, {content: {some: "json"}.to_json, sha: "1234", consumer_id: consumer[:id], provider_id: provider[:id], created_at: now}) }
|
12
12
|
let!(:pact_publication) do
|
13
13
|
create(:pact_publications, {
|
14
14
|
consumer_version_id: consumer_version[:id],
|
@@ -20,9 +20,9 @@ describe 'creating triggered webhooks from webhook executions (migrate 36-41)',
|
|
20
20
|
end
|
21
21
|
let!(:webhook) do
|
22
22
|
create(:webhooks, {
|
23
|
-
uuid:
|
24
|
-
method:
|
25
|
-
url:
|
23
|
+
uuid: "1234",
|
24
|
+
method: "GET",
|
25
|
+
url: "http://www.example.org",
|
26
26
|
consumer_id: consumer[:id],
|
27
27
|
provider_id: provider[:id],
|
28
28
|
is_json_request_body: false,
|
@@ -31,14 +31,14 @@ describe 'creating triggered webhooks from webhook executions (migrate 36-41)',
|
|
31
31
|
end
|
32
32
|
let!(:triggered_webhook) do
|
33
33
|
create(:triggered_webhooks, {
|
34
|
-
trigger_uuid:
|
35
|
-
trigger_type:
|
34
|
+
trigger_uuid: "12345",
|
35
|
+
trigger_type: "publication",
|
36
36
|
pact_publication_id: pact_publication[:id],
|
37
37
|
webhook_id: webhook[:id],
|
38
38
|
webhook_uuid: webhook[:uuid],
|
39
39
|
consumer_id: consumer[:id],
|
40
40
|
provider_id: provider[:id],
|
41
|
-
status:
|
41
|
+
status: "success",
|
42
42
|
created_at: now,
|
43
43
|
updated_at: now
|
44
44
|
})
|
@@ -47,21 +47,21 @@ describe 'creating triggered webhooks from webhook executions (migrate 36-41)',
|
|
47
47
|
create(:webhook_executions, {
|
48
48
|
triggered_webhook_id: triggered_webhook[:id],
|
49
49
|
success: true,
|
50
|
-
logs:
|
50
|
+
logs: "logs",
|
51
51
|
created_at: now
|
52
52
|
})
|
53
53
|
end
|
54
54
|
|
55
55
|
let!(:orphan_triggered_webhook) do
|
56
56
|
create(:triggered_webhooks, {
|
57
|
-
trigger_uuid:
|
58
|
-
trigger_type:
|
57
|
+
trigger_uuid: "12345",
|
58
|
+
trigger_type: "publication",
|
59
59
|
pact_publication_id: pact_publication[:id],
|
60
60
|
webhook_id: nil,
|
61
61
|
webhook_uuid: webhook[:uuid],
|
62
62
|
consumer_id: consumer[:id],
|
63
63
|
provider_id: provider[:id],
|
64
|
-
status:
|
64
|
+
status: "success",
|
65
65
|
created_at: now,
|
66
66
|
updated_at: now
|
67
67
|
})
|
@@ -71,7 +71,7 @@ describe 'creating triggered webhooks from webhook executions (migrate 36-41)',
|
|
71
71
|
create(:webhook_executions, {
|
72
72
|
triggered_webhook_id: orphan_triggered_webhook[:id],
|
73
73
|
success: true,
|
74
|
-
logs:
|
74
|
+
logs: "logs",
|
75
75
|
created_at: now
|
76
76
|
})
|
77
77
|
end
|
@@ -81,7 +81,7 @@ describe 'creating triggered webhooks from webhook executions (migrate 36-41)',
|
|
81
81
|
triggered_webhook_id: nil,
|
82
82
|
webhook_id: nil,
|
83
83
|
success: true,
|
84
|
-
logs:
|
84
|
+
logs: "logs",
|
85
85
|
created_at: now
|
86
86
|
})
|
87
87
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
describe
|
1
|
+
describe "add provider version relationship to verification (migrate 42-44)", migration: true do
|
2
2
|
before do
|
3
3
|
PactBroker::Database.migrate(42)
|
4
4
|
end
|
5
5
|
|
6
6
|
let(:now) { DateTime.new(2018, 2, 2) }
|
7
|
-
let!(:consumer) { create(:pacticipants, {name:
|
8
|
-
let!(:provider) { create(:pacticipants, {name:
|
9
|
-
let!(:consumer_version) { create(:versions, {number:
|
10
|
-
let!(:pact_version) { create(:pact_versions, {content: {some:
|
7
|
+
let!(:consumer) { create(:pacticipants, {name: "Consumer", created_at: now, updated_at: now}) }
|
8
|
+
let!(:provider) { create(:pacticipants, {name: "Provider", created_at: now, updated_at: now}) }
|
9
|
+
let!(:consumer_version) { create(:versions, {number: "1.2.3", order: 1, pacticipant_id: consumer[:id], created_at: now, updated_at: now}) }
|
10
|
+
let!(:pact_version) { create(:pact_versions, {content: {some: "json"}.to_json, sha: "1234", consumer_id: consumer[:id], provider_id: provider[:id], created_at: now}) }
|
11
11
|
let!(:pact_publication) do
|
12
12
|
create(:pact_publications, {
|
13
13
|
consumer_version_id: consumer_version[:id],
|
@@ -21,7 +21,7 @@ describe 'add provider version relationship to verification (migrate 42-44)', mi
|
|
21
21
|
create(:verifications, {
|
22
22
|
number: 1,
|
23
23
|
success: true,
|
24
|
-
provider_version:
|
24
|
+
provider_version: "1.2.3",
|
25
25
|
pact_version_id: pact_version[:id],
|
26
26
|
execution_date: now,
|
27
27
|
created_at: now
|
@@ -36,7 +36,7 @@ describe 'add provider version relationship to verification (migrate 42-44)', mi
|
|
36
36
|
|
37
37
|
it "sets the foreign key to the new version" do
|
38
38
|
subject
|
39
|
-
expect(PactBroker::Domain::Verification.first.provider_version.number).to eq
|
39
|
+
expect(PactBroker::Domain::Verification.first.provider_version.number).to eq "1.2.3"
|
40
40
|
end
|
41
41
|
|
42
42
|
it "sets the created_at date of the new version to the created_at of the verification" do
|
@@ -45,7 +45,7 @@ describe 'add provider version relationship to verification (migrate 42-44)', mi
|
|
45
45
|
end
|
46
46
|
|
47
47
|
context "when the version already exists" do
|
48
|
-
let!(:provider_version) { create(:versions, {number:
|
48
|
+
let!(:provider_version) { create(:versions, {number: "1.2.3", order: 1, pacticipant_id: provider[:id], created_at: now, updated_at: now}) }
|
49
49
|
|
50
50
|
it "does not create a version object" do
|
51
51
|
expect { subject }.to_not change { PactBroker::Domain::Version.count }
|
@@ -53,7 +53,7 @@ describe 'add provider version relationship to verification (migrate 42-44)', mi
|
|
53
53
|
|
54
54
|
it "sets the foreign key to the existing version" do
|
55
55
|
subject
|
56
|
-
expect(PactBroker::Domain::Verification.first.provider_version.number).to eq
|
56
|
+
expect(PactBroker::Domain::Verification.first.provider_version.number).to eq "1.2.3"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe "create latest matrix (latest pact revision/latest verification for provider version)", migration: true do
|
2
2
|
before do
|
3
3
|
PactBroker::Database.migrate(20180129)
|
4
4
|
end
|
@@ -8,20 +8,20 @@ describe 'create latest matrix (latest pact revision/latest verification for pro
|
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:now) { DateTime.new(2018, 2, 2) }
|
11
|
-
let!(:consumer) { create(:pacticipants, {name:
|
12
|
-
let!(:provider_1) { create(:pacticipants, {name:
|
13
|
-
let!(:provider_2) { create(:pacticipants, {name:
|
14
|
-
let!(:consumer_version_1) { create(:versions, {number:
|
15
|
-
let!(:consumer_version_2) { create(:versions, {number:
|
16
|
-
let!(:provider_1_version_1) { create(:versions, {number:
|
17
|
-
let!(:provider_1_version_2) { create(:versions, {number:
|
18
|
-
let!(:provider_2_version_1) { create(:versions, {number:
|
19
|
-
let!(:provider_2_version_2) { create(:versions, {number:
|
20
|
-
|
21
|
-
let!(:pact_version_1) { create(:pact_versions, {content: {some:
|
22
|
-
let!(:pact_version_2) { create(:pact_versions, {content: {some:
|
23
|
-
let!(:pact_version_3) { create(:pact_versions, {content: {some:
|
24
|
-
let!(:pact_version_4) { create(:pact_versions, {content: {some:
|
11
|
+
let!(:consumer) { create(:pacticipants, {name: "C", created_at: now, updated_at: now}) }
|
12
|
+
let!(:provider_1) { create(:pacticipants, {name: "P", created_at: now, updated_at: now}) }
|
13
|
+
let!(:provider_2) { create(:pacticipants, {name: "Q", created_at: now, updated_at: now}) }
|
14
|
+
let!(:consumer_version_1) { create(:versions, {number: "1", order: 1, pacticipant_id: consumer[:id], created_at: now, updated_at: now}) }
|
15
|
+
let!(:consumer_version_2) { create(:versions, {number: "2", order: 2, pacticipant_id: consumer[:id], created_at: now, updated_at: now}) }
|
16
|
+
let!(:provider_1_version_1) { create(:versions, {number: "1", order: 1, pacticipant_id: provider_1[:id], created_at: now, updated_at: now}) }
|
17
|
+
let!(:provider_1_version_2) { create(:versions, {number: "2", order: 2, pacticipant_id: provider_1[:id], created_at: now, updated_at: now}) }
|
18
|
+
let!(:provider_2_version_1) { create(:versions, {number: "1", order: 1, pacticipant_id: provider_2[:id], created_at: now, updated_at: now}) }
|
19
|
+
let!(:provider_2_version_2) { create(:versions, {number: "2", order: 2, pacticipant_id: provider_2[:id], created_at: now, updated_at: now}) }
|
20
|
+
|
21
|
+
let!(:pact_version_1) { create(:pact_versions, {content: {some: "json"}.to_json, sha: "1", consumer_id: consumer[:id], provider_id: provider_1[:id], created_at: now}) }
|
22
|
+
let!(:pact_version_2) { create(:pact_versions, {content: {some: "json other"}.to_json, sha: "2", consumer_id: consumer[:id], provider_id: provider_1[:id], created_at: now}) }
|
23
|
+
let!(:pact_version_3) { create(:pact_versions, {content: {some: "json more"}.to_json, sha: "3", consumer_id: consumer[:id], provider_id: provider_1[:id], created_at: now}) }
|
24
|
+
let!(:pact_version_4) { create(:pact_versions, {content: {some: "json more blah"}.to_json, sha: "4", consumer_id: consumer[:id], provider_id: provider_2[:id], created_at: now}) }
|
25
25
|
|
26
26
|
let!(:pact_publication_1) do
|
27
27
|
create(:pact_publications, {
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "fileutils"
|
2
2
|
|
3
|
-
describe "changing from integer to timestamp migrations", no_db_clean: true, skip:
|
3
|
+
describe "changing from integer to timestamp migrations", no_db_clean: true, skip: "don't need to run this repeatedly any more, it's so old, and it's failing now due to other reasons" do
|
4
4
|
|
5
5
|
TEST_DIR = "db/test/change_migration_strategy"
|
6
6
|
DATABASE_PATH = "#{TEST_DIR}/pact_broker_database.sqlite3"
|
7
|
-
DATABASE_CONFIG = {adapter: "sqlite", database: DATABASE_PATH, :encoding =>
|
7
|
+
DATABASE_CONFIG = {adapter: "sqlite", database: DATABASE_PATH, :encoding => "utf8"}
|
8
8
|
|
9
9
|
before do
|
10
10
|
@db = Sequel.connect(DATABASE_CONFIG)
|
@@ -25,30 +25,30 @@ describe "changing from integer to timestamp migrations", no_db_clean: true, ski
|
|
25
25
|
|
26
26
|
it "uses pact_broker v 2.6.0" do
|
27
27
|
Dir.chdir(TEST_DIR) do
|
28
|
-
Bundler.
|
29
|
-
execute(
|
30
|
-
expect(execute(
|
28
|
+
Bundler.with_original_env do
|
29
|
+
execute("bundle install --gemfile before/Gemfile --jobs=3 --retry=3")
|
30
|
+
expect(execute("BUNDLE_GEMFILE=before/Gemfile bundle exec rake pact_broker:version").strip).to eq "2.6.0"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
it "migrates using integer migrations using pact_broker v2.6.0" do
|
36
36
|
Dir.chdir(TEST_DIR) do
|
37
|
-
Bundler.
|
38
|
-
execute(
|
39
|
-
output = execute(
|
37
|
+
Bundler.with_original_env do
|
38
|
+
execute("BUNDLE_GEMFILE=before/Gemfile bundle exec rake pact_broker:db:migrate[35]")
|
39
|
+
output = execute("BUNDLE_GEMFILE=before/Gemfile bundle exec rake pact_broker:db:version")
|
40
40
|
expect(output.strip).to eq "35"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
it "allows data to be inserted" do
|
46
|
-
consumer_id = @db[:pacticipants].insert(name:
|
47
|
-
provider_id = @db[:pacticipants].insert(name:
|
48
|
-
version_id = @db[:versions].insert(number:
|
49
|
-
pact_json = {consumer: {name:
|
50
|
-
pact_version_id = @db[:pact_versions].insert(sha:
|
51
|
-
|
46
|
+
consumer_id = @db[:pacticipants].insert(name: "Foo", created_at: DateTime.now, updated_at: DateTime.now)
|
47
|
+
provider_id = @db[:pacticipants].insert(name: "Bar", created_at: DateTime.now, updated_at: DateTime.now)
|
48
|
+
version_id = @db[:versions].insert(number: "1.2.3", order: 1, pacticipant_id: consumer_id, created_at: DateTime.now, updated_at: DateTime.now)
|
49
|
+
pact_json = {consumer: {name: "Foo"}, provider: {name: "Bar"}, interactions: []}.to_json
|
50
|
+
pact_version_id = @db[:pact_versions].insert(sha: "123", content: pact_json, created_at: DateTime.now, consumer_id: consumer_id, provider_id: provider_id)
|
51
|
+
@db[:pact_publications].insert(consumer_version_id: version_id, provider_id: provider_id, revision_number: 1, pact_version_id: pact_version_id, created_at: DateTime.now)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "does not have a schema_migrations table" do
|
@@ -57,18 +57,18 @@ describe "changing from integer to timestamp migrations", no_db_clean: true, ski
|
|
57
57
|
|
58
58
|
it "migrates using timestamp migrations using pact_broker > 2.6.0" do
|
59
59
|
Dir.chdir(TEST_DIR) do
|
60
|
-
execute(
|
61
|
-
output = execute(
|
60
|
+
execute("bundle exec rake pact_broker:db:migrate")
|
61
|
+
output = execute("bundle exec rake pact_broker:db:version")
|
62
62
|
expect(output.strip.to_i).to be > 47
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
it "uses the schema_migrations table after v2.6.0" do
|
67
67
|
expect(@db.table_exists?(:schema_migrations)).to be true
|
68
|
-
migrations_count = Dir.glob("db/migrations/**.*").
|
68
|
+
migrations_count = Dir.glob("db/migrations/**.*").count{ |f| f =~ /\/\d+/ }
|
69
69
|
expect(migrations_count).to be >= 47
|
70
70
|
expect(@db[:schema_migrations].count).to eq migrations_count
|
71
|
-
expect(@db[:schema_migrations].order(:filename).first[:filename]).to eq
|
71
|
+
expect(@db[:schema_migrations].order(:filename).first[:filename]).to eq "000001_create_pacticipant_table.rb"
|
72
72
|
end
|
73
73
|
|
74
74
|
it "doesn't need the schema_info table after this" do
|
@@ -77,8 +77,8 @@ describe "changing from integer to timestamp migrations", no_db_clean: true, ski
|
|
77
77
|
|
78
78
|
it "allows rollback" do
|
79
79
|
Dir.chdir(TEST_DIR) do
|
80
|
-
execute(
|
81
|
-
output = execute(
|
80
|
+
execute("bundle exec rake pact_broker:db:migrate[45]")
|
81
|
+
output = execute("bundle exec rake pact_broker:db:version")
|
82
82
|
expect(output.strip).to eq "45"
|
83
83
|
end
|
84
84
|
end
|
@@ -2,5 +2,7 @@ describe "migrate and rollback", migration: true do
|
|
2
2
|
it "doesn't blow up" do
|
3
3
|
PactBroker::Database.migrate
|
4
4
|
PactBroker::Database.migrate(20190509) # previous migration uses an irreversible migration
|
5
|
+
PactBroker::Database.migrate
|
6
|
+
PactBroker::Database.migrate(20190509)
|
5
7
|
end
|
6
8
|
end
|
@@ -4,12 +4,30 @@ class HalRelationProxyApp
|
|
4
4
|
# It means we can use placeholder URLS for the relations in our consumer tests so that
|
5
5
|
# the consumer does not need to know the actual URLs.
|
6
6
|
PATH_REPLACEMENTS = {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
"/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production" =>
|
8
|
+
"/pacticipants/Condor/latest-version/production",
|
9
|
+
"/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor" =>
|
10
|
+
"/pacticipants/Condor/latest-version",
|
11
|
+
"/HAL-REL-PLACEHOLDER-PB-WEBHOOKS" =>
|
12
|
+
"/webhooks",
|
13
|
+
"/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-Foo-26f353580936ad3b9baddb17b00e84f33c69e7cb" =>
|
14
|
+
"/pacticipants/Foo/versions/26f353580936ad3b9baddb17b00e84f33c69e7cb",
|
15
|
+
"/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS" =>
|
16
|
+
"/environments",
|
17
|
+
"/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30" =>
|
18
|
+
"/pacticipants/Foo/versions/5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
19
|
+
"/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST" =>
|
20
|
+
"/pacticipants/Foo/versions/5556b8149bf8bac76bc30f50a8a2dd4c22c85f30/deployed-versions/environment/cb632df3-0a0d-4227-aac3-60114dd36479",
|
21
|
+
"/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS" =>
|
22
|
+
"/contracts/publish",
|
23
|
+
"/HAL-REL-PLACEHOLDER-PB-RECORD-RELEASE-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST" =>
|
24
|
+
"/pacticipants/Foo/versions/5556b8149bf8bac76bc30f50a8a2dd4c22c85f30/deployed-versions/environment/cb632df3-0a0d-4227-aac3-60114dd36479",
|
25
|
+
"/PLACEHOLDER-DEPLOYED-VERSION-ff3adecf-cfc5-4653-a4e3-f1861092f8e0" =>
|
26
|
+
"/deployed-versions/ff3adecf-cfc5-4653-a4e3-f1861092f8e0",
|
27
|
+
"/PLACEHOLDER-ENVIRONMENT-CURRENTLY-DEPLOYED-16926ef3-590f-4e3f-838e-719717aa88c9" =>
|
28
|
+
"/environments/16926ef3-590f-4e3f-838e-719717aa88c9/deployed-versions/currently-deployed",
|
29
|
+
"/HAL-REL-PLACEHOLDER-PB-ENVIRONMENT-16926ef3-590f-4e3f-838e-719717aa88c9" =>
|
30
|
+
"/environments/16926ef3-590f-4e3f-838e-719717aa88c9"
|
13
31
|
}
|
14
32
|
|
15
33
|
RESPONSE_BODY_REPLACEMENTS = {
|
@@ -20,9 +38,14 @@ class HalRelationProxyApp
|
|
20
38
|
end
|
21
39
|
|
22
40
|
def call env
|
41
|
+
original_path = env["PATH_INFO"]
|
23
42
|
env_with_modified_path = env
|
24
43
|
PATH_REPLACEMENTS.each do | (find, replace) |
|
25
|
-
env_with_modified_path[
|
44
|
+
env_with_modified_path["PATH_INFO"] = env_with_modified_path["PATH_INFO"].gsub(find, replace)
|
45
|
+
end
|
46
|
+
|
47
|
+
if env_with_modified_path["PATH_INFO"] != original_path
|
48
|
+
puts "Redirected to: #{env_with_modified_path["PATH_INFO"]}"
|
26
49
|
end
|
27
50
|
|
28
51
|
response = @app.call(env_with_modified_path)
|
@@ -1,17 +1,17 @@
|
|
1
1
|
$: << File.expand_path("../../../", __FILE__)
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
3
|
+
require "spec/support/simplecov"
|
4
|
+
require "pact/provider/rspec"
|
5
|
+
require "db"
|
6
|
+
require "tasks/database"
|
7
|
+
require "pact_broker/db"
|
8
8
|
PactBroker::DB.connection = PactBroker::Database.database = DB::PACT_BROKER_DB
|
9
9
|
PactBroker.configuration.seed_example_data = false
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
10
|
+
require "spec/support/database_cleaner"
|
11
|
+
require "pact_broker"
|
12
|
+
require "pact_broker/app"
|
13
13
|
|
14
|
-
require_relative
|
14
|
+
require_relative "hal_relation_proxy_app"
|
15
15
|
|
16
16
|
Dir.glob(File.join(File.dirname(__FILE__), "provider_states_for*.rb")).each do | path |
|
17
17
|
require path
|
@@ -23,7 +23,7 @@ app_to_verify = HalRelationProxyApp.new(pact_broker)
|
|
23
23
|
module Rack
|
24
24
|
module PactBroker
|
25
25
|
class DatabaseTransaction
|
26
|
-
def do_not_rollback?
|
26
|
+
def do_not_rollback? _response
|
27
27
|
# Dodgey hack to stop exceptions raising a Rollback error while verifying
|
28
28
|
# Otherwise the provider states that deliberately raise exceptions
|
29
29
|
# end up raising exceptions that break the verification tests
|
@@ -38,9 +38,22 @@ Pact.configuration.logger.level = Logger::DEBUG
|
|
38
38
|
Pact.service_provider "Pact Broker" do
|
39
39
|
|
40
40
|
app { HalRelationProxyApp.new(app_to_verify) }
|
41
|
+
app_version ENV["GIT_SHA"] if ENV["GIT_SHA"]
|
42
|
+
app_version_tags [ENV["GIT_BRANCH"]] if ENV["GIT_BRANCH"]
|
43
|
+
publish_verification_results ENV["CI"] == "true"
|
44
|
+
|
45
|
+
if ENV.fetch("PACTFLOW_PACT_OSS_TOKEN", "") != ""
|
46
|
+
honours_pacts_from_pact_broker do
|
47
|
+
pact_broker_base_url "https://pact-oss.pactflow.io", token: ENV["PACTFLOW_PACT_OSS_TOKEN"]
|
48
|
+
consumer_version_selectors [
|
49
|
+
{ tag: "master", latest: true }
|
50
|
+
]
|
51
|
+
enable_pending true
|
52
|
+
include_wip_pacts_since "2000-01-01"
|
53
|
+
end
|
54
|
+
end
|
41
55
|
|
42
56
|
honours_pact_with "Pact Broker Client" do
|
43
57
|
pact_uri "https://raw.githubusercontent.com/pact-foundation/pact_broker-client/master/spec/pacts/pact_broker_client-pact_broker.json"
|
44
58
|
end
|
45
|
-
|
46
59
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec/support/test_data_builder"
|
2
2
|
|
3
3
|
Pact.provider_states_for "Pact Broker Client" do
|
4
4
|
|
@@ -140,7 +140,7 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
140
140
|
|
141
141
|
provider_state "an error occurs while publishing a pact" do
|
142
142
|
set_up do
|
143
|
-
require
|
143
|
+
require "pact_broker/pacts/service"
|
144
144
|
allow(PactBroker::Pacts::Service).to receive(:create_or_update_pact).and_raise("an error")
|
145
145
|
end
|
146
146
|
end
|
@@ -149,7 +149,7 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
149
149
|
set_up do
|
150
150
|
TestDataBuilder.new
|
151
151
|
.create_condor
|
152
|
-
.create_consumer_version(
|
152
|
+
.create_consumer_version("1.3.0")
|
153
153
|
.create_pricing_service
|
154
154
|
.create_pact
|
155
155
|
end
|
@@ -163,7 +163,7 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
163
163
|
set_up do
|
164
164
|
TestDataBuilder.new
|
165
165
|
.create_condor
|
166
|
-
.create_consumer_version(
|
166
|
+
.create_consumer_version("1.3.0")
|
167
167
|
.create_pricing_service
|
168
168
|
.create_pact
|
169
169
|
end
|
@@ -177,7 +177,7 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
177
177
|
|
178
178
|
provider_state "'Condor' exists in the pact-broker" do
|
179
179
|
set_up do
|
180
|
-
TestDataBuilder.new.create_condor.create_consumer_version(
|
180
|
+
TestDataBuilder.new.create_condor.create_consumer_version("1.3.0")
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -185,23 +185,23 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
185
185
|
set_up do
|
186
186
|
TestDataBuilder.new
|
187
187
|
.create_pacticipant("Condor")
|
188
|
-
.create_version(
|
189
|
-
.create_tag(
|
188
|
+
.create_version("1.3.0")
|
189
|
+
.create_tag("prod")
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
193
193
|
provider_state "'Condor' does not exist in the pact-broker" do
|
194
|
-
|
195
|
-
|
194
|
+
no_op
|
195
|
+
end
|
196
196
|
|
197
197
|
provider_state "a pact between Condor and the Pricing Service exists for the production version of Condor" do
|
198
198
|
set_up do
|
199
|
-
|
200
|
-
|
201
|
-
.create_consumer_version(
|
202
|
-
.create_consumer_version_tag(
|
203
|
-
|
204
|
-
|
199
|
+
TestDataBuilder.new
|
200
|
+
.create_consumer("Condor")
|
201
|
+
.create_consumer_version("1.3.0")
|
202
|
+
.create_consumer_version_tag("prod")
|
203
|
+
.create_provider("Pricing Service")
|
204
|
+
.create_pact
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
@@ -219,7 +219,7 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
219
219
|
set_up do
|
220
220
|
TestDataBuilder.new
|
221
221
|
.create_consumer("Condor")
|
222
|
-
.create_consumer_version(
|
222
|
+
.create_consumer_version("1.3.0")
|
223
223
|
.create_provider("Pricing Service")
|
224
224
|
.create_pact
|
225
225
|
end
|
@@ -229,8 +229,8 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
229
229
|
set_up do
|
230
230
|
TestDataBuilder.new
|
231
231
|
.create_consumer("Condor")
|
232
|
-
.create_consumer_version(
|
233
|
-
.create_consumer_version_tag(
|
232
|
+
.create_consumer_version("1.3.0")
|
233
|
+
.create_consumer_version_tag("prod")
|
234
234
|
.create_provider("Pricing Service")
|
235
235
|
.create_pact
|
236
236
|
end
|
@@ -255,4 +255,87 @@ Pact.provider_states_for "Pact Broker Client" do
|
|
255
255
|
.create_consumer("Foo")
|
256
256
|
end
|
257
257
|
end
|
258
|
+
|
259
|
+
provider_state "the pb:pacticipant-version relation exists in the index resource" do
|
260
|
+
no_op
|
261
|
+
end
|
262
|
+
|
263
|
+
provider_state "version 26f353580936ad3b9baddb17b00e84f33c69e7cb of pacticipant Foo does not exist" do
|
264
|
+
no_op
|
265
|
+
end
|
266
|
+
|
267
|
+
provider_state "version 26f353580936ad3b9baddb17b00e84f33c69e7cb of pacticipant Foo does exist" do
|
268
|
+
set_up do
|
269
|
+
TestDataBuilder.new
|
270
|
+
.create_consumer("Foo")
|
271
|
+
.create_consumer_version("26f353580936ad3b9baddb17b00e84f33c69e7cb")
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
provider_state "the pb:publish-contracts relations exists in the index resource" do
|
276
|
+
no_op
|
277
|
+
end
|
278
|
+
|
279
|
+
provider_state "the pb:environments relation exists in the index resource" do
|
280
|
+
no_op
|
281
|
+
end
|
282
|
+
|
283
|
+
provider_state "provider Bar version 4.5.6 has a successful verification for Foo version 1.2.3 tagged prod and a failed verification for version 3.4.5 tagged prod" do
|
284
|
+
set_up do
|
285
|
+
TestDataBuilder.new
|
286
|
+
.create_consumer("Foo")
|
287
|
+
.create_provider("Bar")
|
288
|
+
.create_consumer_version("1.2.3")
|
289
|
+
.create_consumer_version_tag("prod")
|
290
|
+
.create_pact
|
291
|
+
.create_verification(provider_version: "4.5.6")
|
292
|
+
.create_consumer_version("3.4.5")
|
293
|
+
.create_consumer_version_tag("prod")
|
294
|
+
.create_pact(json_content: TestDataBuilder.new.random_json_content("Foo", "Bar"))
|
295
|
+
.create_verification(provider_version: "4.5.6", success: false)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
provider_state "an environment exists" do
|
300
|
+
set_up do
|
301
|
+
TestDataBuilder.new
|
302
|
+
.create_environment("test", contacts: [ { name: "foo", details: { emailAddress: "foo@bar.com" } }])
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
provider_state "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for release" do
|
307
|
+
set_up do
|
308
|
+
TestDataBuilder.new
|
309
|
+
.create_environment("test", uuid: "cb632df3-0a0d-4227-aac3-60114dd36479")
|
310
|
+
.create_consumer("Foo")
|
311
|
+
.create_consumer_version("5556b8149bf8bac76bc30f50a8a2dd4c22c85f30")
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
provider_state "an environment with name test and UUID 16926ef3-590f-4e3f-838e-719717aa88c9 exists" do
|
316
|
+
set_up do
|
317
|
+
TestDataBuilder.new
|
318
|
+
.create_environment("test", uuid: "16926ef3-590f-4e3f-838e-719717aa88c9")
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
provider_state "an version is deployed to environment with UUID 16926ef3-590f-4e3f-838e-719717aa88c9 with target customer-1" do
|
323
|
+
set_up do
|
324
|
+
TestDataBuilder.new
|
325
|
+
.create_environment("test", uuid: "16926ef3-590f-4e3f-838e-719717aa88c9")
|
326
|
+
.create_consumer("Foo")
|
327
|
+
.create_consumer_version("5556b8149bf8bac76bc30f50a8a2dd4c22c85f30")
|
328
|
+
.create_deployed_version_for_consumer_version(uuid: "ff3adecf-cfc5-4653-a4e3-f1861092f8e0", target: "customer-1")
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
provider_state "a currently deployed version exists" do
|
333
|
+
set_up do
|
334
|
+
TestDataBuilder.new
|
335
|
+
.create_environment("test", uuid: "cb632df3-0a0d-4227-aac3-60114dd36479")
|
336
|
+
.create_consumer("Foo")
|
337
|
+
.create_consumer_version("5556b8149bf8bac76bc30f50a8a2dd4c22c85f30")
|
338
|
+
.create_deployed_version_for_consumer_version(uuid: "ff3adecf-cfc5-4653-a4e3-f1861092f8e0")
|
339
|
+
end
|
340
|
+
end
|
258
341
|
end
|