Hello, I have an issue with my first setup and ne...
# pact-php
r
Hello, I have an issue with my first setup and need your help, please.
Failed to make connection to Mock Server in 10 attempts.
See details in the thread.
When I run my tests I get the following output:
Copy code
server.debug: start background command: .../vendor/pact-foundation/pact-php/src/PhpPact/Standalone/Installer/../../../../pact/bin/pact-mock-service service --consumer='myConsumer' --provider='myProvider' --pact-dir='.../tests/_data/pact' --pact-file-write-mode=overwrite --host=localhost --port=7201 --cors=true [] []
[2022-08-03T08:50:26.030467+00:00] server.debug: started process pid=48193

There was 1 error:


---------
1) ContractTest: Connect an app
 Test  Contract/ContractTest.php:testConnectAnApp

  [PhpPact\Standalone\Exception\HealthCheckFailedException] Failed to make connection to Mock Server in 10 attempts.

#1  .../vendor/pact-foundation/pact-php/src/PhpPact/Standalone/MockService/MockServer.php:168
#2  .../vendor/pact-foundation/pact-php/src/PhpPact/Standalone/MockService/MockServer.php:65
#3  .../tests/Contract/ContractTest.php:74
#4  .../vendor/bin/codecept:117
I’m also unable to start the
pact-mock-service
with
vendor/pact-foundation/pact-php/pact/bin/pact-mock-service service --consumer='myConsumer' --provider='myProvider' --pact-dir='.../tests/_data/pact' --pact-file-write-mode=overwrite --host=localhost --port=7201 --cors=true
there I get
Copy code
.../vendor/pact-foundation/pact-php/pact/lib/ruby/bin/ruby: line 6: .../vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby: cannot execute binary file
.../vendor/pact-foundation/pact-php/pact/lib/ruby/bin/ruby: line 6: .../vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby: Undefined error: 0
What do I miss here? Do you need any other information?
m
What OS and runtime are you on? Is this in docker by any chance?
r
I’m on a Mac and not running docker but I could run the project in docker
🤔 1
m
Are you on an M1? And if so, have you tried running on Rosetta mode?
r
No, I’m not on an M1, I have a 2,6 GHz 6-Core Intel Core i7
m
Can you please run the following commands (please replace the … with the correct prefix):
Copy code
file .../vendor/pact-foundation/pact-php/pact/lib/ruby/bin/ruby
file .../vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby:
r
The first one gives me
Copy code
vendor/pact-foundation/pact-php/pact/lib/ruby/bin/ruby: line 6: .../vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby: cannot execute binary file
vendor/pact-foundation/pact-php/pact/lib/ruby/bin/ruby: line 6: .../vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby: Undefined error: 0
The second one
zsh: exec format error: vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby
m
did you run the
file
command or just try to execute it?
r
just execute it
m
Can you please run with the
file
command prefix as above?
Also, once that has completed, could you please try installing that package manually (see https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.89.02-rc1, which is what Pact PHP should bootstrap under the hood)
r
1.
vendor/pact-foundation/pact-php/pact/lib/ruby/bin/ruby: Bourne-Again shell script text executable, ASCII text
2.
vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, stripped
I’ll install the package manually and try it out as soon as I can.
m
ok that looks to be the issue. For some reason, it’s downloaded a linux 64 bit binary
is there anything in the instnall logs indicatinsg why that might be?
r
Do you know where I can find the logs?
m
I don’t know PHP, but presumably when you install packages there is some log out
how did you install the package?
r
But that might already help me debug the whole thing. Maybe I can see where the installation happens.
👍 1
I installed via composer and run the tests, AFAIK the download will happen the first time when you run the tests. I’ll check. Thank you for your support. If I’m stuck again I’ll drop a message here.
m
cool, no problem!
Good luck 👍
r
@Matt (pactflow.io / pact-js / pact-go) I had to switch to docker now and I’m facing a new issue. We are running on alpine and I get issues like
Error relocating /data/vendor/pact-foundation/pact-php/pact/lib/ruby/bin.real/ruby: backtrace: symbol not found
A colleague said that the standalone executables are built for x86_64 with glibc and not with musl. Can you point me to something that helps me get it run in docker alpine? How will the PHP package then know which executables to use when the ones downloaded do not work?
m
The version you have should be able to work on Alpine docker. But that error doesn’t look familiar