Skip to content

Commit 09d67d4

Browse files
WIP testing whether decode_authorizer_context is set
1 parent e7c56a4 commit 09d67d4

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

publish_test_layer.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
REGION=us-east-1 PYTHON_VERSION=$PYTHON_VERSION ARCH=$ARCH ./scripts/build_layers.sh
2+
3+
LAYER_NAME="Python${PYTHON_VERSION/3./3}-RITHIKA"
4+
LAYER_ZIP=".layers/datadog_lambda_py-${ARCH}-${PYTHON_VERSION}.zip"
5+
REGION="us-east-1"
6+
7+
echo "zipping package files"
8+
PYTHON_VERSION=$PYTHON_VERSION ARCH=$ARCH ./scripts/build_layers.sh
9+
10+
echo "publishing layer"
11+
12+
layer_arn=$(
13+
aws-vault exec sso-serverless-sandbox-account-admin -- \
14+
aws lambda publish-layer-version --layer-name $LAYER_NAME \
15+
--description "Datadog Tracer Lambda Layer for Python" \
16+
--zip-file "fileb://$LAYER_ZIP" \
17+
--region "$REGION" \
18+
--output json \
19+
| jq -r '.LayerVersionArn')
20+
21+
echo "new python layer published $layer_arn"

tests/test_tracing.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
_dsm_set_checkpoint,
4646
extract_context_from_kinesis_event,
4747
extract_context_from_sqs_or_sns_event_or_context,
48+
extract_context_from_request_header_or_context,
49+
extract_context_from_http_event_or_context
4850
)
4951

5052
from datadog_lambda.trigger import parse_event_source
@@ -948,6 +950,16 @@ def test_step_function_trace_data_sns_sqs(self):
948950
self._test_step_function_trace_data_common(
949951
sns_sqs_event, 5708348677301000120, 18223515719478572006, "45457f5f3fde3fa1"
950952
)
953+
954+
# def test_not_decode_authorizer_for_request_header(self, monkeypatch):
955+
# calls = []
956+
# def patched_extract_context_from_http_event_or_context(event, lambda_context, event_source, decode_authorizer_context=True):
957+
# calls.append(decode_authorizer_context)
958+
# monkeypatch.setattr('extract_context_from_http_event_or_context', patched_extract_context_from_http_event_or_context)
959+
960+
# extract_context_from_request_header_or_context()
961+
962+
# assert calls == [False]
951963

952964

953965
class TestXRayContextConversion(unittest.TestCase):

0 commit comments

Comments
 (0)