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
Improve FAH create & delete #6726
Conversation
inlined
commented
Jan 30, 2024
- Create now sets deployment-tool so we can track where users are coming from
- Create now sets a rollout policy like the Console
- Delete now works
- Delete no longer makes buildId required
1. Create now sets deployment-tool so we can track where users are coming from 2. Create now sets a rollout policy like the Console 3. Delete now works 4. Delete no longer makes buildId required
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #6726 +/- ##
==========================================
- Coverage 54.19% 54.17% -0.02%
==========================================
Files 347 347
Lines 24154 24163 +9
Branches 4992 4994 +2
==========================================
+ Hits 13090 13091 +1
- Misses 9865 9873 +8
Partials 1199 1199 ☔ View full report in Codecov by Sentry. |
@@ -47,21 +45,27 @@ export const command = new Command("apphosting:backends:delete") | |||
}); | |||
} | |||
|
|||
let backend: apphosting.Backend; | |||
if (backendId) { |
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.
Okay, this is odd. According to the approved proposal, the backend ID is supposed to be a required parameter, not a flag. That eliminates the need to pick a backend at all.
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.
Irrespective of the proposal, do you like this better? It seemed odd to me that location could be browsed but backend couldn't. If you like this better we can push it through API council. As an EAP API, do you feel like it is OK to release and then get approval, or should I splice this into another CL until after approval?
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.
I personally don't like it better, because I hate the prompt selector flow in a CLI 🤷♂️ It's not a wrong thing to do, but I'm assuming that there were product discussions that brought us to the API proposal (as that's a requirement at the top of the document) and that the pattern in the proposal was agreed upon by all the relevant stakeholders already. If you'd like to make a change to what was proposed there, starting back in the process, involving the right people, and getting an addendum would be appropriate.
That said, I thought the general pattern was to:
- require backendID as a parameter in the command
- default to looking at us-central1 as we 'traditionally' have
If someone is outside of us-central1, they get to include the --location
flag.
Having this flow also makes it more complex. Sticking with the picker, you have to also consider what happens in non-interactive environment (like a CI system). As written, this would hang, I believe, which may be unexpected (instead of simply failing out).
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.
🫡 I'll move the changes into another branch and bring up the idea in the devx room
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.
(If it's chosen that we should keep the existing dialog, I agree that we need to check for nonInteractive)
}; | ||
|
||
it("should createBackend", async () => { | ||
it("should createBackend with rollout policy", async () => { |
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.
Nothing here tests to make sure the rollout policy was called. Please add the appropriate logic here to test for that
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.
I may need to revert the label. I originally wrote the test to exercise this but realized it was for a smaller utility function and the larger flow is completely untested. I can either:
- Move creation of the rollout policy into a utility function and test it. This would be a trivial whitebox test that is unlikely to catch anything though.
- Add a new test that covers the overall flow of the entiere init process.
- Cry that init functions are generally sparsely tested in this codebase.
You make the call and I'll follow.
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.
Ah, yeah, this isn't actually testing doSetup
. Probably just revert the test name then. init function coverage is kinda a known weak point.
@@ -47,21 +45,27 @@ export const command = new Command("apphosting:backends:delete") | |||
}); | |||
} | |||
|
|||
let backend: apphosting.Backend; | |||
if (backendId) { |
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.
I personally don't like it better, because I hate the prompt selector flow in a CLI 🤷♂️ It's not a wrong thing to do, but I'm assuming that there were product discussions that brought us to the API proposal (as that's a requirement at the top of the document) and that the pattern in the proposal was agreed upon by all the relevant stakeholders already. If you'd like to make a change to what was proposed there, starting back in the process, involving the right people, and getting an addendum would be appropriate.
That said, I thought the general pattern was to:
- require backendID as a parameter in the command
- default to looking at us-central1 as we 'traditionally' have
If someone is outside of us-central1, they get to include the --location
flag.
Having this flow also makes it more complex. Sticking with the picker, you have to also consider what happens in non-interactive environment (like a CI system). As written, this would hang, I believe, which may be unexpected (instead of simply failing out).
}; | ||
|
||
it("should createBackend", async () => { | ||
it("should createBackend with rollout policy", async () => { |
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.
Ah, yeah, this isn't actually testing doSetup
. Probably just revert the test name then. init function coverage is kinda a known weak point.
Controversial UX changes have been removed and test name has been reverted. PTAL. |
@@ -197,10 +197,20 @@ export interface RolloutPolicy { | |||
// end oneof trigger | |||
stages?: RolloutStage[]; | |||
disabled?: boolean; | |||
|
|||
// TODO: This will be undefined if disabled is not true, right? |
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.
Yes, it should be.