Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/integration/deploy/test_deploy_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1756,16 +1756,16 @@ def test_deploy_with_valid_config_capabilities_string(self, template_file, confi
deploy_process_execute = self.run_command(deploy_command_list)
self.assertEqual(deploy_process_execute.process.returncode, 0)

@skipIf(SKIP_LMI_TESTS, "Skip LMI tests when running on canary")
@skipIf(
SKIP_LMI_TESTS,
'Skip LMI tests because required environment variables not set: "LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"',
)
def test_deploy_lmi_function(self):
"""Test deployment of LMI (Lambda Managed Infrastructure) functions with capacity providers."""
# Validate LMI environment variables are set
lmi_subnet_id = os.environ.get("LMI_SUBNET_ID")
lmi_security_group_id = os.environ.get("LMI_SECURITY_GROUP_ID")

self.assertTrue(lmi_subnet_id, "LMI_SUBNET_ID environment variable must be set")
self.assertTrue(lmi_security_group_id, "LMI_SECURITY_GROUP_ID environment variable must be set")

template_path = self.test_data_path.joinpath("lmi_function", "template.yaml")
stack_name = self._method_to_stack_name(self.id())
self.stacks.append({"name": stack_name})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,17 @@ def test_invoke_different_boto_options(self):
self.assertEqual(response_event_stream, expected_output_result)


@skipIf(SKIP_LMI_TESTS, "Skip LMI tests when running on canary")
@skipIf(
SKIP_LMI_TESTS,
'Skip LMI tests because required environment variables not set: "LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"',
)
class TestInvokeResponseStreamingCapacityProvider(RemoteInvokeIntegBase):
template = Path("template-lambda-response-capacity-provider-stream-fn.yaml")

@classmethod
def setUpClass(cls):
if SKIP_LMI_TESTS:
raise SkipTest("Skip LMI tests when running on canary")
super().setUpClass()
cls.stack_name = f"{cls.__name__}-{uuid.uuid4().hex}"
# LMI is Lambda Managed Instance
assert os.environ.get("LMI_SUBNET_ID"), "LMI_SUBNET_ID environment variable must be set"
assert os.environ.get("LMI_SECURITY_GROUP_ID"), "LMI_SECURITY_GROUP_ID environment variable must be set"

# Read LMI infrastructure from environment variables
cls.parameter_overrides = {
Expand Down
10 changes: 4 additions & 6 deletions tests/integration/remote/invoke/test_remote_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@
SQS_WAIT_TIME_SECONDS = 20


@skipIf(SKIP_LMI_TESTS, "Skip LMI tests when running on canary")
@skipIf(
SKIP_LMI_TESTS,
'Skip LMI tests because required environment variables not set: "LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"',
)
class TestingInvokeWithCapacityProvider(RemoteInvokeIntegBase):
template = Path("template-single-lambda-capacity-provider.yaml")

@classmethod
def setUpClass(cls):
if SKIP_LMI_TESTS:
raise SkipTest("Skip LMI tests when running on canary")
super().setUpClass()
cls.stack_name = f"{cls.__name__}-{uuid.uuid4().hex}"
# LMI is Lambda Managed Instance
assert os.environ.get("LMI_SUBNET_ID"), "LMI_SUBNET_ID environment variable must be set"
assert os.environ.get("LMI_SECURITY_GROUP_ID"), "LMI_SECURITY_GROUP_ID environment variable must be set"

# Read LMI infrastructure from environment variables
cls.parameter_overrides = {
Expand Down
12 changes: 5 additions & 7 deletions tests/integration/sync/test_sync_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import uuid
from pathlib import Path
from typing import Dict
from unittest import skipIf, SkipTest
from unittest import skipIf


import pytest
Expand Down Expand Up @@ -803,7 +803,10 @@ def test_skip_build(self):
]
)
@pytest.mark.timeout(300)
@skipIf(SKIP_LMI_TESTS, "Skip LMI tests when running on canary")
@skipIf(
SKIP_LMI_TESTS,
'Skip LMI tests because required environment variables not set: "LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"',
)
class TestSyncCodeLMI(TestSyncCodeBase):
"""Test sync code operations with Lambda Managed Instance functions"""

Expand All @@ -812,12 +815,7 @@ class TestSyncCodeLMI(TestSyncCodeBase):

@classmethod
def setUpClass(cls) -> None:
if SKIP_LMI_TESTS:
raise SkipTest("Skip LMI tests when running on canary")
super().setUpClass()
# Validate LMI environment variables are set
assert os.environ.get("LMI_SUBNET_ID"), "LMI_SUBNET_ID environment variable must be set"
assert os.environ.get("LMI_SECURITY_GROUP_ID"), "LMI_SECURITY_GROUP_ID environment variable must be set"

# Read LMI infrastructure from environment variables
cls.parameter_overrides = {
Expand Down
11 changes: 4 additions & 7 deletions tests/integration/sync/test_sync_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,10 @@ def test_sync_infra_esbuild(self, template_file):
self.assertEqual(lambda_response.get("message"), "hello world")


@skipIf(SKIP_LMI_TESTS, "Skip LMI tests when running on canary")
@skipIf(
SKIP_LMI_TESTS,
'Skip LMI tests because required environment variables not set: "LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"',
)
@parameterized_class(
[
{"dependency_layer": True},
Expand All @@ -603,13 +606,7 @@ class TestSyncInfraLMI(SyncIntegBase):

@classmethod
def setUpClass(cls) -> None:
if SKIP_LMI_TESTS:
raise SkipTest("Skip LMI tests when running on canary")
super().setUpClass()
# Validate LMI environment variables are set
assert os.environ.get("LMI_SUBNET_ID"), "LMI_SUBNET_ID environment variable must be set"
assert os.environ.get("LMI_SECURITY_GROUP_ID"), "LMI_SECURITY_GROUP_ID environment variable must be set"

# Read LMI infrastructure from environment variables
cls.parameter_overrides = {
"SubnetId": os.environ.get("LMI_SUBNET_ID", ""),
Expand Down
12 changes: 4 additions & 8 deletions tests/integration/sync/test_sync_watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,10 @@ def test_sync_watch_code_excludes(self):
self.assertEqual(lambda_response.get("message"), "hello world")


@skipIf(SKIP_LMI_TESTS, "Skip LMI tests when running on canary")
@skipIf(
SKIP_LMI_TESTS,
'Skip LMI tests because required environment variables not set: "LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"',
)
@parameterized_class([{"dependency_layer": True}, {"dependency_layer": False}])
@pytest.mark.timeout(600) # 10 minutes timeout for LMI operations
class TestSyncWatchCodeLMI(TestSyncWatchBase):
Expand All @@ -880,13 +883,6 @@ class TestSyncWatchCodeLMI(TestSyncWatchBase):

@classmethod
def setUpClass(cls) -> None:
# Skip the entire class if LMI tests should be skipped
if SKIP_LMI_TESTS:
raise SkipTest("Skip LMI tests when running on canary")

# Validate LMI environment variables are set
assert os.environ.get("LMI_SUBNET_ID"), "LMI_SUBNET_ID environment variable must be set"
assert os.environ.get("LMI_SECURITY_GROUP_ID"), "LMI_SECURITY_GROUP_ID environment variable must be set"

cls.template_before = str(Path("code", "before", "template-lmi-with-publish.yaml"))
cls.parameter_overrides = {
Expand Down
8 changes: 5 additions & 3 deletions tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
# Tests require docker suffers from Docker Hub request limit
SKIP_DOCKER_TESTS = RUNNING_ON_CI and not RUN_BY_CANARY

# SKIP_LMI_TESTS = RUNNING_ON_CI and not RUN_BY_CANARY
# SKIP LMI until test resource is deployed
SKIP_LMI_TESTS = True

# SKIP LMI unless test resource is deployed in the test accounts
# Check if required environment variables are available
SKIP_LMI_TESTS = not all(os.environ.get(var) for var in ["LMI_SUBNET_ID", "LMI_SECURITY_GROUP_ID"])


# Set to True temporarily if the integration tests require updated build images
# Build images aren't published until after the CLI is released
Expand Down
Loading