Repository navigation
Add tests for providerch config, AWS instance mapping, and cmd provider init - #1143
Merged
Merged
Conversation
…er init Cover providerch expandHome/GetConfig (defaults, OS normalization, bridge/cidr shorthand), mapAwsServer (Name tag, nil IPs on stopped/untagged instances), and cmd resolveOvhServiceName, ensureProvider reuse, initProvider for the local providers, and findSingleFile's embedded-file fallback. Claude-Session: https://claude.ai/code/session_012KiUZoH8ZKKKuLfMg1Hgm8
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1143 +/- ##
==========================================
+ Coverage 34.56% 36.58% +2.01%
==========================================
Files 51 51
Lines 5612 5615 +3
==========================================
+ Hits 1940 2054 +114
+ Misses 3672 3561 -111 ☔ View full report in Codecov by Harness. 🚀 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.
Summary
Adds unit tests for previously untested pure-logic code. Total statement coverage goes from 43.2% to 45.0%.
internal/providerchcmdpkg/cloudinternal/providerch/config_test.go:expandHome, including leaving~other/...untouched.GetConfigdefaults, including thechbr0bridge address, kept separate from Firecracker's.ch.osis normalized (" Windows "becomeswindows).bridge/cidrshorthand and which value wins overch.network.cidr.pkg/cloud/aws_test.go:mapAwsServerfield mapping, the name coming from theNametag, and no nil dereference when a stopped or untagged instance has no IP or name.cmd/root_provider_test.go:resolveOvhServiceNamerejects an empty value and the<service-name>placeholder.ensureProviderreuses a provider that's already built.initProviderbuildsfc,chandstaticwith config taken from viper.findSingleFilefalls back to the embedded file without network access.Notes / follow-ups (not in this PR)
TestReadConfig_NoConfigDirectoryandTestCreateFlagsBindToViperfail when a real~/.onctlexists. This predates this PR; they pass with an isolatedHOME.TestFindSingleFile_EmbeddedFilesincmd/coverage_test.goonly asserts the function is non-nil, so it can't fail. The newTestFindSingleFile_EmbeddedFallbacksupersedes it.NextApplyDiris left untested on purpose: it strips a leading/, which turns absolute paths into relative ones, and it callslog.Fatalon errors.Test plan
go vetpasses on the changed packages.go test ./cmd/passes with an isolatedHOME.🤖 Generated with Claude Code
https://claude.ai/code/session_012KiUZoH8ZKKKuLfMg1Hgm8