New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lambda model and api updates #7762
Conversation
@@ -577,6 +587,14 @@ def wait_logs(): | |||
"$..StartingPosition", | |||
"$..StateTransitionReason", | |||
"$..Topics", | |||
# resource index mismatch due to SnapStart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an example where a new feature changes the indexing of snapshots because it matches a resource transformer. It is not ideal that we need to disable these snapshot verifications for the old provider due to an unrelated change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I'm generally not super happy with the state of the resource transformer. I've added this as a reference in our internal issue tracker for snapshots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to track that one. I think this might become a nasty source of flaky tests with automated test re-validation.
"$..PolicyArn", | ||
"$..Layers", | ||
# mismatching resource index due to SnapStart | ||
"$..Statement.Condition.ArnLike.'AWS:SourceArn'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:
break the JsonPath snapshot comparison and need to be enquoted using single quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add some validation for this to avoid errors like this. Was this fairly obvious when debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error was pretty specific (see below) but the stack trace wasn't particularly helpful in identifying the issue because the hook is executed after the test.
It could be nice to give some context when raising (e.g., which snapshot match or which verify skip path).
> raise JsonPathParserError('Parse error at %s:%s near token %s (%s)'
% (t.lineno, t.col, t.value, t.type))
E jsonpath_ng.exceptions.JsonPathParserError: Parse error at 1:34 near token : (:)
.venv/lib/python3.10/site-packages/jsonpath_ng/parser.py:81: JsonPathParserError
f3b3759
to
b6b2a31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🥳
Great that you uncovered a lot of hidden issues that we'll need to tackle at some point. (e.g. tests missing the validated marker, rust compilation, resource transformer)
tests/integration/awslambda/functions/common/endpointinjection/provided/Makefile
Outdated
Show resolved
Hide resolved
|
||
build: | ||
mkdir -p build | ||
docker run --rm -v $$(pwd)/src:/app -v $$(pwd)/build:/out golang:latest@sha256:b850621230956a6d960d6d7cfaba6a8a2e8e245b230a928ef66aa0cfd065e229 /bin/bash -c "cd /app && GOOS=linux CGO_ENABLED=0 go build -trimpath -ldflags=-buildid= -o /out/main main.go && chown $$(id -u):$$(id -g) /out/main" | ||
docker run --rm --platform $(DOCKER_PLATFORM) -v $$(pwd)/src:/app -v $$(pwd)/build:/out $(DOCKER_GOLANG_IMAGE) /bin/bash -c "cd /app && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags=-buildid= -o /out/main main.go && chown $$(id -u):$$(id -g) /out/main" | ||
find ./build -exec touch -t 200001010100.00 {} \; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove these since we're not actually checking size & hash of the zip files anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, I added a TODO for build refactoring in test_lambda_common.py
because the many identical Makefiles could be parametrized per runtime.
I wasn't sure initially whether the touch is for hashing or some caching ...
else: | ||
pytestmark = pytest.mark.skip_snapshot_verify( | ||
paths=["$..CodeSize", "$..SnapStart"], # FIXME | ||
paths=["$..CodeSize"], # FIXME | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can actually just remove codesize as well and add it to the "global" transformers above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍
I just removed it because CodeSize
is already part of the lambda_api()
transformer.
"update_function_configuration_response_rev5..RuntimeVersionConfig.RuntimeVersionArn", | ||
"get_function_response_rev6..RuntimeVersionConfig.RuntimeVersionArn", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"update_function_configuration_response_rev5..RuntimeVersionConfig.RuntimeVersionArn", | |
"get_function_response_rev6..RuntimeVersionConfig.RuntimeVersionArn", | |
"$..RuntimeVersionConfig.RuntimeVersionArn", |
or was there a particular reason for only including those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still wanted the validation that the RuntimeVersionArn
does not change between revisions and not ignore it completely for the entire test
"$..PolicyArn", | ||
"$..Layers", | ||
# mismatching resource index due to SnapStart | ||
"$..Statement.Condition.ArnLike.'AWS:SourceArn'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add some validation for this to avoid errors like this. Was this fairly obvious when debugging?
@@ -577,6 +587,14 @@ def wait_logs(): | |||
"$..StartingPosition", | |||
"$..StateTransitionReason", | |||
"$..Topics", | |||
# resource index mismatch due to SnapStart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I'm generally not super happy with the state of the resource transformer. I've added this as a reference in our internal issue tracker for snapshots
Limitation: hardcoded runtime arn
`:` require escaping in JsonPaths
Is already part of the default transformer
b6b2a31
to
25e9a0f
Compare
Contributions
aws_validated
tests)build_image
Limitations
8eeff65f6809a3ce81507fe733fe09b835899b99481ba22fd75b5a7338290ec1
) instead of inspecting the Docker image.Breaking changes