-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't run consumer tests via command line on remote server #233
Comments
Yeah I'm not too sure what's going on. It could be something to do with permission of the user running the tests? Can you try elevating the user permissions? Seems like the mock server cannot start for some reason. |
Is the mock service bound to 0.0.0.0 or localhost? |
Hi, I've coded it to run on localhost like=> http://localhost:9222 |
Hi, I've tried running the tests via powershell admin and get the same sort errors, additionally I'm logged onto the server using an admin account but I'll play around the permissions to see if I can get them running. |
Could you try starting up on of these one line servers on your remote host, and see if you can make a windows-equivalent-of-curl request to it? |
Hi Beth, I was able to create a small server using node running port 8000 to display a simple web page. So what does this mean for my pact tests? Thanks, |
It means that you have enough permissions to start a service on a port 8000 (so presumably 9222 is also fine), and you're not blocked from contacting that service by anything internally. Were you able to access that web page from a shell within the remote host? So, I guess there are a few possibilities.
Can you think of some experiments to try and work out which of these (or any other) is likely? Eg. if the mock service is starting, then you should see some logs somewhere. One approach might be to download the mock service from https://github.com/pact-foundation/pact-ruby-standalone/releases and start it up manually on the remote host on port 9222 and then see if you can make an HTTP request to it. |
@bethesque @neilcampbell i'm also getting the same issue. I'm able to start up other web servers including Kestrel and they work fine, but for some reason the mock server doesn't start when running on Windows 10 in a .NET Core 3.1 project. I get the same exception as @billysoomro. I've disabling the firewall as well but to no avail. It works using the Pactnet.Linux and Pactnet.OSX providers on their respected OS's, just not on Windows using Pactnet.Windows. I've also ensured I have long file path supported enabled, as the file paths are over the 260 default limit. I've tried running fiddler and I see the request being made but the server isn't responding and I cannot access it myself, nor see the started HTTP server log line for it, so i'm sure it's not getting started. As per above, I've downloaded the standalone server and it starts successfully using the bat file and responds to requests. Any help you could provide would be appreciated! |
@bethesque @neilcampbell I've been able to replicate the issue with the samples in this project. If you update sample projects in this repo to netcoreapp3.1 they then fail with the same issues as being described. Hopefully this is useful information to work off. Here's the stack trace from one of the sample tests that fail when using dotnet core 3.1.
|
I'm having the same issue as @AshleyPoole. Noticed windows devs were struggling and having replicated his steps with the samples am having the same issue. |
Hello, I'm trying to run consumer on OSX. It has the same issue. Looks like the mock service isn't running. ./pact-mock-service --help start And it responds with:
Here is the <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\consumer.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="PactNet.OSX" Version="2.5.4" />
<PackageReference Include="PactNet.Windows" Version="2.5.4" />
<PackageReference Include="PactNet.Linux.x86" Version="2.5.4" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
</Project> I've used the https://github.com/tdshipley/pact-workshop-dotnet-core-v1. Just replaced Is it something with standalone ruby binaries? e.g. pact-foundation/pact-ruby-standalone#37 ? I've tried to install on OSX latest https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.85.0 ./pact-mock-service --help start
/.../pact/pact/lib/ruby/bin/ruby: line 14: D/pact/pact/lib/ruby/lib/ruby/gems/2.2.0: No such file or directory Local ruby version is (if it matters): ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] UPD: Bumping ruby version to the latest UPD: Added corresponding issue for standalone ruby pact: pact-foundation/pact-ruby-standalone#54 UPD: The same issue is applicable for https://github.com/bethesque/pact-net-e2e-example |
Is there any solution on this issue yet, I am currently experiencing the same. |
I have been able to go around the issue by manually installing and starting up the pact mock service via https://github.com/pact-foundation/pact-mock_service:
When running the tests, and connecting the MockServer to localhost:9222, I no longer receive the HttpRequestExceptions, and my pacts are being build correctly. |
Glad you got this sorted 👍 |
Hi,
I can run my pact consumer tests via command line locally but I can't seem to run the same command on my remote server and keep getting the following error:
**The connection to 'localhost' failed.
Error: ConnectionRefused (0x274d).
System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:9222
Stack Trace:
at PactNet.Mocks.MockHttpService.AdminHttpClient.SendAdminHttpRequest[T](HttpVerb method, String path, T requestContent, IDictionary`2 headers) in C:\projects\pact-net\PactNet\Mocks\MockHttpService\AdminHttpClient.cs:line 80
at PactNet.Mocks.MockHttpService.MockProviderService.SendAdminHttpRequest(HttpVerb method, String path) in C:\projects\pact-net\PactNet\Mocks\MockHttpService\MockProviderService.cs:line 130
at PactNet.PactBuilder.Build() in C:\projects\pact-net\PactNet\PactBuilder.cs:line 115
----- Inner Stack Trace -----
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask
1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask
1.get_Result()at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask
1 creationTask) at System.Threading.Tasks.ValueTask
1.get_Result()at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
----- Inner Stack Trace -----
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)**
There are no firewall or anti-virus rules preventing the app as far as I can see, I've even opened up the port in question via inbound and outbound firewall rules but to no avail. The app is simply not able to open a port (9222 or any other port number I specify) for some reason to start making http requests to the mock provider client to create pact files.
Is there anything else that could be preventing these tests from running?
Thanks,
Billy
The text was updated successfully, but these errors were encountered: