-
Notifications
You must be signed in to change notification settings - Fork 942
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
Validate -i value for ssh command is an existing app instance #1131
Validate -i value for ssh command is an existing app instance #1131
Conversation
Without this change, passing a -i value that is equal to or greater than the total number of instances the application has results in a cryptic error message about the ssl handshake, which can lead users down a false trail.
Hey davwards! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA. |
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/144799125 The labels on this github issue will be updated when the story is started. |
@davwards When I have one running instance of the app "my-app", the following no longer works:
The However, the calling function that runs |
I see! That suggests that the way I simulated the situation in |
@davwards At the layer that was being unit-ish tested, you were doing the right thing. The correct way to expose this bug would be through integration tests. You can add a test for this here, and you can use this as an example. |
Hi all; I'm getting pulled off the Labs beach, so my available time to work on this is diminishing. Getting the bosh-light integration test environment set up is proving pretty difficult. All this to say, I don't expect to be able to deliver an integration-test-driven fix soon. @nickwei84, I also feel like my understanding of the test setup is incomplete; it seems odd to me that the unit test I wrote could be correct, given that the implementation was completely broken. Is there not a way to simulate the life-like behavior of |
@davwards I'd recommend getting a PWS account and test against that. |
@davwards Please let us know if you think you won't be able to get to this any time soon and would like us to finish the job. |
@dkoper Indeed, feel free to wrap this up; I don't want it to get stuck in limbo waiting on me. |
- Handles integration testing - Happy path now works - Moved invalid -i checks from Requirements to Execute - Changed error strings to reflect the new location of the check [Finishes #144799125] Signed-off-by: Stu Pollock <spollock@pivotal.io>
resolved the issues which arose in an initial review |
What Need Does It Address?
Without this change, passing a -i value that is equal to or greater than
the total number of instances the application has results in a cryptic
error message about the ssl handshake, which can lead users down a false
trail.
Possible Drawbacks
To keep the validation checks for the
-i
flag together, I moved the not-negative validation check after the creation ofcmd.opts
andcmd.appReq
. No tests were upset by this, but it could be the case that due to factors I didn't catch--if populatingcmd.appReq
is expensive, for instance--this could result in slower feedback when you enter a negative value for-i
.Also, I didn't add any i18n translations for the new message. Note: When trying to run
bin/i18n-checkup
, I observed that the schema of the translation.json
files was completely changed. On Slack,@anand
indicated that this was probably due to the fact that the team is using a particular version ofi18n4go
that is different than the one I got withgo get
, and that I should not make any changes to the translation files and submit anyway.Why Should This Be In Core?
It improves the messaging of a core feature, as opposed to adding new functionality.
Description of the Change
In addition to checking that the
-i
value is non-negative, fetch the InstanceCount of the specified application and ensure the-i
value is less than that. If not, fail with a descriptive message.Applicable Issues
#1130