diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 476979a..477ccb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index 538475d..c264d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/sbmt/pact/consumer/grpc_interaction_builder.rb b/lib/sbmt/pact/consumer/grpc_interaction_builder.rb index f28a429..a8f081f 100644 --- a/lib/sbmt/pact/consumer/grpc_interaction_builder.rb +++ b/lib/sbmt/pact/consumer/grpc_interaction_builder.rb @@ -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 diff --git a/lib/sbmt/pact/provider/http_server.rb b/lib/sbmt/pact/provider/http_server.rb index 001b9b9..6d59767 100644 --- a/lib/sbmt/pact/provider/http_server.rb +++ b/lib/sbmt/pact/provider/http_server.rb @@ -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 diff --git a/lib/sbmt/pact/version.rb b/lib/sbmt/pact/version.rb index 0fcb6e9..acf64e4 100644 --- a/lib/sbmt/pact/version.rb +++ b/lib/sbmt/pact/version.rb @@ -2,6 +2,6 @@ module Sbmt module Pact - VERSION = "0.12.0" + VERSION = "0.12.1" end end diff --git a/spec/pact/providers/sbmt-pact-test-app/grpc_client_spec.rb b/spec/pact/providers/sbmt-pact-test-app/grpc_client_spec.rb index de0471c..48bc0e4 100644 --- a/spec/pact/providers/sbmt-pact-test-app/grpc_client_spec.rb +++ b/spec/pact/providers/sbmt-pact-test-app/grpc_client_spec.rb @@ -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 diff --git a/spec/pact/providers/sbmt-pact-test-app/http_client_spec.rb b/spec/pact/providers/sbmt-pact-test-app/http_client_spec.rb index 715faaa..f11e808 100644 --- a/spec/pact/providers/sbmt-pact-test-app/http_client_spec.rb +++ b/spec/pact/providers/sbmt-pact-test-app/http_client_spec.rb @@ -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| diff --git a/spec/sbmt/pact/provider/gruf_server_spec.rb b/spec/sbmt/pact/provider/gruf_server_spec.rb index 15e77c0..58164a8 100644 --- a/spec/sbmt/pact/provider/gruf_server_spec.rb +++ b/spec/sbmt/pact/provider/gruf_server_spec.rb @@ -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 diff --git a/spec/sbmt/pact/provider/provider_server_runner_spec.rb b/spec/sbmt/pact/provider/provider_server_runner_spec.rb index acaffcf..9178895 100644 --- a/spec/sbmt/pact/provider/provider_server_runner_spec.rb +++ b/spec/sbmt/pact/provider/provider_server_runner_spec.rb @@ -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