Conversation
Allows skipping connectivity checks
There was a problem hiding this comment.
Pull request overview
Adds a --force flag to the uaa target command so users can persist a target URL without performing the usual connectivity check against /info.
Changes:
- Document
--force/-fforuaa target, including an example invocation. - Add
--forceflag wiring to thetargetcommand and skip the/infoconnectivity check when set. - Add CLI integration tests covering the new
--forcebehavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/commands/target.md | Documents the new --force flag and provides an example usage. |
| cmd/target.go | Implements --force by conditionally skipping the /info connectivity check. |
| cmd/target_test.go | Adds tests verifying that --force skips connectivity checks and still saves config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if !forceTarget { | ||
| api := GetUnauthenticatedAPIFromConfig(cfg) | ||
| _, err := api.GetInfo() | ||
| if err != nil { | ||
| return errors.New(fmt.Sprintf("The target %s could not be set: %v", newTarget, err.Error())) | ||
| } | ||
| } |
There was a problem hiding this comment.
With --force, the code skips api.GetInfo() entirely, which also means we no longer validate that newTarget is a syntactically valid URL. This can result in persisting an invalid target (e.g., missing scheme/host) that later causes panics/failures when creating a UAA client. Consider adding a lightweight URL parse/validation step that always runs (even when --force), while still skipping the network /info call.
| runCommand("target", server.URL(), "--force", "--skip-ssl-validation") | ||
|
|
There was a problem hiding this comment.
This test relies on runCommand(...) succeeding but doesn't assert the exit code. Adding an explicit Eventually(session).Should(Exit(0)) (and capturing the session) would make failures clearer and ensure the combined --force + --skip-ssl-validation path is actually exercised successfully.
| runCommand("target", server.URL(), "--force", "--skip-ssl-validation") | |
| session := runCommand("target", server.URL(), "--force", "--skip-ssl-validation") | |
| Eventually(session).Should(Exit(0)) |
Allows skipping connectivity checks