Skip to content
Open
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
289 changes: 267 additions & 22 deletions src/integrations/prefect-aws/prefect_aws/observers/ecs.py

Large diffs are not rendered by default.

556 changes: 115 additions & 441 deletions src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/integrations/prefect-aws/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ dev = [
"mkdocs-gen-files",
"mkdocs-material",
"mkdocstrings-python-legacy",
# moto 4.2.5 broke something fairly deep in our test suite https://github.com/PrefectHQ/prefect-aws/issues/318
"moto[cloudformation]>=3.1.16,<4.2.5",
"moto[cloudformation]>=5",
"mypy",
"pillow",
"pytest >= 8.3",
Expand Down
16 changes: 8 additions & 8 deletions src/integrations/prefect-aws/tests/cli/test_ecs_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import boto3
import pytest
from moto import mock_cloudformation, mock_ec2, mock_ecs, mock_sts
from moto import mock_aws
from prefect_aws._cli.main import app
from prefect_aws.workers import ECSWorker
from typer.testing import CliRunner
Expand All @@ -27,7 +27,7 @@ def aws_credentials(monkeypatch):
@pytest.fixture
def mock_aws_resources():
"""Create common AWS resources for testing."""
with mock_ecs(), mock_ec2(), mock_cloudformation(), mock_sts():
with mock_aws():
# Create VPC
ec2 = boto3.client("ec2", region_name="us-east-1")
vpc_response = ec2.create_vpc(CidrBlock="10.0.0.0/16")
Expand Down Expand Up @@ -258,7 +258,7 @@ def test_deploy_events_dry_run(

def test_list_stacks(self, aws_credentials):
"""Test list stacks command."""
with mock_cloudformation(), mock_sts():
with mock_aws():
# Create a test stack with CLI tags
cf = boto3.client("cloudformation", region_name="us-east-1")
cf.create_stack(
Expand All @@ -281,7 +281,7 @@ def test_list_stacks(self, aws_credentials):

def test_list_stacks_json_format(self, aws_credentials):
"""Test list stacks command with JSON output."""
with mock_cloudformation(), mock_sts():
with mock_aws():
# Create a test stack with CLI tags
cf = boto3.client("cloudformation", region_name="us-east-1")
cf.create_stack(
Expand All @@ -304,7 +304,7 @@ def test_list_stacks_json_format(self, aws_credentials):

def test_stack_status(self, aws_credentials):
"""Test stack status command."""
with mock_cloudformation(), mock_sts():
with mock_aws():
# Create a test stack with CLI tags
cf = boto3.client("cloudformation", region_name="us-east-1")
cf.create_stack(
Expand All @@ -326,7 +326,7 @@ def test_stack_status(self, aws_credentials):

def test_stack_status_not_cli_managed(self, aws_credentials):
"""Test stack status command for non-CLI managed stack."""
with mock_cloudformation(), mock_sts():
with mock_aws():
# Create a test stack without CLI tags
cf = boto3.client("cloudformation", region_name="us-east-1")
cf.create_stack(
Expand All @@ -350,7 +350,7 @@ def test_stack_status_not_cli_managed(self, aws_credentials):

def test_delete_stack_force(self, aws_credentials):
"""Test delete stack command with force flag."""
with mock_cloudformation(), mock_sts():
with mock_aws():
# Create a test stack with CLI tags
cf = boto3.client("cloudformation", region_name="us-east-1")
cf.create_stack(
Expand Down Expand Up @@ -379,7 +379,7 @@ def test_delete_stack_force(self, aws_credentials):

def test_delete_stack_no_wait(self, aws_credentials):
"""Test delete stack command with --no-wait flag."""
with mock_cloudformation(), mock_sts():
with mock_aws():
# Create a test stack with CLI tags
cf = boto3.client("cloudformation", region_name="us-east-1")
cf.create_stack(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import boto3
import pytest
from moto import mock_s3
from moto import mock_aws
from prefect_aws import AwsCredentials
from prefect_aws.deployments.steps import get_s3_client, pull_from_s3, push_to_s3

Expand All @@ -22,7 +22,7 @@ def set_custom_endpoint():

@pytest.fixture
def s3_setup():
with mock_s3():
with mock_aws():
bucket_name = "my-test-bucket"
s3 = boto3.client("s3")
s3.create_bucket(Bucket=bucket_name)
Expand Down
Loading