Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-10 03:08:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-10 03:08:22 +0300
commit77edae8f143c25536a7539abb2be6935ebb2fddc (patch)
treebd16c20a2b74e2a18f15faaabc827c4c9741eafb /spec/contracts
parent21a5ef21750a02e4536077833400158de7e4ff95 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/contracts')
-rw-r--r--spec/contracts/provider/helpers/contract_source_helper.rb5
-rw-r--r--spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb6
-rw-r--r--spec/contracts/publish-contracts.sh3
3 files changed, 8 insertions, 6 deletions
diff --git a/spec/contracts/provider/helpers/contract_source_helper.rb b/spec/contracts/provider/helpers/contract_source_helper.rb
index f59f228722d..e1891b316f3 100644
--- a/spec/contracts/provider/helpers/contract_source_helper.rb
+++ b/spec/contracts/provider/helpers/contract_source_helper.rb
@@ -2,7 +2,6 @@
module Provider
module ContractSourceHelper
- QA_PACT_BROKER_HOST = "http://localhost:9292/pacts"
PREFIX_PATHS = {
rake: {
ce: "../../contracts/project",
@@ -10,7 +9,7 @@ module Provider
},
spec: "../contracts/project"
}.freeze
- SUB_PATH_REGEX = %r{project/(?<file_path>.*?)_helper.rb}.freeze
+ SUB_PATH_REGEX = %r{project/(?<file_path>.*?)_helper.rb}
class << self
def contract_location(requester:, file_path:, edition: :ce)
@@ -26,7 +25,7 @@ module Provider
provider_url = "provider/#{construct_provider_url_path(file_path)}"
consumer_url = "consumer/#{construct_consumer_url_path(file_path)}"
- "#{QA_PACT_BROKER_HOST}/#{provider_url}/#{consumer_url}/latest"
+ "#{ENV['QA_PACT_BROKER_HOST']}/pacts/#{provider_url}/#{consumer_url}/latest"
end
def construct_provider_url_path(file_path)
diff --git a/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb b/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb
index 27a455adeb2..18da71e0601 100644
--- a/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb
+++ b/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb
@@ -54,8 +54,12 @@ RSpec.describe Provider::ContractSourceHelper, feature_category: :shared do
end
describe '#pact_broker_url' do
+ before do
+ stub_env('QA_PACT_BROKER_HOST', 'http://localhost')
+ end
+
it 'returns the full url to the contract that the provider test is verifying' do
- contract_url_path = "http://localhost:9292/pacts/provider/" \
+ contract_url_path = "http://localhost/pacts/provider/" \
"#{provider_url_path}/consumer/#{consumer_url_path}/latest"
expect(subject.pact_broker_url(split_pact_helper_path)).to eq(contract_url_path)
diff --git a/spec/contracts/publish-contracts.sh b/spec/contracts/publish-contracts.sh
index 8b9d4b6ecc6..b50ba9afae8 100644
--- a/spec/contracts/publish-contracts.sh
+++ b/spec/contracts/publish-contracts.sh
@@ -1,6 +1,5 @@
LATEST_SHA=$(git rev-parse HEAD)
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
-BROKER_BASE_URL="http://localhost:9292"
cd "${0%/*}" || exit 1
@@ -18,7 +17,7 @@ function publish_contract () {
for contract in $CONTRACTS
do
printf "\e[32mPublishing %s...\033[0m\n" "$contract"
- pact-broker publish "$contract" --consumer-app-version "$LATEST_SHA" --branch "$GIT_BRANCH" --broker-base-url "$BROKER_BASE_URL" --output json
+ pact-broker publish "$contract" --consumer-app-version "$LATEST_SHA" --branch "$GIT_BRANCH" --broker-base-url "$QA_PACT_BROKER_HOST" --output json
done
if [ ${ERROR} = 1 ]; then