Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Migrate IAM AWS managed policy tests from moto to LS#13767

Merged
dfangl merged 3 commits into
iam/moto-migrationfrom
daniel/unc-240
Feb 17, 2026
Merged

Migrate IAM AWS managed policy tests from moto to LS#13767
dfangl merged 3 commits into
iam/moto-migrationfrom
daniel/unc-240

Conversation

@dfangl

@dfangl dfangl commented Feb 13, 2026

Copy link
Copy Markdown
Member

Motivation

We also want to migrate the IAM managed policy tests. As with the other PRs, this will for now skip most of the new tests, and the tests are migrated to LocalStack standards.

Changes

Moto Source File Moto Test Function LocalStack File LocalStack Class LocalStack Test Method Notes
test_iam.py:789 test_get_aws_managed_policy test_iam_managed_policies.py TestGetAwsManagedPolicy test_get_aws_managed_policy Replaced region parametrization with partition fixture
test_iam.py:830 test_get_aws_managed_policy_version test_iam_managed_policies.py TestGetAwsManagedPolicy test_get_aws_managed_policy_version Same coverage (error + success for v1)
test_iam.py:853 test_get_aws_managed_policy_v8_version test_iam_managed_policies.py TestGetAwsManagedPolicy test_get_aws_managed_policy_higher_version Uses dynamic version discovery instead of hardcoded v8
test_iam.py:2036 test_managed_policy (list scope parts) test_iam_managed_policies.py TestListPoliciesScope test_list_policies_scope_local, test_list_policies_scope_aws, test_list_policies_scope_all Split into focused tests; uses MaxItems and assertions to avoid brittle large snapshots
test_iam.py:2036 test_managed_policy (attach/detach parts) test_iam_managed_policies.py TestListPoliciesScope test_list_policies_only_attached OnlyAttached filter with attach/detach verification
test_iam.py:2036 test_managed_policy (role attach/detach + errors) test_iam_roles.py TestRoleManagedPolicies test_attach_detach_aws_managed_policy_role Moved to roles module; includes error cases for detaching already-detached and non-existent policies
test_iam_groups.py:217 test_attach_group_policies test_iam_groups.py TestAttachAwsManagedPolicyToGroup test_attach_detach_aws_managed_policy_group Same coverage with snapshot testing
test_iam_resets.py:11 test_policies_are_not_kept_after_mock_ends - - - Skipped: moto-specific (tests mock reset behavior)
test_iam_resets.py:46 test_policies_are_loaded_when_using_env_variable - - - Skipped: moto-specific (tests env variable config)
test_iam.py:2449 test_get_account_authorization_details - - - Skipped: out of scope for this migration

Tests

Tests are manually verified, and run against AWS both with and without snapshot updates.

Related

Closes UNC-240

@dfangl dfangl added the semver: patch Non-breaking changes which can be included in patch releases label Feb 13, 2026
@dfangl dfangl requested a review from pinzon as a code owner February 13, 2026 14:57
@dfangl dfangl added docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases labels Feb 13, 2026
@github-actions

github-actions Bot commented Feb 13, 2026

Copy link
Copy Markdown

Test Results - Preflight, Unit

23 123 tests  ±0   21 252 ✅ ±0   7m 7s ⏱️ + 1m 1s
     1 suites ±0    1 871 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 260aa69. ± Comparison against base commit aabae16.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 13, 2026

Copy link
Copy Markdown

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   2m 41s ⏱️ - 2h 1m 38s
471 tests  - 5 091  254 ✅  - 4 741  217 💤  - 350  0 ❌ ±0 
473 runs   - 5 091  254 ✅  - 4 741  219 💤  - 350  0 ❌ ±0 

Results for commit 260aa69. ± Comparison against base commit aabae16.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 13, 2026

Copy link
Copy Markdown

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 0s ⏱️ ±0s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 413561a. ± Comparison against base commit 7211a8d.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 13, 2026

Copy link
Copy Markdown

Test Results (amd64) - Integration, Bootstrap

  5 files  ±    0    5 suites  ±0   9m 50s ⏱️ - 2h 27m 37s
472 tests  - 5 495  261 ✅  - 4 983  211 💤  - 512  0 ❌ ±0 
478 runs   - 5 495  261 ✅  - 4 983  217 💤  - 512  0 ❌ ±0 

Results for commit 413561a. ± Comparison against base commit 7211a8d.

♻️ This comment has been updated with latest results.

@pinzon pinzon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM but there is one change request to be addressed.

Comment on lines +134 to +136
paginator = aws_client.iam.get_paginator("list_policies")
result = paginator.paginate().build_full_result()
all_policy_names = {p["PolicyName"] for p in result["Policies"]}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

comment: 😅 I guess we're not snapshoting this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope, not for now 😅

Comment on lines +194 to +195
class TestAttachAwsManagedPolicyToGroup:
"""Tests for attaching/detaching AWS-managed policies to/from groups."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change: I think that at some point this was the original location of test_attach_detach_aws_managed_policy_group that now is in the test_iam_groups.py file. Lets remove this class if it's not necessary anymore.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I forgot about that one when moving, will do!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed!

@github-actions

Copy link
Copy Markdown

S3 Image Test Results (AMD64 / ARM64)

    2 files      2 suites   7m 42s ⏱️
  564 tests   512 ✅  52 💤 0 ❌
1 128 runs  1 024 ✅ 104 💤 0 ❌

Results for commit a54e953.

@dfangl dfangl removed the request for review from k-a-il February 17, 2026 13:03
@dfangl dfangl force-pushed the iam/moto-migration branch from 7211a8d to aabae16 Compare February 17, 2026 13:30

@pinzon pinzon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for addressing the request.

@dfangl dfangl merged commit 26d1129 into iam/moto-migration Feb 17, 2026
13 checks passed
@dfangl dfangl deleted the daniel/unc-240 branch February 17, 2026 15:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes 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.

2 participants