diff --git a/src/pact_verifier.erl b/src/pact_verifier.erl index a2d8041..f552e34 100644 --- a/src/pact_verifier.erl +++ b/src/pact_verifier.erl @@ -202,13 +202,6 @@ verify_pacts(VerifierRef, ProviderOpts, ProviderPortDetails) -> {Output, _OutputLog} = pact_utils:run_executable_async( EscriptPath ++ " pactffi_nif verify_file_pacts " ++ ArgsString ), - case Protocol of - <<"message">> -> - pact_verifier:stop(HttpPid), - stop_verifier(VerifierRef); - _ -> - stop_verifier(VerifierRef) - end, Output end, Output2 = @@ -256,15 +249,15 @@ verify_pacts(VerifierRef, ProviderOpts, ProviderPortDetails) -> {Output3, _OutputLog3} = pact_utils:run_executable_async( EscriptPath ++ " pactffi_nif verify_broker_pacts " ++ ArgsString1 ), - case Protocol of - <<"message">> -> - pact_verifier:stop(HttpPid), - stop_verifier(VerifierRef); - _ -> - stop_verifier(VerifierRef) - end, Output3 end, + case Protocol of + <<"message">> -> + pact_verifier:stop(HttpPid), + stop_verifier(VerifierRef); + _ -> + stop_verifier(VerifierRef) + end, combine_return_codes(Output1, Output2). combine_return_codes(0, 0) -> 0; diff --git a/test/http_end_to_end_SUITE.erl b/test/http_end_to_end_SUITE.erl index b4ba9fd..be923e8 100644 --- a/test/http_end_to_end_SUITE.erl +++ b/test/http_end_to_end_SUITE.erl @@ -195,6 +195,13 @@ verify_producer(_Config) -> FilePath = <<"./pacts">>, Protocol = <<"http">>, StateChangePath = list_to_binary("http://localhost:" ++ integer_to_list(Port) ++ "/pactStateChange"), + BrokerOpts = #{ + broker_url => <<"http://localhost:9292/">>, + broker_username => <<"pact_workshop">>, + broker_password => <<"pact_workshop">>, + enable_pending => 1, + consumer_version_selectors => thoas:encode(#{}) + }, ProviderOpts = #{ name => Name, version => Version, @@ -203,13 +210,7 @@ verify_producer(_Config) -> port => Port, base_url => Path, branch => Branch, - pact_source_opts => #{ - broker_url => <<"http://localhost:9292/">>, - broker_username => <<"pact_workshop">>, - broker_password => <<"pact_workshop">>, - enable_pending => 1, - consumer_version_selectors => thoas:encode(#{}) - }, + pact_source_opts => BrokerOpts, state_change_url => StateChangePath, % message_providers => #{ % <<"a weather data message">> => {message_pact_SUITE, generate_message, [23.5, 20, 75.0]} @@ -222,6 +223,10 @@ verify_producer(_Config) -> ProviderOpts1 = ProviderOpts#{pact_source_opts => #{file_path => FilePath}}, {ok, VerifierRef1} = pact_verifier:start_verifier(Name, ProviderOpts1), Output1 = pact_verifier:verify(VerifierRef1), + ProviderOpts2 = ProviderOpts#{pact_source_opts => maps:put(file_path, FilePath, BrokerOpts)}, + {ok, VerifierRef2} = pact_verifier:start_verifier(Name, ProviderOpts2), + Output2 = pact_verifier:verify(VerifierRef2), ?assertEqual(0, Output1), ?assertEqual(0, Output), + ?assertEqual(0, Output2), animal_service:stop(HttpdPid).