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 all 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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ __pycache__/
.idea
.vscode
.venv/
venv/
venv/
cached_jars/
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.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export TZ=UTC

# 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/
89 changes: 89 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Unit 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
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 ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry ${{ env.POETRY_VERSION }}
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}

- name: Cache poetry
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-
${{ runner.os }}-python
${{ runner.os }}

- name: Install dependencies
run: |
poetry install --no-root --with backend,test

- 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 DB Tests.
run: |
source .env.local
mkdir -p reports/
poetry run coverage run -m pytest -vvv -s ./syncmaster/tests/test_database
env:
COMPOSE_PROJECT_NAME: ${{ github.run_id }}-syncmaster

- name: Run Unit Tests.
run: |
source .env.local
poetry run coverage run -m pytest -vvv -s ./syncmaster/tests/test_unit
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/

**/metastore_db/
**/spark-warehouse/
/cached_jars/
cached_jars/
133 changes: 133 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
version: '3.8'
services:
db:
image: postgres:15
restart: unless-stopped
env_file: .env.docker
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- network

worker:
image: syncmaster_worker
restart: unless-stopped
build:
dockerfile: docker/worker.dockerfile
context: .
network: host
networks:
- network
volumes:
- ./cached_jars:/root/.ivy2
env_file: .env.docker

backend:
image: syncmaster_back
restart: unless-stopped
build:
dockerfile: docker/backend.dockerfile
context: .
network: host
ports:
- 8000:8000
networks:
- network
depends_on:
- db
- rabbitmq
- test-oracle
- test-postgres
- test-hive
- test-s3
volumes:
- ./cached_jars:/root/.ivy2
env_file: .env.docker


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
env_file: .env.docker
networks:
- network

test-oracle:
image: gvenzl/oracle-xe:slim-faststart
restart: unless-stopped
ports:
- 1522:1521
environment:
TZ: UTC
ORACLE_PASSWORD: test_password
ORACLE_DATABASE: test_oracle
APP_USER: test_user
APP_USER_PASSWORD: test_password
networks:
- network

metastore-hive:
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_DB: metastore
POSTGRES_USER: test_hive
POSTGRES_PASSWORD: test_hive
ports:
- 5440:5432
networks:
- network

test-hive:
image: mtsrus/hadoop:hadoop2-hdfs
restart: unless-stopped
hostname: test-hive
depends_on:
- metastore-hive
ports:
- 9820:9820 # HDFS IPC
- 9870:9870 # HDFS WebHDFS
- 8088:8088 # Yarn UI
- 8042:8042 # NodeManager UI
- 10000:10000 # Hive server
- 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' # 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
HIVE_METASTORE_DB_PASSWORD: test_hive
networks:
- network

networks:
network:

volumes:
postgres_data:
Loading