-
Notifications
You must be signed in to change notification settings - Fork 36
Conversation
Codecov Report
@@ Coverage Diff @@
## master #233 +/- ##
=========================================
Coverage ? 72.90%
Complexity ? 1331
=========================================
Files ? 149
Lines ? 6194
Branches ? 480
=========================================
Hits ? 4516
Misses ? 1453
Partials ? 225
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Update Feature Workflow:
|
cli/cmd/update.go
Outdated
const ( | ||
commandUpdate = "update" | ||
flagForce = "force" | ||
flagRestart = "restart" |
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.
User can only "restart" a running detector? If current detector hasn't been started, is it possible user only set "restart" as true to start it after update ?
From the description "Will start detector if update is successful", it's better to name the flag as "start".
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.
Ack
cli/internal/controller/ad/ad.go
Outdated
if !proceed { | ||
return nil | ||
} | ||
err := c.StopDetector(ctx, input.ID) |
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 "force" is false, no need to stop detector.
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.
Ack
if latestDetector.LastUpdatedAt > input.LastUpdatedAt { | ||
return fmt.Errorf( | ||
"new version for detector is available. Please fetch latest version and then merge your changes") | ||
} |
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.
Check if detector is running? If detector is running and force
is false, we should fail immediately.
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.
Add Update detector method to call update rest api.
Create Update Detector Entity as an alias from Create Detector.
Add mapper function to map user input to request
Add controller method to update detecor based on configurations.
Added handler to process user input and call controller method, later process output from controller for command status.
Create Update command to accept update detector's configuration.
Updated restart to start Only stop detector if force is true
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 the change!
Update Detector Configurations
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.