-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kinesis: Adjust code for lorrystream version 0.0.3. Add tests.
On the last occasion, dependencies to lorrystream have not been verified correctly, so it was expectable that things go south. This patch fixes them, and adds rudimentary software tests to avoid tripping into the same situation as before.
- Loading branch information
Showing
6 changed files
with
47 additions
and
4 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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from lorrystream.carabas.aws import DynamoDBKinesisPipe, RDSPostgreSQLDMSKinesisPipe | ||
from lorrystream.carabas.aws.function.model import LambdaFactory | ||
from lorrystream.carabas.aws.function.oci import LambdaPythonImage | ||
from lorrystream.carabas.aws.stack import DynamoDBKinesisPipe | ||
|
||
__all__ = [ | ||
"DynamoDBKinesisPipe", | ||
"LambdaFactory", | ||
"LambdaPythonImage", | ||
"DynamoDBKinesisPipe", | ||
"RDSPostgreSQLDMSKinesisPipe", | ||
] |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ruff: noqa: F401 | ||
|
||
|
||
def test_iac_imports(): | ||
from cratedb_toolkit.iac.aws import ( | ||
DynamoDBKinesisPipe, | ||
LambdaFactory, | ||
LambdaPythonImage, | ||
RDSPostgreSQLDMSKinesisPipe, | ||
) |
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,31 @@ | ||
import os | ||
import sys | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def reset_handler(): | ||
try: | ||
del sys.modules["cratedb_toolkit.io.processor.kinesis_lambda"] | ||
except KeyError: | ||
pass | ||
|
||
|
||
def test_processor_invoke_no_records(reset_handler, mocker, caplog): | ||
""" | ||
Roughly verify that the unified Lambda handler works. | ||
""" | ||
|
||
# Configure environment variables. | ||
handler_environment = { | ||
"MESSAGE_FORMAT": "dms", | ||
} | ||
mocker.patch.dict(os.environ, handler_environment) | ||
|
||
from cratedb_toolkit.io.processor.kinesis_lambda import handler | ||
|
||
event = {"Records": []} | ||
handler(event, None) | ||
|
||
assert "Successfully processed 0 records" in caplog.messages |