From bddf5adb6a2a69f651961d5190b865587c21c289 Mon Sep 17 00:00:00 2001 From: ruslan33 Date: Sun, 8 Oct 2023 18:58:17 +0200 Subject: [PATCH] Django functional tests (#23) Django standalone functional tests --- .github/workflows/django_functional_tests.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/django_functional_tests.yml diff --git a/.github/workflows/django_functional_tests.yml b/.github/workflows/django_functional_tests.yml new file mode 100644 index 0000000..a2c231b --- /dev/null +++ b/.github/workflows/django_functional_tests.yml @@ -0,0 +1,54 @@ +name: Django CI + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + + services: + db: + image: postgres + env: + POSTGRES_DB: dbname + POSTGRES_USER: login + POSTGRES_PASSWORD: password + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - name: Install PostgreSQL Client + run: sudo apt-get install -y postgresql-client + - name: Test PostgreSQL Connection + run: psql "host=localhost user=login dbname=dbname password=password" + - uses: actions/checkout@v3 + with: + path: nopayloaddb + - name: Install Dependencies + run: | + cd nopayloaddb/ + pip install -r requirements.txt + - name: Change permissions of /var/log/ + run: sudo chmod a+w /var/log/ + #- name: Wait for PostgreSQL to become ready + # run: until pg_isready -h localhost -p 5432; do sleep 2; done + - name: Run Django + env: + POSTGRES_DB: dbname + POSTGRES_USER: login + POSTGRES_PASSWORD: password + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + run: | + cd nopayloaddb/ + python manage.py makemigrations cdb_rest && python manage.py migrate && python manage.py runserver 0.0.0.0:8000 & + - name: Access Django API + run: | + curl http://localhost:8000/api/cdb_rest/payloadiovs/?gtName=Test&majorIOV=0&minorIOV=0”