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
fix(778): git bug rm broken #808
fix(778): git bug rm broken #808
Conversation
@MichaelMure - This PR is a bit bigger than I'd like but the non-test code changes are pretty small. I'll annotate them with comments as I want to make sure these don't break anything. The rest of the code tests the following Cobra commands:
|
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!
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.
A pretty cool thing to have, just some comments for polishing
@MichaelMure - I actually wanted to talk about the use of "golden files" (as described by Mitchell Hashimoto's "Advanced Testing with Go") in The benefit of this type of test is that it will flag any time the The test failure on Windows is due to the differences in line termination characters - I'll fix this (and address printing the output as strings) to make sure the tests actually complete successfully, then will move on to addressing your other comments. At some point, we'll also need to redirect Finally, I was wondering why the git-bug/commands/user_create.go Line 93 in dd8134b
|
Yeah, the benefit of those golden files is not obvious to me when in balance with the complexity they bring and what can be tested with it. It seems to me that most of the time it would be testing Cobra or the few data formatting functions. It might be better to assert the result of the tests by simply checking things on the backend rather than the actual output. Data formatting functions (like Then comes the problem of the interactive commands. I suppose the same approach combined with stdin manipulation would work best?
I'm not sure but I think the idea was to have a proper new line in the terminal, yet have the output clean when reading stdout with a pipe or a program. That might not make sense. |
To be clear, it might be that golden files make sense in some case, it's just that testing with simpler method could go a long way before that's needed. Not to prevent you from doing it though :-) |
That makes perfect sense (and follows the "Unix way") - I'll have to watch for that in other commands as I expect to continue writing tests for the With respect to using golden files, after fixing the Windows build, I'll mark that test with |
@MichaelMure - I've redone the Next steps - submit a PR that moves all creation of |
Awesome, thanks! |
Feel free to merge when that make sense to you. |
Both the caching layer and the underlying repository were performing a mutex lock while resolving the bug prefix. This resulted in the outer lock succeeding and the inner lock being permanently blocked. Since the inner locking was guarding the vulnerable code, removing the outer lock fixes the problem without causing concurrency issues.
Resolves #778