Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOP-11711] Run tests in github actions #3

Merged
merged 124 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
9cc31ae
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 26, 2024
bbf1949
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 26, 2024
ea0866d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 26, 2024
844eb3d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 26, 2024
aeff3c6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 26, 2024
9c2e410
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 26, 2024
40f4642
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
aaf86c2
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
759cbe4
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
0723272
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
7f5daed
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
9ec4a4b
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
ac248d3
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
baf7e86
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
4901131
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
6a4012d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
1a0870b
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
09ac789
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
d8486ca
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
3afca7f
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
fb8299e
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
b0a8e64
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
2ff6fcd
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
114289d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
59928bd
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
fd778ce
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
502d7c5
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
d92b18c
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
835acf0
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
a20dd8a
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
6bac7ba
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
756a0ce
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
e8e4937
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
b72c58a
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
257bdd4
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
d560d87
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 27, 2024
ae33b7d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
1d7685b
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
4c7820e
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
dd67181
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
8117d14
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
2556359
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
2ec5172
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
3a802d5
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
dfc0316
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
c65c862
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
3e66726
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
0be74f6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
9023a9b
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
a2c1160
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
5c7d7e6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
51870c5
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
f6bf18c
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
51bcdd0
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
68b3ad1
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
4d9fe31
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
3f3ce37
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
a830d17
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
4b257a2
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
6cc55e4
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
67afef8
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
26a80f3
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
d02813a
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
359f555
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
652ce2e
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
15f9ada
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
476a760
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
458cb7f
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
56ebf55
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
6a0165e
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
c06b5b6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
a46473a
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
529fb5e
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 28, 2024
6b58257
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
4fe2516
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
c13f212
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
98942bd
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
fd906ee
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
bb480cd
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
6f84e0a
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
962c468
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
3aa0d6d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
8e0ce02
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
a8df922
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
a9f5157
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
eca6ace
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
1120622
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
b785aa0
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
086b312
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
3f65cf2
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
48332f0
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
96996aa
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
6629b4d
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
98e1699
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
491ba4b
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
e4c8a0f
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
3d78f18
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
4b8b5cb
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
07b7084
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
8c96f00
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
9433349
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
8ebe9d8
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
7fc39d6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
32e900b
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
8524689
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
394ed03
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
d0c48c1
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
7909d82
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
5aef182
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
07087c6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
7178a6f
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
cc23b4c
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
f84f882
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
edfd5ef
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
c8fd31e
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
077b17c
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
87b4196
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
de4b790
[DOP-11711] Run tests in github actions
dmitry-pedchenko Feb 29, 2024
6574823
[DOP-11711] Run tests in github actions
dmitry-pedchenko Mar 1, 2024
2ee3739
[DOP-11711] Run tests in github actions
dmitry-pedchenko Mar 1, 2024
0d7cec6
[DOP-11711] Run tests in github actions
dmitry-pedchenko Mar 1, 2024
649ed37
[DOP-11711] Run tests in github actions
dmitry-pedchenko Mar 1, 2024
7341593
[DOP-11711] Run tests in github actions
dmitry-pedchenko Mar 1, 2024
4f4b771
[DOP-11711] Run tests in github actions
dmitry-pedchenko Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .env.dev

This file was deleted.

2 changes: 1 addition & 1 deletion .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MINIO_ROOT_USER=syncmaster
MINIO_SECRET_KEY=a2b6ad842d16f47beaa077b0e50c217a3bded54c
MINIO_ROOT_PASSWORD=a2b6ad842d16f47beaa077b0e50c217a3bded54c

TEST_S3_HOST=s3
TEST_S3_HOST=test-s3
TEST_S3_PORT=9000
TEST_S3_ACCESS_KEY=syncmaster
TEST_S3_SECRET_KEY=a2b6ad842d16f47beaa077b0e50c217a3bded54c
Expand Down
53 changes: 53 additions & 0 deletions .env.github
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export TZ=UTC
dolfinus marked this conversation as resolved.
Show resolved Hide resolved

# Postgres
export POSTGRES_HOST=localhost
export POSTGRES_PORT=5432
export POSTGRES_DB=syncmaster
export POSTGRES_USER=user
export POSTGRES_PASSWORD=secret

# RabbitMQ
export RABBITMQ_HOST=localhost
export RABBITMQ_PORT=5672
export RABBITMQ_USER=guest
export RABBITMQ_PASSWORD=guest

# HDFS
export HDFS_HOST=localhost
export HDFS_WEBHDFS_PORT=9870
export HDFS_IPC_PORT=9820

# S3
export MINIO_ACCESS_KEY=syncmaster
export MINIO_ROOT_USER=syncmaster
export MINIO_SECRET_KEY=a2b6ad842d16f47beaa077b0e50c217a3bded54c
export MINIO_ROOT_PASSWORD=a2b6ad842d16f47beaa077b0e50c217a3bded54c

export TEST_S3_HOST=localhost
export TEST_S3_PORT=9010
export TEST_S3_ACCESS_KEY=syncmaster
export TEST_S3_SECRET_KEY=a2b6ad842d16f47beaa077b0e50c217a3bded54c
export TEST_S3_BUCKET=syncmaster

export TEST_POSTGRES_HOST=localhost
export TEST_POSTGRES_PORT=5433
export TEST_POSTGRES_USER=user
export TEST_POSTGRES_PASSWORD=secret
export TEST_POSTGRES_DB=syncmaster

export TEST_ORACLE_HOST=localhost
export TEST_ORACLE_PORT=1522
export TEST_ORACLE_USER=test_user
export TEST_ORACLE_PASSWORD=test_password
export TEST_ORACLE_SERVICE_NAME=XEPDB1

export TEST_HIVE_CLUSTER=test-hive
export TEST_HIVE_USER=hive_user
export TEST_HIVE_PASSWORD=hive_password

export ENV=LOCAL

export SPARK_CONF_DIR=./syncmaster/tests/spark/hive/conf/
export HADOOP_CONF_DIR=./syncmaster/tests/spark/hadoop/
export HIVE_CONF_DIR=./syncmaster/tests/spark/hive/conf/
79 changes: 79 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Tests
on:
push:
branches:
- develop
pull_request:
branches-ignore:
- master
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
DEFAULT_PYTHON: '3.11'

jobs:
tests:
name: Run unit tests (Python 3.11, Pydantic v1 on ubuntu-latest)
dolfinus marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
POETRY_VERSION: 1.6.1

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
dolfinus marked this conversation as resolved.
Show resolved Hide resolved

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1

- name: Install dependencies
run: |
poetry install --no-root --no-cache --with backend,dev,test
dolfinus marked this conversation as resolved.
Show resolved Hide resolved

- name: Start docker compose
run: |
docker compose -f docker-compose.test.yml down -v --remove-orphans
docker compose -f docker-compose.test.yml up -d db --wait --wait-timeout 200
env:
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster

- name: Run Unit Tests.
run: |
source .env.github
mkdir -p reports/
poetry run coverage run -m pytest -vvv -s ./syncmaster/tests/test_unit
env:
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster

- name: Run DB Tests.
run: |
source .env.github
mkdir -p reports/
poetry run coverage run -m pytest -vvv -s ./syncmaster/tests/test_database
env:
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster

- name: Shutdown
if: always()
run: |
docker compose -f docker-compose.test.yml down -v --remove-orphans
env:
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster
74 changes: 33 additions & 41 deletions docker-compose.yml → docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,14 @@ services:
db:
image: postgres:15
restart: unless-stopped
env_file: .env.dev
env_file: .env.docker
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- network

rabbitmq:
image: rabbitmq
restart: unless-stopped
ports:
- 5672:5672
networks:
- network

s3:
image: bitnami/minio:latest
container_name: s3
restart: unless-stopped
env_file: .env.docker
ports:
- 9010:9000
- 9011:9001
networks:
- network

worker:
image: syncmaster_worker
restart: unless-stopped
Expand All @@ -39,12 +20,13 @@ services:
network: host
networks:
- network
volumes:
- /mnt/.ivy2:/root/.ivy2
dolfinus marked this conversation as resolved.
Show resolved Hide resolved
env_file: .env.docker
command: [celery, -A, app.tasks.config.celery, worker, --loglevel=info, --max-tasks-per-child=1, -Q, test_queue]

backend:
image: syncmaster_back
restart: unless-stopped
container_name: backend
build:
dockerfile: docker/backend.dockerfile
context: .
Expand All @@ -56,31 +38,40 @@ services:
depends_on:
- db
- rabbitmq
- worker
- test-oracle
- test-postgres
- test-hive
environment:
POSTGRES_HOST: db
POSGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
- test-s3
volumes:
- /mnt/.ivy2:/root/.ivy2
env_file: .env.docker


RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: 5672
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
rabbitmq:
image: rabbitmq
restart: unless-stopped
ports:
- 5672:5672
networks:
- network

test-s3:
image: bitnami/minio:latest
container_name: test-s3
restart: unless-stopped
env_file: .env.docker
ports:
- 9010:9000
- 9011:9001
networks:
- network

test-postgres:
image: postgres:15
restart: unless-stopped
ports:
- 5433:5432
environment:
POSTGRES_DB: syncmaster
POSTGRES_USER: user
POSTGRES_PASSWORD: secret
env_file: .env.docker
networks:
- network

Expand All @@ -99,7 +90,7 @@ services:
- network

metastore-hive:
image: central-mirror.services.mts.ru/postgres:15-alpine
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_DB: metastore
Expand All @@ -111,8 +102,9 @@ services:
- network

test-hive:
image: mtsrus/hadoop:hadoop2.7.3-hive2.3.9
image: mtsrus/hadoop:hadoop2-hdfs
restart: unless-stopped
hostname: test-hive
depends_on:
- metastore-hive
ports:
Expand All @@ -124,8 +116,9 @@ services:
- 10002:10002 # Hive server Admin UI
- 19888:19888 # MapReduce JobServer History UI
- 9083:9083 # Hive Metastore server
- 9864:9864 # Datanode UI
environment:
WITH_HIVE_SERVER: 'false' # оставляем только сервер метастора, сам Hive нам не требуется, не тратим на него ресурсы
WITH_HIVE_SERVER: 'false' # We leave only the metastore server, we don’t need Hive itself, we don’t waste resources on it
HIVE_METASTORE_DB_URL: jdbc:postgresql://metastore-hive:5432/metastore
HIVE_METASTORE_DB_DRIVER: org.postgresql.Driver
HIVE_METASTORE_DB_USER: test_hive
Expand All @@ -136,6 +129,5 @@ services:
networks:
network:


volumes:
postgres_data:
26 changes: 21 additions & 5 deletions docker/backend.dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
FROM sregistry.mts.ru/bigdata/platform/docker-images/python:3.11-slim
FROM python:3.11-slim

RUN microdnf install java-17-openjdk libnghttp2-1.33.0-3.el8_2.1 # fix version https://github.com/nghttp2/nghttp2/issues/2003
RUN apt-get update && apt-get install -y \
libkrb5-dev \
libsasl2-dev \
libsasl2-modules-gssapi-mit \
libsasl2-modules-ldap \
libsasl2-modules \
openjdk-17-jdk \
libssl-dev \
libldap2-dev \
autoconf \
gcc \
g++ \
make \
libnghttp2-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir --timeout 3 --retries 3 poetry \
&& poetry config virtualenvs.create false

WORKDIR /syncmaster

COPY ./pyproject.toml ./poetry.lock* /syncmaster/
RUN poetry export -f requirements.txt --with backend,dev,test --output /syncmaster/requirements.txt \
--without-hashes --with-credentials --without-urls \
&& pip install --timeout 5 --retries 5 --no-cache-dir -r /syncmaster/requirements.txt

RUN pip install --upgrade pip setuptools wheel packaging

RUN poetry install --no-root --no-cache --with backend

dolfinus marked this conversation as resolved.
Show resolved Hide resolved
COPY ./syncmaster/ /syncmaster/

Expand Down
Loading
Loading