crash icon indicating copy to clipboard operation
crash copied to clipboard

Problem invoking the test suite on macOS

Open amotl opened this issue 5 years ago • 7 comments

Hi there,

within #342, I found that I haven't been able to invoke the test suite right away. In order to find out about more details, I tried again and would like to report the outcome here.

While I believe the process hasn't been able to download CrateDB 4.2.0 on the first try, now I am seeing:

$ python -m unittest -vvvvv

[...] some OKs

HTTP: http://127.0.0.1:44209
./var/folders/06/w9pzygdj7vx53n_0l9q_lhph0000gn/T/tmp2k7qhukz/crate-4.2.0/bin/crate: line 129: /var/folders/06/w9pzygdj7vx53n_0l9q_lhph0000gn/T/tmp2k7qhukz/crate-4.2.0/jdk/Contents/Home/bin/java: No such file or directory
/var/folders/06/w9pzygdj7vx53n_0l9q_lhph0000gn/T/tmp2k7qhukz/crate-4.2.0/bin/crate: line 129: exec: /var/folders/06/w9pzygdj7vx53n_0l9q_lhph0000gn/T/tmp2k7qhukz/crate-4.2.0/jdk/Contents/Home/bin/java: cannot execute: No such file or directory

[...] some more OKs

ERROR: setUpModule (tests.test_integration)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/amo/dev/crate/sources/crash/tests/test_integration.py", line 46, in setUpModule
    node.start()
  File "/Users/amo/dev/crate/sources/crash/.venv/lib/python3.8/site-packages/crate/testing/layer.py", line 316, in start
    self._wait_for_start()
  File "/Users/amo/dev/crate/sources/crash/.venv/lib/python3.8/site-packages/crate/testing/layer.py", line 373, in _wait_for_start
    self._wait_for(validator)
  File "/Users/amo/dev/crate/sources/crash/.venv/lib/python3.8/site-packages/crate/testing/layer.py", line 352, in _wait_for
    raise SystemError('Failed to start Crate instance in time.')
SystemError: Failed to start Crate instance in time.

It is probably just a minor issue. I am working on macOS and invoked that within a dedicated virtualenv after installing the package into it with

pip install -U -e ".[test]"

With kind regards, Andreas.

amotl avatar Oct 19 '20 09:10 amotl

This is because of the test layer https://github.com/crate/crash/blob/master/tests/test_integration.py#L39 loading the linux CrateDB tarball.

Either we have to adapt that to use a system specific URL (See https://crate.io/releases.json for the urls) or we could consider using cr8 in the test layer which contains logic to resolve the right URL.

mfussenegger avatar Oct 19 '20 09:10 mfussenegger

we could consider using cr8 in the test layer

Sounds good. So, shall this be implemented using an alternative factory method for creating a CrateLayer besides CrateLayer.from_uri(...) like CrateLayer.from_version(...)?

amotl avatar Oct 19 '20 10:10 amotl

we could consider using cr8 in the test layer

Sounds good. So, shall this be implemented using an alternative factory method for creating a CrateLayer besides CrateLayer.from_uri(...) like CrateLayer.from_version(...)?

https://github.com/mfussenegger/cr8/blob/8ec6f3b144f33f2d325f3fe2b2bc364e6f9dc540/cr8/run_crate.py#L688-L695 is almost a drop-in replacement.

mfussenegger avatar Oct 19 '20 10:10 mfussenegger

create_node() is almost a drop-in replacement.

Thanks. So let's just wrap that into / invoke from a new CrateLayer.from_version()?

amotl avatar Oct 19 '20 12:10 amotl

create_node() is almost a drop-in replacement.

Thanks. So let's just wrap that into / invoke from a new CrateLayer.from_version()?

CrateLayer is from crate-python. I'd replace the whole CrateLayer.from_version with create_node from cr8.

mfussenegger avatar Oct 19 '20 12:10 mfussenegger

So, the test suite of crate-python would also only work on Linux then? I thought about letting the tower of turtles stand like it is and just swapping out one for another.

In other words: Wouldn't it also be good for crate-python to have the possibility there in order to be able to invoke its test suite on other systems than Linux?

amotl avatar Oct 19 '20 12:10 amotl

Coming back from a short out-of-band discussion with @mfussenegger we decided to bring the already solid integration layer from cr8 to both crash and crate-python within one of the next iterations. See also [1,2].

[1] https://github.com/mfussenegger/cr8/blob/0.20.1/cr8/run_crate.py [2] https://github.com/mfussenegger/cr8/blob/0.20.1/tests/test_integration.py

amotl avatar Oct 19 '20 15:10 amotl