Repository: hynky1999/CmonCrawl (language: python)

Issue:
Improve docker entrypoint and add Readme how to use it
Title


Discussion / hints:

Fix patch:
diff --git a/Dockerfile b/Dockerfile
index e8476be5..b021cc39 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,8 +4,8 @@ WORKDIR /app
 COPY ./environment.yml .
 RUN conda env create --name myenv --file environment.yml
 COPY . .
-SHELL ["conda", "run", "-n", "myenv", "bin/bash", "-c"]
-ENTRYPOINT ["entrypoint.sh"]
+SHELL ["conda", "run", "-n", "myenv"]
+ENTRYPOINT ["./entrypoint.sh"]
 
 
 
diff --git a/README_docker.md b/README_docker.md
new file mode 100644
index 00000000..5091028c
--- /dev/null
+++ b/README_docker.md
@@ -0,0 +1,14 @@
+### How to run the docker image
+
+First of all make sure you have docker installed.
+Then you simply need to cd into the root folder and run the following command:
+`docker-compose up`
+
+The application will start up and by default it will run all tests that are definied. You can see output at command line(altough quite messy).
+
+If you want to abort it you can at any time by pressing Ctrl+C.
+
+### How to run specific tests
+
+You can run just single test_file by running the following command:
+`docker-compose run unittests test_file_name.py`
diff --git a/entrypoint.sh b/entrypoint.sh
old mode 100644
new mode 100755
index b02a7c89..3596103f
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,13 +1,13 @@
 #!/bin/bash
 # Currently we only support running tests
-TEST_NAME="*_tests.py"
+TEST_NAME="*tests*.py"
 if [[ $1 == *_tests.py ]]; then
     TEST_NAME="$1"
 fi
 
 
-echo "Runing tests"
-conda run --no-capture-output -n myenv python -m unittest discover -s tests -p "$TEST_NAME"
+echo "Runing tests:"
+conda run --no-capture-output -n myenv python -m unittest discover -s unit_tests -p "$TEST_NAME"
 
 
 


Test patch:
diff --git a/unit_tests/redis_tests.py b/unit_tests/redis_tests.py
index 7b2bbce2..b8c38b99 100644
--- a/unit_tests/redis_tests.py
+++ b/unit_tests/redis_tests.py
@@ -1,3 +1,4 @@
+from datetime import datetime
 import unittest
 from collections import deque
 from Aggregator.index_query import DomainRecord
@@ -15,10 +16,10 @@ async def asyncSetUp(self) -> None:
 
     async def test_process_and_forward(self):
 
-        record = DomainRecord("x", "idnes.cz", 0, 1)
+        record = DomainRecord("x", "idnes.cz", 0, 1, datetime.now())
         queue: DummyQueue[DomainRecord] = DummyQueue()
         await process_and_forward(self.redis_conn, queue, record)
         await process_and_forward(self.redis_conn, queue, record)
-        record2 = DomainRecord("x", "seznam.cz", 0, 1)
+        record2 = DomainRecord("x", "seznam.cz", 0, 1, datetime.now())
         await process_and_forward(self.redis_conn, queue, record2)
         self.assertEqual(queue.queue, deque([record2, record]))