Skip to content
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

fix clouformation ec2 tests for ap-northeast-1 and validate against AWS #10563

Merged
merged 2 commits into from Mar 29, 2024

Conversation

sannya-singal
Copy link
Contributor

@sannya-singal sannya-singal commented Mar 28, 2024

Motivation

Test test_vpc_creates_default_sg and test_transit_gateway_attachmentfail when run in the workflow for region: ap-northeast-1 and throws a StackDeployError.

Changes

This PR validates test: test_vpc_creates_default_sg against AWS and deploys both the tests specifically in us-east-1.

@sannya-singal sannya-singal added the semver: patch Non-breaking changes which can be included in patch releases label Mar 28, 2024
@sannya-singal sannya-singal self-assigned this Mar 28, 2024
@sannya-singal sannya-singal marked this pull request as ready for review March 28, 2024 06:36
@sannya-singal sannya-singal marked this pull request as draft March 28, 2024 06:38
@sannya-singal sannya-singal changed the title fix test_vpc_creates_default_sg and validate against AWS fix clouformation ec2 tests for ap-northeast-1 and validate against AWS Mar 28, 2024
@sannya-singal sannya-singal marked this pull request as ready for review March 28, 2024 06:53
Copy link

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 29m 31s ⏱️ +3s
2 740 tests ±0  2 484 ✅ ±0  256 💤 ±0  0 ❌ ±0 
2 742 runs  ±0  2 484 ✅ ±0  258 💤 ±0  0 ❌ ±0 

Results for commit 67e5248. ± Comparison against base commit 3b8099b.

@sannya-singal
Copy link
Contributor Author

we need to update the region values in: moto.ec2.models.availability_zones_and_regions.RegionsAndZonesBackend.

Copy link
Contributor

@Morijarti Morijarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as not to block pipeline.
However after adding missing subnet to moto, we should revert these changes

"ap-northeast-1": [
            Zone(
                region_name="ap-northeast-1",
                name="ap-northeast-1a",
                zone_id="apne1-az4",
            ),
            Zone(
                region_name="ap-northeast-1",
                name="ap-northeast-1c",
                zone_id="apne1-az1",
            ),
            Zone(
                region_name="ap-northeast-1",
                name="ap-northeast-1d",
                zone_id="apne1-az2",
            ),
        ],

in moto/ec2/models/availability_zones_and_regions.py:143

it's a bit weird that we have 1a, 1c and 1d, but not 1b on the list

@sannya-singal
Copy link
Contributor Author

when we check the availability zones for ap-northeast-1 on aws, we get the following:

{
    "AvailabilityZones": [
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "ap-northeast-1",
            "ZoneName": "ap-northeast-1a",
            "ZoneId": "apne1-az4",
            "GroupName": "ap-northeast-1",
            "NetworkBorderGroup": "ap-northeast-1",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "ap-northeast-1",
            "ZoneName": "ap-northeast-1c",
            "ZoneId": "apne1-az1",
            "GroupName": "ap-northeast-1",
            "NetworkBorderGroup": "ap-northeast-1",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "ap-northeast-1",
            "ZoneName": "ap-northeast-1d",
            "ZoneId": "apne1-az2",
            "GroupName": "ap-northeast-1",
            "NetworkBorderGroup": "ap-northeast-1",
            "ZoneType": "availability-zone"
        }
    ]
}

@Morijarti

@sannya-singal
Copy link
Contributor Author

another fix for this could be selecting 1c instead here, what do you think @Morijarti

@Morijarti
Copy link
Contributor

It would fix it in this case, but I think then that the real issue is in how Fn::GetAZs works. Let me give it a look @sannya-singal

@pinzon
Copy link
Member

pinzon commented Mar 28, 2024

I'm with @Morijarti probably it would be best if you just extend the functionality of Fn::GetAZs instead of limiting the test just to force us-east-1 in the test.

@sannya-singal
Copy link
Contributor Author

sannya-singal commented Mar 28, 2024

I'm with @Morijarti probably it would be best if you just extend the functionality of Fn::GetAZs instead of limiting the test just to force us-east-1 in the test.

Hey @pinzon! Thanks for the review. I and @Morijarti had a discussion today regarding the root cause of the issue, which is not clear. For now this has been marked approved to unblock #10546 and created a backlog item for this.

@sannya-singal sannya-singal merged commit 6c8e43f into master Mar 29, 2024
30 checks passed
@sannya-singal sannya-singal deleted the cfn_ec2_multi_acc branch March 29, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants