Skip to content

Commit 484fa4a

Browse files
committed
Working implementation. Adding automated tests
1 parent 1f46b2a commit 484fa4a

File tree

14 files changed

+448
-275
lines changed

14 files changed

+448
-275
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ insert_final_newline = true
1010
charset = utf-8
1111
end_of_line = lf
1212

13+
[*.yml]
14+
indent_size = 2
15+
16+
[*.yaml]
17+
indent_size = 2
18+
19+
[*.json]
20+
indent_size = 2
21+
22+
[*.toml]
23+
indent_size = 2
24+
25+
[*.template]
26+
indent_size = 2
27+
1328
[*.bat]
1429
indent_style = tab
1530
end_of_line = crlf

.github/workflows/tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: automated-tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pytest:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v4
12+
with:
13+
python-version: '3.10'
14+
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install pip -U; python -m pip install poetry; poetry install
18+
- name: Run tests
19+
run: |
20+
pytest -svx

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[settings]
2-
known_third_party = pydantic,pytest,requests
2+
known_third_party = pydantic,pytest,requests,testcontainers

conduktor.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
services:
2+
postgresql:
3+
image: postgres:14
4+
hostname: postgresql
5+
volumes:
6+
- pg_data:/var/lib/postgresql/data
7+
environment:
8+
POSTGRES_DB: "conduktor-console"
9+
POSTGRES_USER: "conduktor"
10+
POSTGRES_PASSWORD: "change_me"
11+
POSTGRES_HOST_AUTH_METHOD: "scram-sha-256"
12+
13+
conduktor-console:
14+
image: conduktor/conduktor-console:1.21.1
15+
depends_on:
16+
- postgresql
17+
ports:
18+
- "8080:8080"
19+
volumes:
20+
- conduktor_data:/var/conduktor
21+
environment:
22+
CDK_DATABASE_URL: "postgresql://conduktor:change_me@postgresql:5432/conduktor-console"
23+
CDK_MONITORING_CORTEX-URL: http://conduktor-monitoring:9009/
24+
CDK_MONITORING_ALERT-MANAGER-URL: http://conduktor-monitoring:9010/
25+
CDK_MONITORING_CALLBACK-URL: http://conduktor-platform:8080/monitoring/api/
26+
CDK_MONITORING_NOTIFICATIONS-CALLBACK-URL: http://localhost:8080
27+
28+
conduktor-monitoring:
29+
image: conduktor/conduktor-console-cortex:1.21.1
30+
environment:
31+
CDK_CONSOLE-URL: "http://conduktor-console:8080"
32+
depends_on:
33+
- conduktor-console
34+
volumes:
35+
pg_data: {}
36+
conduktor_data: {}

docker-compose.redpandayaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
services:
2+
redpanda-0:
3+
command:
4+
- redpanda
5+
- start
6+
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
7+
- --advertise-kafka-addr internal://redpanda-0:9092,external://localhost:19092
8+
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082
9+
# Address the broker advertises to clients that connect to the HTTP Proxy.
10+
- --advertise-pandaproxy-addr internal://redpanda-0:8082,external://localhost:18082
11+
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081
12+
# Redpanda brokers use the RPC API to communicate with eachother internally.
13+
- --rpc-addr redpanda-0:33145
14+
- --advertise-rpc-addr redpanda-0:33145
15+
- --smp 1
16+
- --memory 1G
17+
- --mode dev-container
18+
- --default-log-level=info
19+
image: docker.redpanda.com/redpandadata/redpanda:v23.1.11
20+
container_name: redpanda-0
21+
volumes:
22+
- redpanda-0:/var/lib/redpanda/data
23+
ports:
24+
- 8081:18081
25+
- 18082:18082
26+
- 19092:19092
27+
- 19644:9644
28+
healthcheck:
29+
test: [ "CMD-SHELL", "rpk cluster health | grep -E 'Healthy:.+true' || exit 1" ]
30+
interval: 15s
31+
timeout: 3s
32+
retries: 5
33+
start_period: 5s
34+
volumes:
35+
redpanda-0: {}

docker-compose.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
version: '2'
3+
services:
4+
broker:
5+
image: apache/kafka:3.7.0
6+
hostname: broker
7+
container_name: broker
8+
ports:
9+
- "9092:9092"
10+
environment:
11+
KAFKA_NODE_ID: 1
12+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
13+
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT_HOST://localhost:9092,PLAINTEXT://broker:19092'
14+
KAFKA_PROCESS_ROLES: 'broker,controller'
15+
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker:29093'
16+
KAFKA_LISTENERS: 'CONTROLLER://:29093,PLAINTEXT_HOST://:9092,PLAINTEXT://:19092'
17+
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
18+
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
19+
CLUSTER_ID: '4L6g3nShT-eMCtK--X86sw'
20+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
21+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
22+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
23+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
24+
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
25+
26+
schema-registry:
27+
image: confluentinc/cp-schema-registry:7.5.0
28+
hostname: schema-registry
29+
container_name: schema-registry
30+
depends_on:
31+
- broker
32+
ports:
33+
- "8081/tcp"
34+
environment:
35+
SCHEMA_REGISTRY_HOST_NAME: schema-registry
36+
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'broker:19092'
37+
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081

docker-compose.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.

kafka_schema_registry_admin/client_wrapper/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import requests
1414

15-
from .errors import evaluate_api_return
15+
from .errors import ApiGenericException, SchemaRegistryApiException, evaluate_api_return
1616

1717

1818
class Client:
@@ -50,6 +50,7 @@ def post(self, api_path: str, *args, **kwargs) -> Response:
5050
headers.update(self._default_headers)
5151
headers.update(self._post_headers)
5252
url: str = urlparse(self._base_url + api_path).geturl()
53+
print("URL??", url)
5354
response = requests.post(url, *args, **kwargs)
5455
return response
5556

0 commit comments

Comments
 (0)