Skip to content

Commit

Permalink
feat(tippecanoe): add command line to airflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisig committed Dec 11, 2024
1 parent cc1ff49 commit a7946e0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
13 changes: 13 additions & 0 deletions airflow/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
FROM quay.io/astronomer/astro-runtime:11.8.0

ENV DATA_DIR=data_tiles

RUN mkdir -p $DATA_DIR

# Install tippecanoe
RUN git clone https://github.com/mapbox/tippecanoe.git /home/astro/tippecanoe
USER root
WORKDIR /home/astro/tippecanoe
RUN make && make install
USER astro
WORKDIR /usr/local/airflow

RUN mkdir /home/astro/.dbt
COPY ./dbt_profile.yml /home/astro/.dbt/profiles.yml
7 changes: 7 additions & 0 deletions airflow/packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ g++
wget
p7zip-full
postgresql-client
cmake
wget
git
ca-certificates
build-essential
libsqlite3-dev
zlib1g-dev
31 changes: 31 additions & 0 deletions airflow/tests/test_tippecanoe_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import subprocess

import pytest


def test_missing_command_is_not_available():
"""
Teste qu'une commande inexistante retourne une erreur FileNotFoundError
"""

command_not_found = False

try:
subprocess.run(["not_a_command"], check=True)
except FileNotFoundError:
command_not_found = True

if not command_not_found:
pytest.fail("La commande not_a_command n'a pas retourné d'erreur")


def test_tippecanoe_cli_is_available():
"""
Teste si le cli tippecanoe est disponible depuis la commande tippecanoe
"""
try:
subprocess.run(["tippecanoe", "--help"], check=True)
except FileNotFoundError:
pytest.fail("La commande tippecanoe n'est pas disponible")
except subprocess.CalledProcessError as e:
pytest.fail(f"La commande tippecanoe a retourné une erreur: {e}")

0 comments on commit a7946e0

Please sign in to comment.