Unit test log_experiment_data.py
Let's mock the interaction with the database at the level of returning a tuple as the database would
- the goal here is to confirm that the data is saved correctly to the file
We would like to create unit tests for https://github.com/kaizen-ai/kaizenflow/blob/a7952ef84cc2ebe93042ccc481486e6ef66ca292/im_v2/ccxt/db/log_experiment_data.py#L31
Steps:
- Create new file
im_v2/ccxt/db/test/test_log_experiment_data.py - You will have to mock the
load_db_datato return some artificial bid_ask data https://github.com/kaizen-ai/kaizenflow/blob/a7952ef84cc2ebe93042ccc481486e6ef66ca292/im_v2/common/data/client/im_raw_data_client.py#L182 - Load back the data and verify if it is done correctly.
FYI @samarth9008
Created a draft PR for review of task progress.
While trying to run the test and resolve the error for draft PR, I have been facing issues. I was following the code that raises the following error :-
im_v2/ccxt/db/test/test_log_experiment_data.py::TestLogExperimentData::test_log_experiment_data SKIPPED (Need docker children / sibling support and/or Run only if CK S3 is available)
Not sure why the check for macOS version is specified as Ventura and Monterey. But my mac is on latest version Sonoma(Version 14.4.1). Should I add it for my local to run the test and continue?
Continued to resolve above issue on my local. Facing a different issue while the configuration of child docker container.
ERROR im_v2/ccxt/db/test/test_log_experiment_data.py::TestLogExperimentData::test_log_experiment_data - RuntimeError: cmd='(sudo docker-compose --file /app/im_v2/devops/compose/docker-compose_4716.yml --env-file /app/im_v2/devops/env/local.im_db_config_4716.env up -d im_postgres4716) 2>&1' failed with rc='1'
Update :- Searched for docs and code to resolve the test run issue. Reached out to @sonaalKant for guidance on finding solution for the issue. Tried various hacks on local to run the test including environment and code modifications.
Found another issue with similar context #707 during search. Also, found a link for docker sibling container in docker how to guide given below and implemented it, but to no avail.
I guess you won't be able to proceed further, you can pause on this issue, will update you. Good job trying things out yourself though.
Can't be done on kaizen side, closing