Skip to content

Commit

Permalink
Merge branch 'fix/DEX-2785/localhost' into 'master'
Browse files Browse the repository at this point in the history
[DEX-2785] fix: change localhost to 127.0.0.1 for http provider tests

Closes DEX-2785

See merge request nstmrt/rubygems/sbmt-pact!19
  • Loading branch information
Сатаров Юрий Сергеевич committed Dec 17, 2024
2 parents 14255f3 + e92bde8 commit 3cabbab
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 6 deletions.
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,24 @@ tests:
variables:
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: postgres://postgres:secret@postgres:5432
PACT_DO_NOT_TRACK: true
parallel:
matrix:
- RUBY_VERSION: ['2.7', '3.0', '3.1', '3.2', '3.3']
before_script:
- |
https_proxy=${INTERNAL_WEB_PROXY} curl -LO https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v0.0.0/pact-plugin-cli-linux-x86_64.gz && \
gunzip pact-plugin-cli-linux-x86_64.gz && \
chmod +x pact-plugin-cli-linux-x86_64 && \
mv pact-plugin-cli-linux-x86_64 /usr/local/bin/pact-plugin-cli && \
https_proxy=${INTERNAL_WEB_PROXY} pact-plugin-cli -y install https://github.com/pactflow/pact-protobuf-plugin/releases/tag/v-0.4.0
- |
https_proxy=${INTERNAL_WEB_PROXY} curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip && \
unzip protoc-21.12-linux-x86_64.zip -d protoc && \
chmod +x protoc/bin/protoc && \
mv protoc/bin/protoc /usr/local/bin/protoc
- gem sources --remove https://rubygems.org/
- gem sources --add ${RUBYGEMS_PUBLIC_SOURCE}
- gem install bundler -v 2.4.22
- bin/setup
script:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

## [0.12.1] - 2024-12-12

### Changed
- replaced localhost to 127.0.0.1 for provider tests

## [0.12.0] - 2024-09-11

# Changed
- remove internal deps

## [0.11.1] - 2024-08-22

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions lib/sbmt/pact/consumer/grpc_interaction_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class GrpcInteractionBuilder
CONTENT_TYPE = "application/protobuf"
GRPC_CONTENT_TYPE = "application/grpc"
PROTOBUF_PLUGIN_NAME = "protobuf"

# see .gitlab-ci.yml before changing plugin version
PROTOBUF_PLUGIN_VERSION = "0.4.0"

class PluginInitError < Sbmt::Pact::FfiError; end
Expand Down
2 changes: 1 addition & 1 deletion lib/sbmt/pact/provider/http_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(options = {})

@server_pid = nil

@host = @options[:host] || "localhost"
@host = @options[:host] || "127.0.0.1"
@logger = @options[:logger] || ::Logger.new($stdout)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/sbmt/pact/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Sbmt
module Pact
VERSION = "0.12.0"
VERSION = "0.12.1"
end
end
2 changes: 1 addition & 1 deletion spec/pact/providers/sbmt-pact-test-app/grpc_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

let(:pet_id) { 123 }

let(:api) { ::PetStore::Grpc::PetStore::V1::Pets::Stub.new("localhost:3009", :this_channel_is_insecure) }
let(:api) { ::PetStore::Grpc::PetStore::V1::Pets::Stub.new("127.0.0.1:3009", :this_channel_is_insecure) }
let(:make_request) { api.pet_by_id(PetStore::Grpc::PetStore::V1::PetByIdRequest.new(id: pet_id)) }

let(:interaction) do
Expand Down
2 changes: 1 addition & 1 deletion spec/pact/providers/sbmt-pact-test-app/http_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
has_http_pact_between "sbmt-pact-test-app", "sbmt-pact-test-app"

let(:pet_id) { 123 }
let(:host) { "localhost:3000" }
let(:host) { "127.0.0.1:3000" }
let(:interaction) { new_interaction }
let(:http_client) do
Faraday.new do |conn|
Expand Down
2 changes: 1 addition & 1 deletion spec/sbmt/pact/provider/gruf_server_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

describe Sbmt::Pact::Provider::GrufServer do
let(:api) { ::PetStore::Grpc::PetStore::V1::Pets::Stub.new("localhost:3009", :this_channel_is_insecure) }
let(:api) { ::PetStore::Grpc::PetStore::V1::Pets::Stub.new("127.0.0.1:3009", :this_channel_is_insecure) }
let(:call_rpc) do
subject.run { api.pet_by_id(PetStore::Grpc::PetStore::V1::PetByIdRequest.new(id: 1)) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/sbmt/pact/provider/provider_server_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end

let(:make_request) do
server.run { http_client.post("http://localhost:9001/setup-provider", request_body) }
server.run { http_client.post("http://127.0.0.1:9001/setup-provider", request_body) }
end

let(:server) do
Expand Down

0 comments on commit 3cabbab

Please sign in to comment.