add imdsv2 mocking to instance_metadata endpoints#9891
Open
markjm wants to merge 2 commits intogetmoto:masterfrom
Open
add imdsv2 mocking to instance_metadata endpoints#9891markjm wants to merge 2 commits intogetmoto:masterfrom
markjm wants to merge 2 commits intogetmoto:masterfrom
Conversation
Thank you for this great project. Reporting and fixing a few missing endpoints when IMDSv2 is enabled! Please let me know if im missing something. ----- I added a gist with some repro tests here https://gist.github.com/markjm/efae7f71c8dd58d0e3c118097140b0d9 (claude helped with a quick repro creation) Basically, when IMDSv2 is enabled, there are expected calls to `/latest/api/token` which we want to return a fake token, then also some extra metadata paths which we may care about Added the imdsv2 path + those extra possible metadata. And added tests for the same.
Author
|
I presume most cases under mock wouldnt even try to get credentials, but we have code specifically using |
Author
|
thanks @bblommers for kicking off the tests. didnt initially notice the servertests, so fixed that up as well! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9891 +/- ##
========================================
Coverage 93.12% 93.12%
========================================
Files 1314 1314
Lines 119307 119436 +129
========================================
+ Hits 111102 111230 +128
- Misses 8205 8206 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for this great project. Reporting and fixing a few missing endpoints when IMDSv2 is enabled! Please let me know if im missing something (i read through the contributing guide and think i did everything by the book)
I added a gist with some repro tests here https://gist.github.com/markjm/efae7f71c8dd58d0e3c118097140b0d9 (claude helped with a quick repro creation)
Basically, when IMDSv2 is enabled, there are expected calls to
/latest/api/tokenwhich we want to return a fake token, then also some extra metadata paths which we may care aboutAdded the imdsv2 path + those extra possible metadata. And added tests for the same.