Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
python-cfn-lint
cl_fix-lambda-runtimes-EOL-dates.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cl_fix-lambda-runtimes-EOL-dates.patch of Package python-cfn-lint
From 3189b0b190c80f9dcd1bd13188baff852e952ca1 Mon Sep 17 00:00:00 2001 From: Chuck Meyer <chuck.meyer@boldpenguin.com> Date: Tue, 2 Jul 2019 12:58:34 -0400 Subject: [PATCH] Patched date tests and rule descriptions EOL lambda runtimes (#999) --- .gitignore | 3 ++ .../resources/lmbd/DeprecatedRuntimeEnd.py | 2 +- .../results/public/lambda-poller.json | 50 +++++++++---------- .../results/quickstart/nist_config_rules.json | 9 ++-- .../lmbd/test_deprecated_runtime_end.py | 3 ++ .../lmbd/test_deprecated_runtime_eol.py | 3 ++ 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index f8b9373f..54c5859f 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ venv.bak/ # vscode .vscode/ + +# osx +.DS_Store diff --git a/src/cfnlint/rules/resources/lmbd/DeprecatedRuntimeEnd.py b/src/cfnlint/rules/resources/lmbd/DeprecatedRuntimeEnd.py index e7c95b5f..9443b0f5 100644 --- a/src/cfnlint/rules/resources/lmbd/DeprecatedRuntimeEnd.py +++ b/src/cfnlint/rules/resources/lmbd/DeprecatedRuntimeEnd.py @@ -23,7 +23,7 @@ class DeprecatedRuntimeEnd(DeprecatedRuntime): """Check if EOL Lambda Function Runtimes are used""" id = 'E2531' shortdesc = 'Check if EOL Lambda Function Runtimes are used' - description = 'Check if an EOL Lambda Runtime is specified and give a warning if used. ' + description = 'Check if an EOL Lambda Runtime is specified and give an error if used. ' source_url = 'https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html' tags = ['resources', 'lambda', 'runtime'] diff --git a/test/fixtures/results/public/lambda-poller.json b/test/fixtures/results/public/lambda-poller.json index 5899e810..2bbb159e 100644 --- a/test/fixtures/results/public/lambda-poller.json +++ b/test/fixtures/results/public/lambda-poller.json @@ -1,29 +1,27 @@ -[ - { - "Filename": "test/fixtures/templates/public/lambda-poller.yaml", - "Level": "Warning", - "Location": { - "End": { - "ColumnNumber": 14, - "LineNumber": 151 - }, - "Path": [ - "Resources", - "PollerFunction", - "Properties", - "Runtime" - ], - "Start": { - "ColumnNumber": 7, - "LineNumber": 151 - } +[{ + "Filename": "test/fixtures/templates/public/lambda-poller.yaml", + "Level": "Warning", + "Location": { + "End": { + "ColumnNumber": 14, + "LineNumber": 151 }, - "Message": "EOL runtime (nodejs6.10) specified. Runtime is EOL since 2019-04-30 and updating will be disabled at 2019-06-30, please consider to update to nodejs10.x", - "Rule": { - "Description": "Check if an EOL Lambda Runtime is specified and give a warning if used. ", - "Id": "W2531", - "ShortDescription": "Check if EOL Lambda Function Runtimes are used", - "Source": "https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html" + "Path": [ + "Resources", + "PollerFunction", + "Properties", + "Runtime" + ], + "Start": { + "ColumnNumber": 7, + "LineNumber": 151 } + }, + "Message": "EOL runtime (nodejs6.10) specified. Runtime is EOL since 2019-04-30 and updating will be disabled at 2019-06-30, please consider to update to nodejs10.x", + "Rule": { + "Description": "Check if an EOL Lambda Runtime is specified and give an error if used. ", + "Id": "E2531", + "ShortDescription": "Check if EOL Lambda Function Runtimes are used", + "Source": "https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html" } -] +}] \ No newline at end of file diff --git a/test/fixtures/results/quickstart/nist_config_rules.json b/test/fixtures/results/quickstart/nist_config_rules.json index 9ad3b5fb..55810ef8 100644 --- a/test/fixtures/results/quickstart/nist_config_rules.json +++ b/test/fixtures/results/quickstart/nist_config_rules.json @@ -1,5 +1,4 @@ -[ - { +[{ "Filename": "test/fixtures/templates/quickstart/nist_config_rules.yaml", "Level": "Warning", "Location": { @@ -46,7 +45,7 @@ }, "Message": "Deprecated runtime (nodejs) specified. Updating disabled since 2016-10-31, please consider to update to nodejs10.x", "Rule": { - "Description": "Check if an EOL Lambda Runtime is specified and give a warning if used. ", + "Description": "Check if an EOL Lambda Runtime is specified and give an error if used. ", "Id": "E2531", "ShortDescription": "Check if EOL Lambda Function Runtimes are used", "Source": "https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html" @@ -126,7 +125,7 @@ }, "Message": "Deprecated runtime (nodejs) specified. Updating disabled since 2016-10-31, please consider to update to nodejs10.x", "Rule": { - "Description": "Check if an EOL Lambda Runtime is specified and give a warning if used. ", + "Description": "Check if an EOL Lambda Runtime is specified and give an error if used. ", "Id": "E2531", "ShortDescription": "Check if EOL Lambda Function Runtimes are used", "Source": "https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html" @@ -159,4 +158,4 @@ "Source": "https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#valueprimitivetype" } } -] +] \ No newline at end of file diff --git a/test/rules/resources/lmbd/test_deprecated_runtime_end.py b/test/rules/resources/lmbd/test_deprecated_runtime_end.py index 519fa560..9a3e1ccb 100644 --- a/test/rules/resources/lmbd/test_deprecated_runtime_end.py +++ b/test/rules/resources/lmbd/test_deprecated_runtime_end.py @@ -14,16 +14,19 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +from datetime import datetime from cfnlint.rules.resources.lmbd.DeprecatedRuntimeEnd import DeprecatedRuntimeEnd # pylint: disable=E0401 from ... import BaseRuleTestCase class TestDeprecatedRuntimeEnd(BaseRuleTestCase): """Test Lambda Deprecated Runtime usage""" + def setUp(self): """Setup""" super(TestDeprecatedRuntimeEnd, self).setUp() self.collection.register(DeprecatedRuntimeEnd()) + self.collection.rules[0].current_date = datetime(2019, 6, 29) def test_file_positive(self): """Test Positive""" diff --git a/test/rules/resources/lmbd/test_deprecated_runtime_eol.py b/test/rules/resources/lmbd/test_deprecated_runtime_eol.py index ff9daaa3..bb978400 100644 --- a/test/rules/resources/lmbd/test_deprecated_runtime_eol.py +++ b/test/rules/resources/lmbd/test_deprecated_runtime_eol.py @@ -14,16 +14,19 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +from datetime import datetime from cfnlint.rules.resources.lmbd.DeprecatedRuntimeEol import DeprecatedRuntimeEol # pylint: disable=E0401 from ... import BaseRuleTestCase class TestDeprecatedRuntimeEol(BaseRuleTestCase): """Test Lambda Deprecated Runtime usage""" + def setUp(self): """Setup""" super(TestDeprecatedRuntimeEol, self).setUp() self.collection.register(DeprecatedRuntimeEol()) + self.collection.rules[0].current_date = datetime(2019, 6, 29) def test_file_positive(self): """Test Positive"""
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor