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 test_dependencies only checking dependency count #3298

Merged
merged 3 commits into from Dec 12, 2022

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Nov 30, 2022

Signed-off-by: Patrick Roy roypat@amazon.co.uk

Changes

This commit changes to the to

  1. fix the above issues (do not use pprint and check the actual dependency set instead of just its len)
  2. ignore dependency versions, and only care about their names (meaning updates to a dependency will not trigger the test)

Reason

Only checking the number of dependencies allowed dependencies to be replaced without the test failing, as long as the overall number of lines in the dependencies.txt file was correct.

Note that due to the use of pprint automatically wrapping lines at 80 characters, the file contained more lines than dependencies, making the check even more inaccurate (dependencies with long paths/git urls werevbroken up into multiple lines, leading to a leniency of two dependencies that could be added without the test failing).

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.

PR Checklist

  • All commits in this PR are signed (git commit -s).
  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • New unsafe code is documented.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

  • This functionality can be added in rust-vmm.

@andreeaflorescu
Copy link
Member

andreeaflorescu commented Nov 30, 2022

The version of dependencies though might still be a valid check because in most cases you don't want to end up using more than one version of the crate even if they're compatible.

@roypat
Copy link
Contributor Author

roypat commented Nov 30, 2022

The version of dependencies though might still be a valid check because in most cases you don't want to end up using more than one version of the crate even if they're compatible.

Oh this is a very good point, but should maybe go into a separate test that verifies that no different versions of the same dependency are used. From my understanding the point test_num_dependencies was solely to make the process of adding new dependencies explicitly go through review.

@roypat roypat self-assigned this Nov 30, 2022
@andreeaflorescu
Copy link
Member

Oh this is a very good point, but should maybe go into a separate test that verifies that no different versions of the same dependency are used. From my understanding the point test_num_dependencies was solely to make the process of adding new dependencies explicitly go through review.

That is correct, it was serving the purpose of not using multiple versions of the same crate indirectly though. From my understanding (which might be veeeeery outdated) if you have for example vm-memory v0.9.0 and vm-memory v0.10.0 then this will show up as a "new dependency" because vm-memory would be counted twice. In the end is better to make it explicit instead like you suggested.

@roypat
Copy link
Contributor Author

roypat commented Nov 30, 2022

Oh this is a very good point, but should maybe go into a separate test that verifies that no different versions of the same dependency are used. From my understanding the point test_num_dependencies was solely to make the process of adding new dependencies explicitly go through review.

That is correct, it was serving the purpose of not using multiple versions of the same crate indirectly though. From my understanding (which might be veeeeery outdated) if you have for example vm-memory v0.9.0 and vm-memory v0.10.0 then this will show up as a "new dependency" because vm-memory would be counted twice. In the end is better to make it explicit instead like you suggested.

I just drafted such a test and interestingly enough it does not pass, even though we ran cargo update just 2 days ago. If we transitively depend on incompatible versions of the same crate (in our case, memoffset 0.6.5 and 0.7.1) there is nothing we can do about it, so I don't think we can add this as part of our CI (at least not easily)

dianpopa
dianpopa previously approved these changes Dec 1, 2022
tests/integration_tests/build/test_dependencies.py Outdated Show resolved Hide resolved
This allowed dependencies to be replaced without the test failing, as
long as the overall number of lines in the dependencies.txt file was
correct.

Note that due to the use of pprint automatically wrapping lines at 80
characters, the file contained more lines than dependencies, making
the check even more inaccurate (dependencies with long paths/git urls
werevbroken up into multiple lines, leading to a leniency of two
dependencies that could be added without the test failing).

This commit changes to the to
1. fix the above issues
2. ignore dependency versions, and only care about their names
   (meaning updates to a dependency will not trigger the test)

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
@dianpopa dianpopa merged commit 35d0c75 into firecracker-microvm:main Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants