test: split SSH key config parsing and key generation tests#380
Merged
Conversation
Generating keys for every parsing case made the test take seconds due to repeated RSA-4096 generation. Parsing cases now only call newKeyConfig, and Generate is exercised once per code path with the cheapest RSA size.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the SSH key configuration tests to reduce runtime by decoupling configuration parsing coverage from expensive key generation.
Changes:
- Split the former combined parsing+generation test into a parsing-only table test (
TestNewKeyConfig_ByKeyType) and a generation-focused test (TestKeyConfigGenerate). - Limit RSA key generation coverage to a single (cheapest allowed) size while keeping one test per ECDSA curve and ED25519 generation path.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #380 +/- ##
==========================================
+ Coverage 86.06% 86.20% +0.14%
==========================================
Files 40 40
Lines 2828 2828
==========================================
+ Hits 2434 2438 +4
+ Misses 269 265 -4
Partials 125 125
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 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.
Related Tickets & Documents
Changes
TestNewKeyConfigAndGenerate_ByKeyTypeinto two tests:TestNewKeyConfig: all 12 parsing cases, no key generationTestKeyConfigGenerate: one case perGeneratecode path (ed25519, ECDSA 256/384/521, RSA 2048)Notes
Generate, so the RSA cases dominated the test runtime (1.5-4s out of ~12s total, sample build)rsakey type with default bits, once viassh-rsaGeneratedoes not vary by key size, so a single 2048-bit case covers it