-
Notifications
You must be signed in to change notification settings - Fork 25
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
Groundwork for multiple notification channels #14
Conversation
60fd4e9
to
3a00fdc
Compare
@boedy Let me know when this is ready for a code review. Please squash your commits before asking me to review. thanks! |
@jeffaco Yes, I'll be able to do that if you want. What's the reason the commits should be squashed upfront? I usually only commit working encapsulated parts and feel the commit messages help with describing the intent of each change. I understand the desire to keep the git history of the master branch clean, but if I'm not mistaking github allows you to squash the commits when merging this PR. As for the PR. I'm almost there I think. I'll let you know when it's ready for review 😄 ! |
@boedy I have multiple reasons for this:
So, if you can follow all that and it makes sense to have separate commit messages, I'm cool with that. For example, if you're refactoring mail test messages for support purposes, and you want that to be a completely separate commit, that's fine. But if it's contained in other work and mentioned in a multi-line commit, that's fine too. That's sort of up to you, as long as commit messages "stand alone" on their own and make sense. Hope this makes sense! |
I think I understand where you're coming from. I've just pushed my latest changes and squash / rewritten commit messages and in my opinion ready for review. Note I have not actually tested the email notifications. Might be good to still give that a try. |
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 haven't looked at README.md yet, there's a ton of churn there so it'll take a closer look. I did learn a few things from you about markdown formatting, though! 👍
Also, I haven't tested e-mail yet. I'll do that when I think we have something close to final.
In short, this is a GREAT job. I'm really happy with what you've done. There were some nits and some questions about how you went about testing the code. But other than that, this looks really good. Thanks!
Oh, by the way, on that first commit, please rewrite to get rid of the blank lines. Something like:
would be great. Thanks again. |
@jeffaco I made some new changes, but I'm just realising now, that previous comments will be lost if I force push my changes. What do you recommend? |
The comments are still there - you just need to pull up historical comments. If you've addressed everything in my latest batch of comments, feel free to force push. In this case, you had some outstanding questions (which I just answered), so it was appropriate to wait for clarification. That way, I'm only reviewing changes once and not twice. So address everything I said (unless you have followup questions), then then push again. Thanks! |
3771527
to
08ee464
Compare
@jeffaco I went ahead and gave it another shot. Along the way I discovered some things I had overlooked:
Back to you 👉 |
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 really like what you've done with the globalConfig tests, great job there!
Very minor nits here. Verify what I said, make any final changes, and bounce back to me. I'll take a final look, test without making any configuration changes (everything should still work), verify I get email, and then test one more time without -m
and setting up the notifiers.
I probably won't be able to do this tonight, but should be able to do this tomorrow.
Thanks for the awesome job with this feature!
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.
Looks good to me. Consider this approved for now; I'll do testing later tonight and then merge to master if all looks good. Thanks, again, for your contribution. Awesome job!
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.
Hi Boedy,
I'm having some problems during testing. Please see branch boedy-notifications on the github repo.
First, I don't have duplicacy-util on my default path, and that causes the unit tests to fail. I have a workaround for that (I would have preferred to fix through some sort of dependency injection, but that's harder so I'll leave that for another day).
But more importantly: E-mail isn't working. If I don't change anything and use -m, I should get success and failure notifications. Instead, I was getting onStart and onFailure notifications (not success).
In the final commit (marked WIP), I made changes that should have fixed that, but strangely, it's not working, and it will take more detailed debugging for me to understand why. It's late, I'm tired, and I don't really have time for that right now, unfortunately.
Can you take a look at my final commit and see exactly why -mt (or just running duplicacy-util normally) won't send onSuccess notifications? If you don't have time, I'll look further later. But my thought is that you have time and understand your additions well enough to rapidly find the issue.
Thanks in advance.
Added support for custom notifiers Ingore gotags file Update README.md to reflect changes Move sendTestmail function to sendmail.go Throw error if invalid notification channel is set in global config Abstracted notification channel configuration (with tests) Add duplicacy executable stub for testing
Throw error if no notifiers are set during notification testing
Unit tests don't necessarily have a fully runnable environment. For example, there may not be "duplicacy" in the path. Add a framework to disable specific operations during unit testing.
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 just configured email settings and tested all notifications types. All were successfully sent when using -tn, -tm, but when running a full backup with like you said success was never sent. Turned out there was no notifiyOfSuccess
being called...
I tried both the old and new email configuration styles (both worked).
@@ -94,6 +97,9 @@ func performBackup() error { | |||
logger.Println("######################################################################") | |||
logMessage(logger, fmt.Sprint("Operations completed in ", getTimeDiffString(startTime, endTime))) | |||
|
|||
// Notify all configure channels that the backup process has completd | |||
notifyOfSuccess() |
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.
My Apologies, you were right. Somehow I forgot to actually put this line here 😞.
This is very odd. I knew the onSuccess notifier wasn't called, but this was secondary. I couldn't get But yesterday, from home, if I ran Any thoughts here? Or should I chalk it up to insanity, and try again? With no changes at all to the configuration file, I would expect:
to behave 100% identically. |
Update: I'm clueless. I just tried You may want to take a look at the final commit to insure it's correct: 41a57a9. Thanks. |
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.
So very odd. I just tested again, passed all tests (with both old and new config file formats). Merging now.
As discussed in #10. I'll be updating this pull request until all todo's are checked off.
Changelog