moto icon indicating copy to clipboard operation
moto copied to clipboard

Instance object never sets iam_instance_profile

Open albinvass opened this issue 5 years ago • 1 comments

Hi!

I was trying to set up some tests that makes sure an instance profile is attached to an ec2 instance on creation but ran into the issue that the test object was missing the iam_instance_profile attribute.

I added a small test to show what's fails with the following TraceBack:

Traceback (most recent call last):
  File "/home/avass/git/github/albinvass/moto/.tox/py37/lib/python3.7/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/avass/git/github/albinvass/moto/moto/core/models.py", line 98, in wrapper
    result = func(*args, **kwargs)
  File "/home/avass/git/github/albinvass/moto/tests/test_ec2/test_instances.py", line 219, in test_instance_iam_instance_profile
    assert instance_profile_arn == instance.iam_instance_profile["Arn"]
TypeError: 'NoneType' object is not subscriptable

albinvass avatar Jun 10 '20 20:06 albinvass

Thanks for raising this, and providing a test case, @albinvass!

bblommers avatar Jun 11 '20 05:06 bblommers

This functionality is now implemented with #5617

bblommers avatar Oct 29 '22 22:10 bblommers