I’m very confused looking at this foundationdb/fdbcli_tests.py at e2fa51103696d9f40cd554c82d894c694cef4ade · apple/foundationdb · GitHub
On line 211 it seems to be trying to get the pid of the fdbserver
, but then it on line 215 it tries to match the pid against the port.
How the heck is that ever suppose to work? From what I can tell this test isn’t setting a port and its being randomly generated here foundationdb/local_cluster.py at e2fa51103696d9f40cd554c82d894c694cef4ade · apple/foundationdb · GitHub
Is it expected that there is some magic that forces fdbserver
use a specific pid during the test?
If that is indeed the case, it doesn’t seem to be working on macos 11.6 x86 as these test are failing when i run ctest --output-on-failure -v
:
The following tests FAILED:
10 - single_process_fdbcli_tests (Failed)
12 - single_process_external_client_fdbcli_tests (Failed)
I dumped the pid and port from the test and they do not match.
What am I missing here? Are the tests not functional on macos?
The code at line 211 is trying to get the process info of all fdbserver process.
We will get all fdbserver
processes’ info from here.
Then line 215 we do filtering by using the port number to only get the fdbserver process info of the process in the cluster. So on line 215 we are not matching but filtering.
And for the context here, the test is for suspend
command where the process is suspended for the specified time and then restart.
The test logic here is after running suspend
we check the cluster does not have response but the pid
of the process still exists. That’s the reason why we want to have the pid
info here.
That doesn’t make sense. Here’s what the values I saw for pinfos
and port
pinfos = ['5678']
port = '1234'
pinfo = list(filter(lambda x: port in x, pinfos))
print(pinfo) // prints []
as you can see pinfos
has a pid of a single fdbserver
and pinfo
will always be empty in this case, failing the assert on line 216
As you said you are running on macOS,
I think it’s the difference of pgrep -a
where on linux it will give the full command line with the port number in it.
I am not sure about its behavior on macOS which I guess like you posted it only gives the pid.
The test is used in the github CI where it’s running the docker environment so I never tested it on macOS.
I see. Using ubunutu pgrep
does behave differently than on macos
ubuntu:
$ pgrep -a node
9 node --optimize-for-size --gc-interval=100000 --always-compact --enable-source-maps /cocalc/nvm/versions/node/v14.17.4/lib/node_modules/@cocalc/project/bin/cocalc-project.js --hub-port 6000 --browser-port 6001 --kucalc --hostname=0.0.0.0
macos:
$ pgrep -a node
9