-
Notifications
You must be signed in to change notification settings - Fork 13
Add --force flag to target command
#286
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,6 +118,32 @@ var _ = Describe("Target", func() { | |||||||||
| }) | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| Describe("when --force is set", func() { | ||||||||||
| It("saves the target without making a connectivity check", func() { | ||||||||||
| // No handler registered — any real request would cause the test server to fail. | ||||||||||
| // We verify no /info call is made by not registering a handler and still expecting success. | ||||||||||
| session := runCommand("target", server.URL(), "--force") | ||||||||||
|
|
||||||||||
| Eventually(session).Should(Exit(0)) | ||||||||||
| Eventually(session.Out).Should(Say("Target set to " + server.URL())) | ||||||||||
| Expect(config.ReadConfig().GetActiveTarget().BaseUrl).To(Equal(server.URL())) | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| It("saves the target even when the UAA is unreachable", func() { | ||||||||||
| session := runCommand("target", "http://does-not-exist.invalid", "--force") | ||||||||||
|
|
||||||||||
| Eventually(session).Should(Exit(0)) | ||||||||||
| Eventually(session.Out).Should(Say("Target set to http://does-not-exist.invalid")) | ||||||||||
| Expect(config.ReadConfig().GetActiveTarget().BaseUrl).To(Equal("http://does-not-exist.invalid")) | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| It("respects --skip-ssl-validation together with --force", func() { | ||||||||||
| runCommand("target", server.URL(), "--force", "--skip-ssl-validation") | ||||||||||
|
|
||||||||||
|
Comment on lines
+141
to
+142
|
||||||||||
| runCommand("target", server.URL(), "--force", "--skip-ssl-validation") | |
| session := runCommand("target", server.URL(), "--force", "--skip-ssl-validation") | |
| Eventually(session).Should(Exit(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
--force, the code skipsapi.GetInfo()entirely, which also means we no longer validate thatnewTargetis 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/infocall.