diff --git a/.gitignore b/.gitignore index f8b9373fd2..54c5859fd2 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 e7c95b5f68..9443b0f5eb 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 5899e81091..2bbb159e51 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 9ad3b5fb26..55810ef8e0 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 519fa560a4..9a3e1ccba9 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 ff9daaa3e4..bb978400de 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"""