Loading Dockerfile +2 −1 Original line number Diff line number Diff line FROM python:3.9-slim RUN apt-get -yqq update && apt-get -yqq upgrade && \ apt-get -yqq install vim apt-get -yqq install vim && apt-get -yqq install postgresql-client COPY src/ tmp/src Loading @@ -11,4 +11,5 @@ RUN set -eux && pip install --upgrade pip && \ COPY ./test/test.py /test/test.py CMD ['sh', 'tail', '-f', '/dev/null'] docker-compose.test.yaml +5 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ services: - ./test/:/test/ environment: - DATABASE_HOST=postgres - DATABASE_DB=postgres - DATABASE_PORT=5432 - DATABASE_USER=postgres - DATABASE_PW=postgres - DATABASE_TIMEOUT=60 - DATABASE_LOG_FILE=test.log - DATABASE_LOG_MODE=w Loading @@ -17,7 +21,7 @@ services: - postgres postgres: image: postgres image: postgres:14.0 environment: - POSTGRES_PASSWORD=postgres - POSTGRES_USER=postgres Loading docker-compose.yaml +4 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ services: - ./src/:/tmp/src environment: - DATABASE_HOST=postgres - DATABASE_DB=postgres - DATABASE_PORT=5432 - DATABASE_USER=postgres - DATABASE_PW=postgres - DATABASE_TIMEOUT=60 command: - 'tail' Loading test/test.py +7 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ """Unit test common functionality.""" import unittest import os import subprocess from common.database import Database from common.mixins.postgres import PostgresMixin from common.logz import create_logger Loading @@ -24,6 +25,12 @@ class PostgresTestCase(unittest.TestCase): print(data_base.query("SELECT * FROM test_table")) class DBConnTestCase(unittest.TestCase): def test_connection(self): status_run = subprocess.call('test-db-conn') print(status_run) self.assertTrue(status_run==0) class LogzTestCase(unittest.TestCase): """ LogzTestCase: Loading Loading
Dockerfile +2 −1 Original line number Diff line number Diff line FROM python:3.9-slim RUN apt-get -yqq update && apt-get -yqq upgrade && \ apt-get -yqq install vim apt-get -yqq install vim && apt-get -yqq install postgresql-client COPY src/ tmp/src Loading @@ -11,4 +11,5 @@ RUN set -eux && pip install --upgrade pip && \ COPY ./test/test.py /test/test.py CMD ['sh', 'tail', '-f', '/dev/null']
docker-compose.test.yaml +5 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ services: - ./test/:/test/ environment: - DATABASE_HOST=postgres - DATABASE_DB=postgres - DATABASE_PORT=5432 - DATABASE_USER=postgres - DATABASE_PW=postgres - DATABASE_TIMEOUT=60 - DATABASE_LOG_FILE=test.log - DATABASE_LOG_MODE=w Loading @@ -17,7 +21,7 @@ services: - postgres postgres: image: postgres image: postgres:14.0 environment: - POSTGRES_PASSWORD=postgres - POSTGRES_USER=postgres Loading
docker-compose.yaml +4 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ services: - ./src/:/tmp/src environment: - DATABASE_HOST=postgres - DATABASE_DB=postgres - DATABASE_PORT=5432 - DATABASE_USER=postgres - DATABASE_PW=postgres - DATABASE_TIMEOUT=60 command: - 'tail' Loading
test/test.py +7 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ """Unit test common functionality.""" import unittest import os import subprocess from common.database import Database from common.mixins.postgres import PostgresMixin from common.logz import create_logger Loading @@ -24,6 +25,12 @@ class PostgresTestCase(unittest.TestCase): print(data_base.query("SELECT * FROM test_table")) class DBConnTestCase(unittest.TestCase): def test_connection(self): status_run = subprocess.call('test-db-conn') print(status_run) self.assertTrue(status_run==0) class LogzTestCase(unittest.TestCase): """ LogzTestCase: Loading