python-tuf icon indicating copy to clipboard operation
python-tuf copied to clipboard

Add test coverage for delegated hash bins target download

Open ivanayov opened this issue 3 years ago • 3 comments

This change adds tests coverage for path_hash_prefixes and verifies that role names matching specific prefixed successfully find and download the corresponding metadata files and do not succeed to find existing, but non-matching files

Fixes https://github.com/theupdateframework/python-tuf/issues/1639

Follow-up of #1808

  • [x] The code follows the Code Style Guidelines
  • [x] Tests have been added for the bug fix or new feature
  • [n/a] Docs have been added for the bug fix or new feature

ivanayov avatar Mar 18 '22 16:03 ivanayov

Pull Request Test Coverage Report for Build 2027942163

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.312%

Totals Coverage Status
Change from base Build 2022257279: 0.0%
Covered Lines: 1179
Relevant Lines: 1195

💛 - Coveralls

coveralls avatar Mar 18 '22 16:03 coveralls

I've not given this the review it needed, sorry... This vaguely looks like we could do better but I can't immediately see the better way: did you consider having the same test setup as in the existing downloads test test_targetfile_search() -- so there would be

  • staticly defined metadata structure: it could be the same delegations_tree already defined in the file, just added with a targets metadata that does hashed bin delegations
  • test cases would then only have to define a target path to search for, search result and the expected visited order

This would not make the current test much shorter but it might mean that adding a new test case would be maybe 2 lines instead of 40 lines of test data that it is now?

jku avatar Apr 20 '22 07:04 jku

Is this superseded by #2031? Should we think about deprecating path_hash_prefixes now that TAP 15 has landed? (see see https://github.com/theupdateframework/taps/issues/132#issuecomment-1115175226)

lukpueh avatar Aug 09 '22 09:08 lukpueh

Is this superseded by #2031?

I think so. I wouldn't object to a tight client test specifically for hashed bins but I don't think it's super important, and this PR is 80 lines of test code for very limited (new) test functionality.

jku avatar Oct 10 '22 10:10 jku