Skip to content

Commit f4afe7f

Browse files
author
saul-data
committed
github tests
1 parent ee84d77 commit f4afe7f

File tree

5 files changed

+79
-5
lines changed

5 files changed

+79
-5
lines changed

.github/workflows/python-tests.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,31 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.8", "3.9", "3.10"]
14+
python-version: ["3.8", "3.9", "3.10", "3.11"]
1515

1616
steps:
1717
- uses: actions/checkout@v3
18+
19+
- name: Build the stack
20+
run: docker-compose -f tests/docker-compose.yaml up --build -d
21+
1822
- name: Set up Python ${{ matrix.python-version }}
1923
uses: actions/setup-python@v4
2024
with:
2125
python-version: ${{ matrix.python-version }}
26+
2227
- name: Install dependencies
2328
run: |
2429
python -m pip install --upgrade pip
25-
if [ -f .devcontainer/requirements.txt ]; then pip install -r .devcontainer/requirements.txt --use-pep517; fi
30+
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
2631
- name: Test with pytest
2732
run: |
28-
pytest -s
33+
pytest -s
34+
env:
35+
SHAREPOINT_HOST: ${{ secrets.SHAREPOINT_HOST }}
36+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
37+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
38+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
39+
TEAMS_WEBHOOK: ${{ secrets.TEAMS_WEBHOOK }}
40+
REDIS_HOST: "localhost"
41+
S3_HOST: "http://localhost:9000"

src/dataplane/pipelinerun/data_persist/test_redis.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
import redis
66
from datetime import timedelta
77
from nanoid import generate
8+
from dotenv import load_dotenv
89

910
def test_redis_store():
1011

12+
load_dotenv()
13+
1114
# ---------- Dataplane pipeline run ------------
15+
REDIS_HOST = os.environ["REDIS_HOST"]
16+
print("Redis:", REDIS_HOST)
1217

1318
# Dataplane run id
1419
os.environ["DP_RUNID"] = generate('1234567890abcdef', 10)
@@ -23,7 +28,7 @@ def test_redis_store():
2328
dfrows = df.shape[0]
2429

2530
# Redis connection
26-
redisConnect = redis.Redis(host='redis-service', port=6379, db=0)
31+
redisConnect = redis.Redis(host=REDIS_HOST, port=6379, db=0)
2732

2833

2934
# ---------- STORE PARQUET TO REDIS ------------

src/dataplane/pipelinerun/data_persist/test_s3_store.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
import boto3
66
from botocore.client import Config
77
from nanoid import generate
8+
from dotenv import load_dotenv
89

910
def test_s3_store():
1011

12+
load_dotenv()
13+
1114
# ---------- DATAPLANE RUN ------------
1215

1316
# Dataplane run id
@@ -22,10 +25,12 @@ def test_s3_store():
2225
df = pd.DataFrame(data)
2326
dfrows = df.shape[0]
2427

28+
S3_HOST = os.environ["S3_HOST"]
29+
2530
# S3 connection
2631
S3Connect = boto3.client(
2732
's3',
28-
endpoint_url="http://minio:9000",
33+
endpoint_url=S3_HOST,
2934
aws_access_key_id="admin",
3035
aws_secret_access_key="hello123",
3136
config=Config(signature_version='s3v4'),

tests/docker-compose.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: '3'
2+
3+
services:
4+
5+
minio:
6+
command: server /data --console-address ":9001"
7+
image: minio/minio:RELEASE.2022-10-15T19-57-03Z
8+
ports:
9+
- 9000:9000
10+
- 9001:9001
11+
environment:
12+
MINIO_ROOT_USER: admin
13+
MINIO_ROOT_PASSWORD: hello123
14+
volumes:
15+
- miniovolume:/data
16+
healthcheck:
17+
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
18+
interval: 30s
19+
timeout: 20s
20+
retries: 3
21+
22+
createbuckets:
23+
image: minio/mc:RELEASE.2022-10-12T18-12-50Z
24+
depends_on:
25+
- minio
26+
entrypoint: >
27+
/bin/sh -c "
28+
/usr/bin/mc alias set myminio http://minio:9000 admin hello123;
29+
/usr/bin/mc mb myminio/dataplanebucket;
30+
# /usr/bin/mc policy set public myminio/dataplanebucket;
31+
exit 0;
32+
"
33+
34+
redis-service:
35+
image: redis:7.0.5-bullseye
36+
ports:
37+
- 6379:6379
38+
39+
volumes:
40+
miniovolume:
41+

tests/requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# utils==1.0.1
2+
# docstring==0.1.2.4
3+
redis==4.3.4
4+
pandas==1.5.1
5+
boto3==1.24.93
6+
pytest==7.1.3
7+
pyarrow==9.0.0
8+
nanoid==0.1
9+
requests==2.28.1
10+
python-dotenv==0.21.0

0 commit comments

Comments
 (0)