cuplv / biggroum

Top-level project for the graph extraction
Apache License 2.0
8 stars 2 forks source link

Test musedev docker #60

Closed ftc closed 4 years ago

ftc commented 4 years ago

Scripts to test the fixr api in the musedev docker container.

smover commented 4 years ago

@ftc can you test the finalize method?

A test case is the following, you can use it with docker as you are calling the "version" endpoint:

$ BASEPATH=`pwd`/test/data && sed "s:REPOPATH:${BASEPATH}:" test/data/finalize_input.json  | ./biggroumcheck.sh /Users/sergiomover/works/projects/muse/repos/biggroum/python/fixrgraph/musedev/test/data 04f68b69a6f9fa254661b481a757fa1c834b52e1 finalize

You need to unzip the AwesomeApp.zip file in /Users/sergiomover/works/projects/muse/repos/biggroum/python/fixrgraph/musedev/test/data before (add this step to the test script).

You need to run the search service to make it work.

Run the services:

# docker-compose up

The other issue is to reach the search service from the musedev docker container. You can either play with the docker compose file or running the musedev docker container telling how to reach the host system (never done that but it should be possible https://forums.docker.com/t/accessing-host-machine-from-within-docker-container/14248/11)

smover commented 4 years ago

The changes to the biggroumscript.sh breaks the tests in python/fixrgraph/musedev/test.

We were testing that the bash script was calling the python script correctly, but now the bash script became "path dependent" (e.g., biggroumsetup/biggroum and /root/biggroumsetup) and without a way to skip the setup process (we cannot test the script on mac anymore for example, because path are hardcoded and the update-alternative command that is always called).

The comment Note: Environment variable to determine run was difficult. docker does not run .bashrc on shell start, sourcing .bashrc in script also failed does not really explain why we switched from environment variables (which are quite easy to set when invoking the script, for local testing) to files, it just motivates a workaround.

Why does sourcing .bashrc file does not work? That seems to break the behavior of bash, while it should not be the case.

Here my main complaints:

You have the same issues for the other environment variables you keep setting:

export GRAPH_EXTRACTOR_PATH="${HOME}/biggroumsetup/fixrgraphextractor_2.12-0.1.0-one-jar.jar" >>setup_log 2>&1 && \
export PYTHONPATH="${HOME}/biggroumsetup/biggroum/python:$PYTHONPATH"  >>setup_log 2>&1

They were inside the setup first, under the assumption that the container was created fresh at every run. I would just export those environment variables in the setup and export them in the bashrc (and execute the bashrc every time), so we do not lose them and we can test the script locally.

I would also not change directory before invoking the biggroumscript.py, and I would use an environment variable telling where is the biggroum repository:

${BIGGROUMREPO}/python/fixrgraph/musedev/biggroumscript.py`
smover commented 4 years ago

@ftc can you take a look at the readme file explaining how to test the API: https://github.com/cuplv/biggroum/blob/test_musedev_docker/python/fixrgraph/musedev/README.md

There are some TODOs to be completed there (ignore the one about configuring the .muse.tml file). The others are: missing address for the search server missing test cases (for talk and reaction --- look at the python ones to get the input/output) missing commands to manually run the container