-
Notifications
You must be signed in to change notification settings - Fork 146
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
Use third-party library for reporting install/uninstall progress #3623
Use third-party library for reporting install/uninstall progress #3623
Conversation
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
This pull request does not have a backport label. Could you fix it @fearful-symmetry? 🙏
NOTE: |
🌐 Coverage report
|
I'm ++ to using a third-party library here. I've been thinking along the same lines myself. The initial implementation was done as one of three OnWeek projects (so, pretty quickly) and, at the time, I thought it would be simpler to DIY this especially since we weren't doing anything too fancy like repainting the screen (like some third party progress trackers can do). I honestly hadn't thought it would introduce so much flakiness and headache. But after seeing that over the past few weeks, I'm very much in favor of just replacing this with a third-party library at this point. |
Alright, so, it looks like SonarQube is counting all the one-line log statements I added towards the code coverage percentage, which is...not great. |
I like the new progress bar and the time counter too! There are two things I was wondering if we could change:
|
@ycombinator added the newline. However, printing each message to a newline isn't quite something we can trivially do. |
@ycombinator wow, that happens too fast on my machine to even notice. Should be fixed now. |
Thanks @fearful-symmetry, I see the initial message during One nit: During uninstallation (
However, during installation (
Could we make these behaviors consistent? I'm not sure which direction makes more sense but I'm leaning slightly towards the way uninstallation behaves. |
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.
LGTM. Thanks for fixing this, Alex — much needed!
This pull request is now in conflicts. Could you fix it? 🙏
|
@@ -51,7 +51,7 @@ would like the Agent to operate. | |||
func installCmd(streams *cli.IOStreams, cmd *cobra.Command) error { | |||
err := validateEnrollFlags(cmd) | |||
if err != nil { | |||
return err | |||
return fmt.Errorf("could not validate flags: %w", err) |
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.
❤️
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.
LGTM
I am going to force merge this. Looking at the code that is missing coverage, some of it is covered by integration tests and I don't see value in simulating the 10+ error conditions we can hit just to verify a log line gets printed as expected. |
Just noticed this on a snapshot and it looks amazing 🤩 👍 |
What does this PR do?
fixes #3607
This uses a third-party library for creating a spinner that reports progress during install/uninstall operations.
Why is it important?
The old code was causing some flaky tests, and for such a small bit of code, it was a bit easier to just use a third-party library.
Checklist
./changelog/fragments
using the changelog tool