-
Notifications
You must be signed in to change notification settings - Fork 21
Add fixture/snapshot tests #101
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
Merged
Merged
Conversation
This file contains 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
Add tests that transform vendored API responses (fixtures) into vendored /metrics output (snapshots), so that we can see how changes to the exporter implementation affect the actual output of the exporter, in the form of changes to the snapshots. I've sourced the fixtures from debug JSON logging of real API responses from tasks running in AWS. Each task consisted of an ecs_exporter container and a prometheus container. My expectation is that fixtures should not be updated unless we become informed that API responses have materially changed, e.g. because new features we are using were added, or breaking changes have been made. I've got two sets of fixtures and snapshots, one for EC2 and one for Fargate. The API responses differ between EC2 and Fargate enough (because, among other things, they use two completely different implementations of the task metadata API, and two different container runtimes entirely!) that I think it's worth covering them both independently. Closes prometheus-community#99. Signed-off-by: Ian Kerins <[email protected]>
Compare to the sibling metric whose name is spelled correctly: ecs_network_receive_packets_dropped_total. This commit shows the snapshot tests in action. Signed-off-by: Ian Kerins <[email protected]>
Merged
As the updated task stats fixture for EC2 shows, stopped containers in EC2 have the empty JSON object for their stats, instead of the `null` that Fargate has, which triggered a nil pointer dereference that is now fixed. Signed-off-by: Ian Kerins <[email protected]>
sysadmind
reviewed
Feb 28, 2025
Signed-off-by: Ian Kerins <[email protected]>
Signed-off-by: Ian Kerins <[email protected]>
sysadmind
approved these changes
Mar 18, 2025
Thanks again for the reviews! |
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.
Add tests that transform vendored API responses (fixtures) into vendored
/metrics output (snapshots), so that we can see how changes to the
exporter implementation affect the actual output of the exporter, in the
form of changes to the snapshots.
I've sourced the fixtures from debug JSON logging of real API responses
from tasks running in AWS. Each task consisted of an ecs_exporter
container and a prometheus container.
My expectation is that fixtures should not be updated unless we become
informed that API responses have materially changed, e.g. because new
features we are using were added, or breaking changes have been made.
I've got two sets of fixtures and snapshots, one for EC2 and one for
Fargate. The API responses differ between EC2 and Fargate
enough (because, among other things, they use two completely different
implementations of the task metadata API, and two different container
runtimes entirely!) that I think it's worth covering them both
independently.
Closes #99.