-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PROPOSAL]: Local Hatchet for Tests (#271)
* feat: local compose stack * try running tests against local hatchet * fix: hack * fix: tracer provider warnings * fix: make sure workflows exist * debug: test * cleanup: unwind print statements * fix: lint * chore: version * fix: remove third-party action * fix: daemon
- Loading branch information
1 parent
7e8755d
commit 70b1c88
Showing
8 changed files
with
157 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
http://localhost:8080 { | ||
handle /api/* { | ||
reverse_proxy hatchet-api:8080 | ||
} | ||
|
||
handle /* { | ||
reverse_proxy hatchet-frontend:80 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
version: "3.8" | ||
services: | ||
postgres: | ||
image: postgres:15.6 | ||
command: postgres -c 'max_connections=200' | ||
restart: always | ||
hostname: "postgres" | ||
environment: | ||
- POSTGRES_USER=hatchet | ||
- POSTGRES_PASSWORD=hatchet | ||
- POSTGRES_DB=hatchet | ||
ports: | ||
- "5435:5432" | ||
volumes: | ||
- hatchet_postgres_data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -d hatchet -U hatchet"] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 5 | ||
start_period: 10s | ||
rabbitmq: | ||
image: "rabbitmq:3-management" | ||
hostname: "rabbitmq" | ||
ports: | ||
- "5673:5672" # RabbitMQ | ||
- "15673:15672" # Management UI | ||
environment: | ||
RABBITMQ_DEFAULT_USER: "user" | ||
RABBITMQ_DEFAULT_PASS: "password" | ||
volumes: | ||
- "hatchet_rabbitmq_data:/var/lib/rabbitmq" | ||
- "hatchet_rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf" # Configuration file mount | ||
healthcheck: | ||
test: ["CMD", "rabbitmqctl", "status"] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 5 | ||
migration: | ||
image: ghcr.io/hatchet-dev/hatchet/hatchet-migrate:latest | ||
environment: | ||
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet" | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
setup-config: | ||
image: ghcr.io/hatchet-dev/hatchet/hatchet-admin:latest | ||
command: /hatchet/hatchet-admin quickstart --skip certs --generated-config-dir /hatchet/config --overwrite=false | ||
environment: | ||
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet" | ||
DATABASE_POSTGRES_PORT: "5432" | ||
DATABASE_POSTGRES_HOST: "postgres" | ||
SERVER_TASKQUEUE_RABBITMQ_URL: amqp://user:password@rabbitmq:5672/ | ||
SERVER_AUTH_COOKIE_DOMAIN: localhost:8080 | ||
SERVER_AUTH_COOKIE_INSECURE: "t" | ||
SERVER_GRPC_BIND_ADDRESS: "0.0.0.0" | ||
SERVER_GRPC_INSECURE: "t" | ||
SERVER_GRPC_BROADCAST_ADDRESS: localhost:7077 | ||
volumes: | ||
- hatchet_certs:/hatchet/certs | ||
- hatchet_config:/hatchet/config | ||
depends_on: | ||
migration: | ||
condition: service_completed_successfully | ||
rabbitmq: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_healthy | ||
hatchet-engine: | ||
image: ghcr.io/hatchet-dev/hatchet/hatchet-engine:latest | ||
command: /hatchet/hatchet-engine --config /hatchet/config | ||
restart: on-failure | ||
depends_on: | ||
setup-config: | ||
condition: service_completed_successfully | ||
migration: | ||
condition: service_completed_successfully | ||
ports: | ||
- "7077:7070" | ||
environment: | ||
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet" | ||
SERVER_GRPC_BIND_ADDRESS: "0.0.0.0" | ||
SERVER_GRPC_INSECURE: "t" | ||
volumes: | ||
- hatchet_certs:/hatchet/certs | ||
- hatchet_config:/hatchet/config | ||
hatchet-api: | ||
image: ghcr.io/hatchet-dev/hatchet/hatchet-api:latest | ||
command: /hatchet/hatchet-api --config /hatchet/config | ||
restart: on-failure | ||
depends_on: | ||
setup-config: | ||
condition: service_completed_successfully | ||
migration: | ||
condition: service_completed_successfully | ||
environment: | ||
DATABASE_URL: "postgres://hatchet:hatchet@postgres:5432/hatchet" | ||
volumes: | ||
- hatchet_certs:/hatchet/certs | ||
- hatchet_config:/hatchet/config | ||
hatchet-frontend: | ||
image: ghcr.io/hatchet-dev/hatchet/hatchet-frontend:latest | ||
caddy: | ||
image: caddy:2.7.6-alpine | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- ./Caddyfile:/etc/caddy/Caddyfile | ||
|
||
volumes: | ||
hatchet_postgres_data: | ||
hatchet_rabbitmq_data: | ||
hatchet_rabbitmq.conf: | ||
hatchet_config: | ||
hatchet_certs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import pytest | ||
|
||
from hatchet_sdk import Hatchet | ||
from tests.utils import fixture_bg_worker | ||
|
||
## IMPORTANT: Worker needs to be set here to ensure at least one workflow exists | ||
worker = fixture_bg_worker(["poetry", "run", "concurrency_limit_rr"]) | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_list_workflows(hatchet: Hatchet): | ||
list = hatchet.rest.workflow_list() | ||
async def test_list_workflows(hatchet: Hatchet, worker): | ||
workflows = hatchet.rest.workflow_list() | ||
|
||
assert len(list.rows) != 0 | ||
assert len(workflows.rows) != 0 | ||
|
||
|
||
# requires scope module or higher for shared event loop | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_async_list_workflows(aiohatchet: Hatchet): | ||
list = await aiohatchet.rest.aio.workflow_list() | ||
async def test_async_list_workflows(aiohatchet: Hatchet, worker): | ||
workflows = await aiohatchet.rest.aio.workflow_list() | ||
|
||
assert len(list.rows) != 0 | ||
assert len(workflows.rows) != 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "hatchet-sdk" | ||
version = "0.40.0" | ||
version = "0.40.1" | ||
description = "" | ||
authors = ["Alexander Belanger <[email protected]>"] | ||
readme = "README.md" | ||
|