Skip to content

Commit

Permalink
Add logging for files pulled from S3 + enable RIE debug for flaky test (
Browse files Browse the repository at this point in the history
#6604)

* Add logging for files pulled from S3 + enable RIE debug for this test only

* Formatting

* Fix location of RIE debug env variable to correct test

* Minor fixes

* Formatting

---------

Co-authored-by: Jared Bentvelsen <bentvels@amazon.com>
  • Loading branch information
bentvelj and Jared Bentvelsen authored Jan 25, 2024
1 parent 75862c9 commit 5dedfbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/end_to_end/test_runtimes_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class TestHelloWorldZipPackagePermissionsEndToEnd(EndToEndBase):
app_template = "hello-world"

def test_hello_world_workflow(self):
os.environ["SAM_CLI_RIE_DEV"] = "1"
function_name = "HelloWorldFunction"
with EndToEndTestContext(self.app_name) as e2e_context:
self.template_path = e2e_context.template_path
Expand All @@ -133,6 +134,7 @@ def test_hello_world_workflow(self):
EndToEndBaseStage(LocalInvokeValidator(e2e_context), e2e_context, local_command_list),
]
self._run_tests(stages)
os.environ.pop("SAM_CLI_RIE_DEV", None)


@skipIf(SKIP_E2E_TESTS, "Skip E2E tests in CI/CD only")
Expand Down
9 changes: 9 additions & 0 deletions tests/end_to_end/test_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from unittest import TestCase

import logging
import boto3
import zipfile
import json
Expand All @@ -16,6 +17,8 @@
from tests.end_to_end.end_to_end_context import EndToEndTestContext
from tests.testing_utils import CommandResult, run_command, run_command_with_input

LOG = logging.getLogger(__name__)


class BaseValidator(TestCase):
def __init__(self, test_context: EndToEndTestContext):
Expand Down Expand Up @@ -109,6 +112,12 @@ def _download_packaged_file(self):
with zipfile.ZipFile(zip_file_path, "r") as zip_refzip:
zip_refzip.extractall(path=built_function_path)

file_list = zip_refzip.namelist()

for extracted_file in file_list:
permission_mask = oct(os.stat(os.path.join(built_function_path, extracted_file)).st_mode)[-3:]
LOG.info("Extracted file %s, with permission mask %s", extracted_file, permission_mask)


class DefaultSyncStage(EndToEndBaseStage):
def run_stage(self) -> CommandResult:
Expand Down

0 comments on commit 5dedfbb

Please sign in to comment.