Skip to content

Commit

Permalink
Update requirements and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adammcdonagh authored Jun 3, 2024
1 parent c5ab39c commit 3d9ec6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v24.22.0
## v24.23.0

- Added new cacheable plugin to allow dynamically updated variables to be written back to SSM Parameter Store/Secrets Manager. For more detail see `open-task-framework` documentation for version 24.22.0
- Minor tweaks to SSM lookup plugin
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
"Operating System :: POSIX",
]
keywords = ["automation", "task", "framework", "aws", "s3", "ssm", "otf"]
dependencies = ["boto3 >= 1.26", "opentaskpy >= v24.22.0"]
dependencies = ["boto3 >= 1.26", "opentaskpy >= v24.23.0"]
description = "Addons for opentaskpy, giving it the ability to push/pull via AWS S3, and pull variables from AWS SSM Parameter Store."
readme = "README.md"
requires-python = ">=3.11"
Expand Down
28 changes: 16 additions & 12 deletions tests/test_taskhandler_transfer_dummy_with_ssm_caching.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pylint: skip-file
# ruff: noqa

from opentaskpy.taskhandlers import transfer

from opentaskpy.variablecaching.aws import ssm
from tests.fixtures.localstack import * # noqa: F403

Expand All @@ -9,26 +11,28 @@
"type": "transfer",
"source": {
"accessToken": "0",
"protocol": {"name": "opentaskpy.remotehandlers.dummy"},
"protocol": {"name": "dummy"},
"cacheableVariables": [
{
"variableName": "accessToken",
"cachingPlugin": "aws.ssm",
"cacheArgs": {
"name": "/test/variablename",
},
}
],
},
"cacheableVariables": [
{
"variableName": "source.accessToken",
"cachingPlugin": "aws.ssm",
"cacheArgs": {
"name": "/test/variablename",
},
}
],
}


def test_dummy_transfer(ssm_client):
# The key thing to test is that the access token
# is written to the cache file
from opentaskpy.remotehandlers.dummy import DummyTransfer

dummy_transfer = DummyTransfer(dummy_task_definition)
transfer_obj = transfer.Transfer(None, "dummy_task_transfer", dummy_task_definition)

with pytest.raises(Exception):
transfer_obj.run() # There is nothing to find, so it'll fail

# Check the parameter store value now exists and contains a random number
param = ssm_client.get_parameter(Name="/test/variablename", WithDecryption=True)
Expand Down

0 comments on commit 3d9ec6a

Please sign in to comment.