-
Notifications
You must be signed in to change notification settings - Fork 0
Integration test #110
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
Merged
Merged
Integration test #110
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6f09804
New test structure following the integration test implementation.
tmikula-dev dae1959
Integration tests.
tmikula-dev ce2f7ec
Merge branch 'master' into feature/63-integration-test
tmikula-dev 1f2af9f
Code Rabbit comment fixes.
tmikula-dev b01e140
Code Rabbit comment fixes.
tmikula-dev 4f37c0c
Comment implementation
tmikula-dev 9a56145
documentation update.
tmikula-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,46 @@ | ||
| Copilot instructions for EventGate | ||
|
|
||
| Purpose | ||
| AWS Lambda event gateway that receives messages via API Gateway and dispatches them to Kafka, EventBridge, and PostgreSQL. | ||
|
|
||
| Structure | ||
| - Entry point: `src/event_gate_lambda.py` | ||
| - Handlers: `src/handlers/` (HandlerApi, HandlerToken, HandlerTopic, HandlerHealth) | ||
| - Writers: `src/writers/` (inherit from `Writer` base class) | ||
| - Config: `conf/config.json`, `conf/access.json`, `conf/topic_schemas/*.json` | ||
| - Production Terraform scripts are not part of this repository; `terraform_examples/` for reference configurations only | ||
|
|
||
| Python style | ||
| - Python 3.13 | ||
| - Type hints for public functions and classes | ||
| - Use `logging.getLogger(__name__)`, not print | ||
| - Lazy % formatting in logging: `logger.info("msg %s", var)` | ||
| - F-strings in exceptions: `raise ValueError(f"Error {var}")` | ||
| - All imports at top of file (never inside functions) | ||
| - Apache 2.0 license header in every .py file (including `__init__.py`) | ||
| - Docstrings must start with a short summary line | ||
| - End all log messages with a period: `logger.info("Message.")` | ||
|
|
||
| Patterns | ||
| - `__init__` methods must not raise exceptions; defer validation and connection to first use (lazy init) | ||
| - Writers: inherit from `Writer(ABC)`, implement `write(topic, message) -> (bool, str|None)` and `check_health() -> (bool, str)` | ||
| - Route dispatch via `ROUTE_MAP` dict mapping routes to handler functions in `event_gate_lambda.py` | ||
| - Separate business logic from environment access (env vars, file I/O, network calls) | ||
| - No duplicate validation; centralize parsing in one layer where practical | ||
| - Preserve existing formatting and conventions | ||
| - Keep API Gateway response structure stable: `{"statusCode": int, "headers": {...}, "body": "..."}` | ||
| - Keep error response format stable: `{"success": false, "statusCode": int, "errors": [...]}` | ||
|
|
||
| Testing | ||
| - Mirror src structure: `src/handlers/` -> `tests/handlers/` | ||
| - Unit tests: mock external services via `conftest.py` (Kafka, EventBridge, PostgreSQL, S3) | ||
| - Integration tests: call `lambda_handler` directly with real containers (testcontainers-python for Kafka, PostgreSQL, LocalStack) | ||
| - No real API/DB calls in unit tests | ||
| - Use `mocker.patch("module.dependency")` or `mocker.patch.object(Class, "method")` | ||
| - Assert pattern: `assert expected == actual` | ||
|
|
||
| Quality gates (run after changes, fix only if below threshold) | ||
| - black . | ||
| - mypy . | ||
| - pylint $(git ls-files '*.py') >= 9.5 | ||
| - pytest tests/ >= 80% coverage | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| "BarUser" | ||
| ], | ||
| "public.cps.za.test": [ | ||
| "TestUser" | ||
| "TestUser", | ||
| "IntegrationTestUser" | ||
| ] | ||
| } | ||
This file contains hidden or 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
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.