Skip to content

Commit

Permalink
Patched date tests and rule descriptions EOL lambda runtimes (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Meyer authored and cmmeyer committed Jul 2, 2019
1 parent 50ae4c5 commit 3189b0b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ venv.bak/

# vscode
.vscode/

# osx
.DS_Store
2 changes: 1 addition & 1 deletion src/cfnlint/rules/resources/lmbd/DeprecatedRuntimeEnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
50 changes: 24 additions & 26 deletions test/fixtures/results/public/lambda-poller.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}]
9 changes: 4 additions & 5 deletions test/fixtures/results/quickstart/nist_config_rules.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[
{
[{
"Filename": "test/fixtures/templates/quickstart/nist_config_rules.yaml",
"Level": "Warning",
"Location": {
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -159,4 +158,4 @@
"Source": "https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#valueprimitivetype"
}
}
]
]
3 changes: 3 additions & 0 deletions test/rules/resources/lmbd/test_deprecated_runtime_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
3 changes: 3 additions & 0 deletions test/rules/resources/lmbd/test_deprecated_runtime_eol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 3189b0b

Please sign in to comment.